Ask Your Question
0

Exporting PCAP to Database

asked 2021-07-31 17:54:49 +0000

menticol gravatar image

Hi guys!

I'm working on a little program to convert .PCAP files into MySQL tables, in order to make analysis easier (a program that I will share here as soon as is finished, naturally).

My first command is running on a Windows console and outputs a very nice filtered .pcap file, filled with information.

tshark -r "C:\proyecto \20210729_15_45-MIRR-BKP.pcap" -Y camel -w "C:\proyecto\20210729_15_45-MIRR-BKP_filtered.pcap"

However, on my next step, converting the aforementioned .PCAP to JSON, I'm getting a blank JSON file.

tshark -r "C:\proyecto\20210729_15_45-MIRR-BKP_filtered.pcap" -T json -w "C:\proyecto\20210729_15_45-MIRR-BKP.json"

I used the code provided by @Chuckc on this post.

Once I get the .JSON part working, I'll implement a little UI to select what packet information will be exported, etc.

Thank you and best regards

edit retag flag offensive close merge delete

Comments

@Chuckc provided the answer to this question in his comment. Quoting him:

NOTE: -w provides raw packet data, not text. If you want text output you need to redirect stdout (e.g. using '>'), don't use the -w option for this.

Thank you very much!

menticol gravatar imagementicol ( 2021-08-03 04:45:37 +0000 )edit

I turned his comment into an answer. (That option might not have been offered to you, as you might not have had the privileges to do so.)

Guy Harris gravatar imageGuy Harris ( 2021-08-03 06:34:53 +0000 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-31 20:40:38 +0000

Chuckc gravatar image

From the tshark man page:

NOTE: -w provides raw packet data, not text. If you want text output you need to redirect stdout (e.g. using '>'), don't use the -w option for this.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-07-31 17:53:39 +0000

Seen: 1,572 times

Last updated: Aug 03 '21