please help tshark -b duration problem.

asked 2020-01-24 16:13:19 +0000

lily gravatar image

updated 2020-01-25 11:52:07 +0000

grahamb gravatar image

I have a bash script that using tshark command. when I use tshark -b filesize option, all the script lines are running well. But, when I use tshark -b duration option instead, the capturing is working well but the next script lines are stopped.

Or do you know how to split a packet every 30 seconds besides the -b duration option?

I'll give my script. please help me..

This is my bash script. tshark version is 3.1.1

printf "start packet capturing\n\n"
while echo `~/wireshark/build/run/tshark -nni ens33 -T ek -w /var/packets/test.pcap -b duration:30`
do
    shopt -s nullglob 
    for filename in /var/packets/*.pcap; do
            foldername=$(echo "$filename" | awk '{print (substr($0, 25, 8));}'); 
            mkdir -p /var/packets/"$foldername" 
            echo `~/wireshark/build/run/tshark -r "$filename" -T ek > "$filename".json`
            mv "$filename" /var/packets/"$foldername"
            mv "$filename".json /var/Json
            echo "$filename $foldername" ;
    done
done

thanks.

edit retag flag offensive close merge delete