Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. def wrpcap(out_path,packets=[],magic_number=0xa1b2c3d4,version_major=2,version_minor=4,thiszone=0,timestamp=0,snaplen=0x7FFF,link_type=1):
  2. import struct
  3. open(out_path,'w+').write(struct.pack('<IHHiIII',magic_number,version_major,version_minor,thiszone,timestamp,snaplen,link_type)+
  4. ''.join([struct.pack('<IIII',p.time,round(p.time%1*1000000),len(str(p)),len(str(p)))+str(p) for p in packets]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement