fix hopefully
All checks were successful
Build and Deploy MITM Webserver / traffic_target (push) Successful in 1s
Build and Deploy MITM Webserver / build (push) Successful in 11s

This commit is contained in:
2026-03-30 22:14:48 +02:00
parent de6edd6b68
commit a0efa8ba27
2 changed files with 15 additions and 41 deletions

View File

@@ -496,10 +496,6 @@ class DatabasePool:
stream_kind: str,
stream_id: int,
observed_at_ms: int,
src_ip: str,
dst_ip: str,
src_port: int,
dst_port: int,
enrichment: Dict[str, Any],
window_ms: int,
) -> int:
@@ -526,29 +522,15 @@ class DatabasePool:
AND (capture_iface = $2 OR ingress_if = $2 OR egress_if = $2)
AND timestamp BETWEEN $5 AND $6
AND (
(
CASE
WHEN $3 = 'tcp' THEN COALESCE(dpi_metadata -> 'tcp' ->> 'stream', '')
WHEN $3 = 'udp' THEN COALESCE(dpi_metadata -> 'udp' ->> 'stream', '')
ELSE ''
END
) = $4
OR (
src_ip = $7::inet
AND dst_ip = $8::inet
AND COALESCE(src_port, 0) = $9
AND COALESCE(dst_port, 0) = $10
)
OR (
src_ip = $8::inet
AND dst_ip = $7::inet
AND COALESCE(src_port, 0) = $10
AND COALESCE(dst_port, 0) = $9
)
)
CASE
WHEN $3 = 'tcp' THEN COALESCE(dpi_metadata -> 'tcp' ->> 'stream', '')
WHEN $3 = 'udp' THEN COALESCE(dpi_metadata -> 'udp' ->> 'stream', '')
ELSE ''
END
) = $4
AND (
app_protocol IS NULL
OR app_protocol IN ('TCP', 'UDP', 'IP', 'IPv6', 'ETH')
OR UPPER(app_protocol) IN ('TCP', 'UDP', 'IP', 'IPV4', 'IPV6', 'ETH', 'ETHERNET', 'ETHERTYPE', 'FRAME', 'DATA')
OR app_category IS NULL
OR app_category IN ('Transport', 'Network', 'Protocol')
OR app_confidence IS NULL
@@ -563,22 +545,22 @@ class DatabasePool:
SET
updated_at = NOW(),
app_protocol = CASE
WHEN packets.app_protocol IS NULL OR packets.app_protocol IN ('TCP', 'UDP', 'IP', 'IPv6', 'ETH')
THEN COALESCE($11, packets.app_protocol)
WHEN packets.app_protocol IS NULL OR UPPER(packets.app_protocol) IN ('TCP', 'UDP', 'IP', 'IPV4', 'IPV6', 'ETH', 'ETHERNET', 'ETHERTYPE', 'FRAME', 'DATA')
THEN COALESCE($7, packets.app_protocol)
ELSE packets.app_protocol
END,
app_category = CASE
WHEN packets.app_category IS NULL OR packets.app_category IN ('Transport', 'Network', 'Protocol')
THEN COALESCE($12, packets.app_category)
THEN COALESCE($8, packets.app_category)
ELSE packets.app_category
END,
app_confidence = CASE
WHEN packets.app_protocol IS NULL OR packets.app_protocol IN ('TCP', 'UDP', 'IP', 'IPv6', 'ETH')
THEN COALESCE($13, packets.app_confidence)
WHEN packets.app_protocol IS NULL OR UPPER(packets.app_protocol) IN ('TCP', 'UDP', 'IP', 'IPV4', 'IPV6', 'ETH', 'ETHERNET', 'ETHERTYPE', 'FRAME', 'DATA')
THEN COALESCE($9, packets.app_confidence)
ELSE packets.app_confidence
END,
app_hostname = COALESCE(packets.app_hostname, $14),
app_is_encrypted = COALESCE(packets.app_is_encrypted, $15),
app_hostname = COALESCE(packets.app_hostname, $10),
app_is_encrypted = COALESCE(packets.app_is_encrypted, $11),
flow_id = COALESCE(
packets.flow_id,
COALESCE(NULLIF(packets.capture_session_id, '') || ':', '') || $3 || ':' || $4
@@ -588,7 +570,7 @@ class DatabasePool:
SELECT DISTINCT source
FROM unnest(
COALESCE(packets.capture_sources, ARRAY[]::text[]) ||
COALESCE($16::text[], ARRAY[]::text[])
COALESCE($12::text[], ARRAY[]::text[])
) AS source
)
)
@@ -602,10 +584,6 @@ class DatabasePool:
str(stream_id),
lower_bound,
upper_bound,
src_ip,
dst_ip,
src_port,
dst_port,
enrichment.get("app_protocol"),
enrichment.get("app_category"),
enrichment.get("app_confidence"),