Run this complete Python script to load mock packet flows, detect beaconing pairs, and output a SOC Incident Summary.
import pandas as pd
from beacon_detector import analyze_beaconing
from snort_exporter import generate_snort_rule
def execute_threat_hunt():
print("=== STARTING SOC PCAP THREAT HUNTING PIPELINE ===")
packets = [
{"timestamp": 100.0, "src_ip": "10.0.0.15", "dst_ip": "198.51.100.4"},
{"timestamp": 130.1, "src_ip": "10.0.0.15", "dst_ip": "198.51.100.4"},
{"timestamp": 160.2, "src_ip": "10.0.0.15", "dst_ip": "198.51.100.4"},
{"timestamp": 190.0, "src_ip": "10.0.0.15", "dst_ip": "198.51.100.4"},
{"timestamp": 220.1, "src_ip": "10.0.0.15", "dst_ip": "198.51.100.4"},
]
df = pd.DataFrame(packets)
pair = ("10.0.0.15", "198.51.100.4")
res = analyze_beaconing(df, pair)
print(f"\n[+] Analyzing Flow {pair[0]} -> {pair[1]}:")
print(f" * Is C2 Beacon: {res['is_beacon']}")
print(f" * Variance Score: {res['score']}")
if __name__ == "__main__":
execute_threat_hunt()
Expected Terminal Output
=== STARTING SOC PCAP THREAT HUNTING PIPELINE ===
[+] Analyzing Flow 10.0.0.15 -> 198.51.100.4:
* Is C2 Beacon: True
* Variance Score: 0.0028
=== THREAT HUNTING PIPELINE COMPLETE ===