Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pcapy
- from impacket.ImpactDecoder import *
- # list all the network devices
- pcapy.findalldevs()
- max_bytes = 16384
- promiscuous = False
- read_timeout = 100 # in milliseconds
- pc = pcapy.open_live("any", max_bytes,
- promiscuous, read_timeout)
- pc.setfilter('tcp')
- # callback for received packets
- out_file = open('output.txt', 'w')
- def recv_pkts(hdr, data):
- #try:
- packet = EthDecoder().decode(data)
- #print packet
- out_file.write(str(packet))
- #except:
- # pass
- packet_limit = 1000 # infinite
- pc.loop(packet_limit, recv_pkts) # capture packets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement