Revision: 3640
Updated Code
at August 27, 2007 10:49 by scyclops
Updated Code
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
Revision: 3639
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 27, 2007 10:48 by scyclops
Initial Code
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)
Initial URL
http://andrewtrusty.com/
Initial Description
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
Initial Title
Live Packet Capture in Python with pcapy
Initial Tags
Initial Language
Python