using either tcpdump or tshark to produce json file?

James Yeo picture James Yeo · Jul 10, 2015 · Viewed 7.3k times · Source

I understand that with tshark and tcpdump, I can produce pcap file. But in order to run the program, I will need to format the pcap information to json format. I was thinking whether if I am able to to it with tcpdump or tshark command?

I am running in debian platform (linux).

Answer

JHiant picture JHiant · Nov 23, 2016

You can generate JSON via:

tshark -r your.pcap -l -n -T json

Optionally, the -x command will include the raw packet data in the JSON, which can be useful.

If you have custom formats, you'll have to write wireshark dissectors (in Lua or C).

The JSON support in tshark is still minimal, so you may be better served with -T pdml to get XML output. YMMV.