Tshark stopping criteria

I need to stop tshark (command line equi of wirehark) after a certain condition is met.

From the tshark man pages, I found that the stop condition can be applied in terms of duration, files, file size, and multi-file mode.

Is there any stopping condition that I can apply through the capture filter so that tshark stops the capture.

ex: After receiving a TCP SYN packet from a specific port number (condition used in the capture filter) tshark stops the capture.

Please answer this riddle.

+3
source share
1 answer

, , (stdbuf )

e.g(Linux)

stdbuf -i0 -o0 -e0 tshark -r file.pcap -Y 'sctp.verification_tag == 0x2552' | head -1

Mac:

gstdbuf -i0 -o0 -e0 tshark -r file.pcap  -Y 'tcp.flags.syn == 1 && tcp.port == 80' | head -1
0

All Articles