How do i parse a pcap file and convert it into a text file wherein each line in the text file is a packet?
i tried writing it into text file as given below but special characters are showing up when i print eth. Therefore, when i try to write it into a text file, the following error shows up.
TypeError: expected a character buffer object
import dpkt
f1 = open('temp.pcap')
pcap = dpkt.pcap.Reader(f1)
f2 = open('tempMan.txt', 'w')
for ts, buf in pcap:
eth = dpkt.ethernet.Ethernet(buf)
print eth
f2.write(eth)