MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _record_flow_sample

Method _record_flow_sample

traffic_analyzer.py:1210–1220  ·  view source on GitHub ↗

Append one outbound packet to the per-flow ring buffer. Called from the packet parser for every outbound packet from an internal host to an external destination on a non-denylisted port.

(self, src_ip: str, dst_ip: str, dst_port: int,
                            ts: float, bytes_out: int)

Source from the content-addressed store, hash-verified

1208 self._create_alert(
1209 level=TrafficAlertLevel.MEDIUM,
1210 category=AlertCategory.SUSPICIOUS_PORT.value,
1211 message=(f"Suspicious port {suspicious_port}/{proto_lc or '?'} "
1212 f"({port_description}): {src_ip} -> {dst_ip}"),
1213 src_ip=src_ip,
1214 dst_ip=dst_ip,
1215 details={
1216 'port': suspicious_port,
1217 'port_description': port_description,
1218 'protocol': proto_lc or 'unknown',
1219 'broadcast': is_broadcast,
1220 'direction': 'outbound' if dst_port == suspicious_port else 'inbound'
1221 }
1222 )
1223

Calls 1

appendMethod · 0.80