Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def wrpcap(out_path,packets=[],magic_number=0xa1b2c3d4,version_major=2,version_minor=4,thiszone=0,timestamp=0,snaplen=0x7FFF,link_type=1):
- import struct
- open(out_path,'w+').write(struct.pack('<IHHiIII',magic_number,version_major,version_minor,thiszone,timestamp,snaplen,link_type)+
- ''.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