Storing packets on Data Base

asked 2023-09-10 15:54:51 +0000

Loloro gravatar image

I'm developing a project to store real-time packet capture data on a DB. My current strategy is to run Tshark to make a JSON file and then read that by script and store it on DB. But here I'm facing an issue script not being able to read JSON file simultaneously. it says "Permission Denied". I need help with this. Is there any better strategy or this is the one? Because this is also memory-consuming because the .pcapng file also creating behind with json file because both are useless because DB is what I need. My ultimate goal is to access packet data through API by a GUI.

edit retag flag offensive close merge delete

Comments

Can you modify your script to read from a pipe instead of a file?
tshark -T json | script.foo

Chuckc gravatar imageChuckc ( 2023-09-10 16:04:10 +0000 )edit

I'm also recenly discovered this method with chat GPT. But so buggy ;). What is the difference between "tshark -T json | script.foo" and "tshark -T json >> script.foo" . Also sir I need to know is this the comman approach i can follow? Because still .pcapng file is usless for me. It's using huge amount of space.

Loloro gravatar imageLoloro ( 2023-09-10 16:11:14 +0000 )edit

| pipes the output of tshark to the input of script script.foo.
>> redirects the output of tshark to append to a file called script.foo.

Chuckc gravatar imageChuckc ( 2023-09-10 16:30:44 +0000 )edit

This works. Thanks. I'm using tshark -i Wi-Fi -T json | ./pipe.py command with python script. I have to deal with High traffic in future. What can i improve in tshark command.

Loloro gravatar imageLoloro ( 2023-09-11 08:54:01 +0000 )edit