I captured packets in wireshark, filtered for the protocol I'm interested in (DIS), then exported this to a pcap file. I'd like to do analysis on this data in Python. The only part I'm interested in for each packet is the data layer header/data. How can I extract this from all the packets and save to something like a txt, json, or csv?
I just read about tshark and attempted a line of code I found: tshark -r capture.pcap -T fields -e data > data.txt
, but this returns an empty file. I can see the data I'm interested in through wireshark though.
tshark -r capture.pcap -T json
to dump the data with it's field names, and examine that output to get the names of the fields you want to output with the-e
option.