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).
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.