There are two methods I'm aware of that should help you accomplish your goal, both of which involve specifying the columns you want to use.
Method 1: Use Wireshark to configure a profile with the columns you want and then use -T fields
along with -e field
to specify the columns to display.
- Add a new Wireshark profile (Edit -> Configuration Profiles) and configure the columns you want in the output. (NOTE: Strictly speaking you don't need to create a new profile; however, it allows you to display bittorrent-related columns only when using this profile when analyzing bittorrent traffic, and it avoids polluting the Default or other profiles with bittorrent columns when you're not analyzing bittorrent traffic.)
- If you want all those columns, then just run
tshark
selecting that profile, e.g., tshark -C Bittorrent -2 -Y "bittorrent" -r bittorrent.pcap
.
- If you want a subset of those columns, then use
-T fields
and any combination of -e field
and "-e _ws.col.Name Of Column"
to display the columns you want., e.g. if you added the bittorrent.msg.type
field as a column and kept the column name as the default "Message Type", then you'd use something like this: tshark -C Bittorrent -2 -Y "bittorrent" -r bittorrent.pcap -T fields -e frame.number -e "_ws.col.Message Type"
You could even add -e bittorrent.msg.type
too if you also want the values instead of just the strings.
Method 2: Directly specify the columns you want without necessarily having to add them as columns in Wireshark first.
First, to get an idea of the built-in columns that tshark
supports, you can run tshark -G column-formats
, and an example is provided in the output.
So, to accomplish the same thing as before but using this method, on Windows you'd use: tshark -2 -Y "bittorrent" -r bittorrent.pcap -o "gui.column.format:\"No.\",\"%m\",\"Message Type\",\"%Cus:bittorrent.msg.type\""
, and on *nix you'd use: tshark -2 -Y "bittorrent" -r bittorrent.pcap -o 'gui.column.format:"No.","%m","Message Type","%Cus:bittorrent.msg.type"'
(The only difference between Windows and *nix is the quoting.)