Advertisement
dc5553

Rolling pcap with scapy

Apr 19th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. #!/usr/bin/python -tt
  2.  
  3. from scapy.all import *
  4.  
  5. pkts = []
  6. iter = 0
  7. pcapnum = 0
  8.  
  9. def makecap(x):
  10.     global pkts
  11.     global iter
  12.     global pcapnum
  13.     pkts.append(x)
  14.     iter += 1
  15.     if iter == 500:
  16.         pcapnum += 1
  17.         pname = "pcap%d.pcap" % pcapnum
  18.         wrpcap(pname, pkts)
  19.         pkts = []
  20.         iter = 0
  21.  
  22. while 1:
  23.     sniff(prn=makecap)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement