PCAP Network Statistics Analysis
This skill analyzes PCAP files and fills a CSV template with computed network statistics. Metric names are discovered from the template at runtime - no hardcoded metric names.
Quick Start
pythonimport sys sys.path.insert(0, '/app/environment/skills/evo-pcap-analysis/scripts') from pcap_stats import run_end_to_end pcap_path = '/root/packets.pcap' template_path = '/root/network_stats.csv' output_path = '/root/network_stats.csv' results, ok = run_end_to_end(pcap_path, template_path, output_path) if not ok: print("Validation failed!") else: print("Done - all metrics filled")
Architecture
load_packets(path)- Load PCAP with Scapy (handles VLAN, tunnels)count_protocols(packets)- Independent layer checks per protocolcompute_rate_buckets(timestamps, bucket_size)- Relative time bucketingcompute_size_stats(packets)- Full frame length statsshannon_entropy(values)- Shannon entropy in bitscompute_graph(packets)- Directed IP graph topologycompute_iat(timestamps)- Inter-arrival time with population variancecompute_pcr(packets)- Producer/Consumer ratio per IPcompute_flows(packets)- 5-tuple flow analysisdetect_port_scan(packets)- Converging evidence detectiondetect_dos(buckets)- Rate spike detectiondetect_beaconing(iat_stats)- Low CV detectionresolve_metric(name, computed)- Dynamic name-to-value resolutionanalyze_and_resolve(pcap, template)- Full pipeline with template discoveryvalidate_csv(path)- Check all template lines have values


