First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

I only need the data of OICQ protocol, but the filtering protocol does not seem to be effective

  • retag add tags

I want to grab the data packets of OICQ protocol, use the command "tshark -i eth1 -O OICQ -T json". I only need the data of OICQ protocol, but the filtering protocol does not seem to be effective.

I can directly search for OICQ packets using wireshark.

hahaha's avatar
1
hahaha
asked 2021-06-22 02:03:32 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

To quote the TShark man page:

  −O  <protocols>
       Similar to the −V option, but causes TShark to only show a detailed
       view of the comma‐separated list of protocols specified, and show
       only the top‐level detail line for all other protocols, rather than
       a detailed view of all protocols.  Use the output of "tshark −G
       protocols" to find the abbreviations of the protocols you can
       specify.

So -O does not specify "show me only packets for this protocol", it specifies "for -V output, show details only for protocols in this list", so its not like filtering, it's like opening up the packet details pane items for the protocols in question.

The option you want is:

   −Y|−−display−filter  <displaY filter>
       Cause the specified filter (which uses the syntax of read/display
       filters, rather than that of capture filters) to be applied before
       printing a decoded form of packets or writing packets to a file.
       Packets matching the filter are printed or written to file; packets
       that the matching packets depend upon (e.g., fragments), are not
       printed but are written to file; packets not matching the filter
       nor depended upon are discarded rather than being printed or
       written.

       Use this instead of −R for filtering using single‐pass analysis. If
       doing two‐pass analysis (see −2) then only packets matching the
       read filter (if there is one) will be checked against this filter.

so do -Y oicq (protocol names are generally lower-case - -Y OICQ gives an error).

Guy Harris's avatar
19.9k
Guy Harris
answered 2021-06-22 06:08:22 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer