Parse a Wireshark pcap file

Michiel Overtoom motoom at xs4all.nl
Wed Dec 28 16:54:35 EST 2016


> On 2016-12-27, at 20:46, 1991manish.kumar at gmail.com wrote:
> 
> I have a pcap file, I want to parse that file & fetch some information like Timestamp, Packet Size, Source/Dest IP Address, Source/Dest Port, Source/ Dest MAC address.

pcapy can do this.

import pcapy
pcap = pcapy.open_offline("httpsession.pcap")

def callback(hdr, data):
    ... do something with hdr and data, which is the captured packet

pcap.loop(0, callback)

Greetings,




More information about the Python-list mailing list