libpcap and python
Terry Reedy
tjreedy at udel.edu
Mon Feb 1 15:58:19 EST 2010
On 2/1/2010 7:47 AM, Mag Gam wrote:
> Hello All,
>
> I used tcpdump to capture data on my network. I would like to analyze
> the data using python -- currently using ethereal and wireshark.
>
> I would like to get certain type of packets (I can get the hex code
> for them), what is the best way to do this? Lets say I want to capture
> all events of `ping localhost`
The following is pretty straightforward.
def process(dump, wanted, func):
for packet in dump:
if packet_type(packet) == wanted:
func(packet)
Perhaps you can ask a more specific question.
Terry Jan Reedy
More information about the Python-list
mailing list