/ Published in: Python
Tried using pypcap but it didn't seem to do anything and I am too lazy to compile python-libpcap.
Requires:
- pcapy python module (http://oss.coresecurity.com/projects/pcapy.html)
- impacket python module (http://oss.coresecurity.com/projects/impacket.html)
- pcap library, for Windows use WinPCap (http://www.winpcap.org/)
Sources:
- http://oss.coresecurity.com/pcapy/doc/pt01.html
- http://www.thescripts.com/forum/post2740081-5.html
Requires:
- pcapy python module (http://oss.coresecurity.com/projects/pcapy.html)
- impacket python module (http://oss.coresecurity.com/projects/impacket.html)
- pcap library, for Windows use WinPCap (http://www.winpcap.org/)
Sources:
- http://oss.coresecurity.com/pcapy/doc/pt01.html
- http://www.thescripts.com/forum/post2740081-5.html
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import pcapy from impacket.ImpactDecoder import * # list all the network devices pcapy.findalldevs() max_bytes = 1024 promiscuous = False read_timeout = 100 # in milliseconds pc = pcapy.open_live("name of network device to capture from", max_bytes, promiscuous, read_timeout) pc.setfilter('tcp') # callback for received packets def recv_pkts(hdr, data): packet = EthDecoder().decode(data) print packet packet_limit = -1 # infinite pc.loop(packet_limit, recv_pkts) # capture packets