Ask Your Question

leonardus's profile - activity

2023-02-08 02:17:54 +0000 received badge  Famous Question (source)
2023-01-02 20:50:25 +0000 asked a question Filter based on paths

Filter based on paths I'm on CentOS. I'm analyzing some SMB traffic. I'd like to find TCP streams related to certain pa

2023-01-02 18:37:56 +0000 commented answer Capture inbound packets only

I played with something similar. The thing with this is that there are inbound packets that have destination mac other t

2023-01-02 01:34:50 +0000 asked a question Capture inbound packets only

Capture inbound packets only For example, with tcpdump, on some platforms something like tcpdump -i eth0 -Q in will capt

2022-12-24 19:14:34 +0000 received badge  Popular Question (source)
2022-12-24 19:14:34 +0000 received badge  Notable Question (source)
2022-11-30 02:44:32 +0000 marked best answer Best way to get just one packet

I want to extract some information from a pcap file that was generated without any filter.

But, all I need to extract that info is one frame.

What I'm currently doing is something like this:

good_frame=$(tshark -r file.pcap -Y 'filter expression'  -T fields -e frame.number | head -n1)
tshark -r file.pcap -Y 'frame.number=="$good_frame"' -T fields -e desired.field1 -e desired.field2

Is there a better way to do it?

I was thinking something like:

tshark -r file.pcap -Y 'filter expression' -c 1 -w - | tshark - -T fields -e desired.field1 -e desired.field2
2022-11-30 02:44:32 +0000 received badge  Scholar (source)
2022-11-30 02:44:19 +0000 commented answer Best way to get just one packet

Reading the documentation for -2 and -R, this makes a lot of sense. Thanks.

2022-11-30 02:38:21 +0000 commented question Best way to get just one packet

Correct. I'll filter for one protocol to find out whether that particular pcap file contains it. Then if it does, I get

2022-11-28 05:07:35 +0000 asked a question Best way to get just one packet

Best way to get just one packet I want to extract some information from a pcap file that was generated without any filte