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('ex22.pcap'):
22 # print ("Src: %s (ether), Dest: %s (ip)" % (src, dst))
24 if (src,dst) in flowset:
25 i,o = flowset[(src,dst)]
26 flowset[(src,dst)] = (i+1,o)
27 elif (dst,src) in flowset:
28 i,o = flowset[(dst,src)]
29 flowset[(dst,src)] = (i,o+1)
31 flowset[(src,dst)] = (1, 0)
35 for flow,counts in flowset.items():
36 if counts[0]+counts[1] > 200:
37 largeflows[flow] = counts