fix eth type and db
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 1m40s

This commit is contained in:
2026-03-07 10:26:51 +01:00
parent 79b2f1e673
commit 161ed0f145
6 changed files with 79 additions and 85 deletions

View File

@@ -91,11 +91,8 @@ class DatabasePool:
"""
INSERT INTO packets (
packet_uid,
iface,
ingress_if,
egress_if,
observed_ifaces,
direction,
verdict,
verdict_reason,
verdict_confidence,
@@ -104,10 +101,12 @@ class DatabasePool:
verdict_seen_at,
src_mac,
dst_mac,
eth_type_raw,
eth_type,
vlan_id,
src_ip,
dst_ip,
ip_proto_raw,
ip_proto,
src_port,
dst_port,
@@ -125,14 +124,11 @@ class DatabasePool:
) VALUES(
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,
$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,
$24,$25,$26,$27,$28,$29,$30::jsonb,$31::jsonb,$32
$24,$25,$26,$27,$28,$29::jsonb,$30::jsonb,$31
)
ON CONFLICT (packet_uid) DO UPDATE SET
iface = COALESCE(EXCLUDED.iface, packets.iface),
ingress_if = COALESCE(EXCLUDED.ingress_if, packets.ingress_if),
egress_if = COALESCE(EXCLUDED.egress_if, packets.egress_if),
observed_ifaces = COALESCE(EXCLUDED.observed_ifaces, packets.observed_ifaces),
direction = COALESCE(EXCLUDED.direction, packets.direction),
verdict = COALESCE(EXCLUDED.verdict, packets.verdict),
verdict_reason = COALESCE(EXCLUDED.verdict_reason, packets.verdict_reason),
verdict_confidence = COALESCE(EXCLUDED.verdict_confidence, packets.verdict_confidence),
@@ -141,10 +137,12 @@ class DatabasePool:
verdict_seen_at = COALESCE(EXCLUDED.verdict_seen_at, packets.verdict_seen_at),
src_mac = COALESCE(EXCLUDED.src_mac, packets.src_mac),
dst_mac = COALESCE(EXCLUDED.dst_mac, packets.dst_mac),
eth_type_raw = COALESCE(EXCLUDED.eth_type_raw, packets.eth_type_raw),
eth_type = COALESCE(EXCLUDED.eth_type, packets.eth_type),
vlan_id = COALESCE(EXCLUDED.vlan_id, packets.vlan_id),
src_ip = COALESCE(EXCLUDED.src_ip, packets.src_ip),
dst_ip = COALESCE(EXCLUDED.dst_ip, packets.dst_ip),
ip_proto_raw = COALESCE(EXCLUDED.ip_proto_raw, packets.ip_proto_raw),
ip_proto = COALESCE(EXCLUDED.ip_proto, packets.ip_proto),
src_port = COALESCE(EXCLUDED.src_port, packets.src_port),
dst_port = COALESCE(EXCLUDED.dst_port, packets.dst_port),
@@ -162,11 +160,8 @@ class DatabasePool:
RETURNING id, timestamp
""",
pkt_info["packet_uid"],
pkt_info.get("iface"),
pkt_info.get("ingress_if"),
pkt_info.get("egress_if"),
pkt_info.get("observed_ifaces"),
pkt_info.get("direction"),
pkt_info.get("verdict"),
pkt_info.get("verdict_reason"),
pkt_info.get("verdict_confidence"),
@@ -175,10 +170,12 @@ class DatabasePool:
pkt_info.get("verdict_seen_at"),
pkt_info.get("src_mac"),
pkt_info.get("dst_mac"),
pkt_info.get("eth_type_raw"),
_db_text(pkt_info.get("eth_type")),
pkt_info.get("vlan_id"),
pkt_info.get("src_ip"),
pkt_info.get("dst_ip"),
pkt_info.get("protocol_raw"),
_db_text(pkt_info.get("protocol_name") or pkt_info.get("protocol")),
pkt_info.get("src_port"),
pkt_info.get("dst_port"),