3 # disable IPv6 error message
5 logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
6 from scapy.all import *
7 logging.getLogger("scapy.runtime").setLevel(logging.WARN)
8 from pprint import pprint
10 # disable payload parsing (saves two seconds runtime^^)
15 for p in PcapReader('ex21.pcap'):
20 if (src,dst) in flowset:
21 i,o = flowset[(src,dst)]
22 flowset[(src,dst)] = (i+1,o)
23 elif (dst,src) in flowset:
24 i,o = flowset[(dst,src)]
25 flowset[(dst,src)] = (i,o+1)
27 flowset[(src,dst)] = (1, 0)
31 for flow,counts in flowset.items():
32 if counts[0]+counts[1] >= 400:
33 largeflows[flow] = counts