TSHARK(1)

๐Ÿ’… TSHARK โ€” like, the manual page, bestie

tshark(1) โ€” yes it's a whole section-1 man page and yes we're gonna get through it together ๐Ÿซถ


โœจ NAME โœจ

tshark โ€” dump and analyze network traffic ๐ŸŒ๐Ÿ’–


โœจ SYNOPSIS โœจ

tshark [ -i <capture interface>|- ] [ -f <capture filter> ] [ -2 ]
[ -r <infile> ] [ -w <outfile>|- ] [ options ] [ <filter> ]

tshark -h|--help

tshark -v|--version

โœจ DESCRIPTION โœจ

Okay so, real talk: TShark is a network protocol analyzer, and it ate. ๐Ÿ’… It lets you capture packet data from a live network, or read packets from a previously saved capture file โ€” and then it either prints a decoded form of those packets to standard output or writes the packets to a file. TShark's native capture file format is pcapng format, which is also the format used by Wireshark and various other tools. ๐ŸŽ€

If you don't set any options at all, TShark will work much like tcpdump. It uses the pcap library to capture traffic from the first available network interface and displays a summary line on the standard output for each received packet. no cap. ๐Ÿฆ‹

When you run it with the -r option โ€” specifying a capture file to read from โ€” TShark will again work much like tcpdump, reading packets from the file and displaying a summary line on standard output for each packet read. TShark is able to detect, read and write the same capture files that are supported by Wireshark. The input file doesnโ€™t need a specific filename extension; the file format and an optional gzip, Zstandard, or LZ4 compression will be automatically detected. ๐Ÿ”โœจ

Near the beginning of the DESCRIPTION section of wireshark(1) or https://www.wireshark.org/docs/man-pages/wireshark.html is a detailed description of the way Wireshark handles this, which is the same way TShark handles this. iykyk ๐Ÿ“š

Compressed file support uses (and therefore requires) the zlib library. If the zlib library is not present when compiling TShark, it will be possible to compile it, but the resulting program will be unable to read compressed files. Similarly, LZ4 and ZStandard also require their respective libraries. ๐Ÿ’€ (like, it'll build, but it won't slay)

When displaying packets on the standard output, TShark writes, by default, a summary line containing the fields specified by the preferences file (which are also the fields displayed in the packet list pane in Wireshark) โ€” although if itโ€™s writing packets as it captures them, rather than writing packets from a saved capture file, it wonโ€™t show the "frame number" field. ๐Ÿ™ˆ

  • If the -V option is specified, it instead writes a view of the details of the packet, showing all the fields of all protocols in the packet. ๐Ÿ‘‘
  • If the -O option is specified, it will only show the full details for the protocols specified, and show only the top-level detail line for all other protocols. Use the output of "tshark -G protocols" to find the abbreviations of the protocols you can specify. ๐Ÿ”–
  • If the -P option is specified with either the -V or -O options, both the summary line for the entire packet and the details will be displayed. ๐Ÿ’–

Packet capturing is performed with the pcap library. That library supports specifying a filter expression; packets that donโ€™t match that filter are discarded. The -f option is used to specify a capture filter. The syntax of a capture filter is defined by the pcap library; this syntax is different from the display filter syntax described below, and the filtering mechanism is limited in its abilities. ๐Ÿšง

Display filters in TShark โ€” which allow you to select which packets are to be decoded or written to a file โ€” are very powerful; more fields are filterable in TShark than in other protocol analyzers, and the syntax you can use to create your filters is richer. As TShark progresses, expect more and more protocol fields to be allowed in display filters. Display filters use the same syntax as display and color filters in Wireshark; a display filter is specified with the -Y option. ๐ŸŒˆ

Display filters can be specified when capturing or when reading from a capture file. Note that capture filters are much more efficient than display filters, and it may be more difficult for TShark to keep up with a busy network if a display filter is specified for a live capture, so you might be more likely to lose packets if youโ€™re using a display filter. ๐Ÿ˜ญ (the vibe check here is: capture filter = fast, display filter = fancy but heavier)

A capture or display filter can either be:

  1. specified with the -f or -Y option, respectively, in which case the entire filter expression must be specified as a single argument (which means that if it contains spaces, it must be quoted), or
  2. specified with command-line arguments after the option arguments, in which case all the arguments after the filter arguments are treated as a filter expression.

If the filter is specified with command-line arguments after the option arguments, itโ€™s a capture filter if a capture is being done (i.e., if no -r option was specified) and a display filter if a capture file is being read (i.e., if a -r option was specified). ๐Ÿงš

If the -w option is specified when capturing packets or reading from a capture file, TShark does not display packets on the standard output. Instead, it writes the packets to a capture file with the name specified by the -w option.

โš ๏ธ Heads up bestie: display filters are currently not supported when capturing and saving the captured packets.

If you want to write the decoded form of packets to a file, run TShark without the -w option, and redirect its standard output to the file (do not use the -w option). ๐Ÿ“

If you want the packets to be displayed to the standard output and also saved to a file:

  • specify the -P option in addition to the -w option to have the summary line displayed,
  • specify the -V option in addition to the -w option to have the details of the packet displayed, and
  • specify the -O option, with a list of protocols, to have the full details of the specified protocols and the top-level detail line for all other protocols to be displayed.

If the -P option is used together with the -V or -O option, the summary line will be displayed along with the detail lines. ๐Ÿ’ซ

When writing packets to a file, TShark, by default, writes the file in pcapng format, and writes all of the packets it sees to the output file. The -F option can be used to specify the format in which to write the file. The list of available file formats is displayed by the -F option without a value. However, for a live capture, you can only specify a file format supported by dumpcap(1), viz. pcapng or pcap. The --compress option can be used to specify a compression method as well; the list of supported compression methods for writing can be displayed by the --compress method without an argument. If the --compress option is not given, then the desired compression method, if any, is deduced from the extension of the filename given as argument to the -w option. ๐ŸŽ

When capturing packets, TShark writes to the standard error an initial line listing the interfaces from which packets are being captured and, if packet information isnโ€™t being displayed to the terminal, writes a continuous count of packets captured to the standard output. ๐Ÿ‘€

  • If the -q option is specified, neither the continuous count nor the packet information will be displayed; instead, at the end of the capture, a count of packets captured will be displayed.
  • If the -Q option is specified, neither the initial line, nor the packet information, nor any packet counts will be displayed.
  • If the -q or -Q option is used, the -P, -V, or -O option can be used to cause the corresponding output to be displayed even though other output is suppressed.

When reading packets, the -q and -Q option will suppress the display of the packet summary or details; this would be used if -z options are specified in order to display statistics, so that only the statistics โ€” not the packet information โ€” is displayed. ๐Ÿ“Š

The -G option is a special mode that simply causes TShark to dump one of several types of internal glossaries and then exit. main character energy, honestly. ๐Ÿ‘‘


โœจ OPTIONS โœจ

๐Ÿฆ‹ -2

Perform a two-pass analysis. This causes TShark to buffer output until the entire first pass is done, but allows it to fill in fields that require future knowledge, such as 'response in frame #' fields. Also permits reassembly frame dependencies to be calculated correctly. ๐Ÿง โœจ

โš ๏ธ This requires the ability to seek backwards on the input, and as such cannot be used with live captures or when reading from a pipe or FIFO. (no, not even if you ask nicely ๐Ÿ˜ญ)

๐ŸŽ€ -a | --autostop <capture autostop condition>

Specify a criterion that says when TShark is to stop writing to a capture file. The criterion is of the form test:value, where test is one of: ๐Ÿ’…

  • duration:value โ€” Stop writing to a capture file after value seconds have elapsed. Floating point values (e.g. 0.5) are allowed. โฑ๏ธ
  • files:value โ€” Stop writing to capture files after value number of files were written. ๐Ÿ—‚๏ธ
  • filesize:value โ€” Stop writing to a capture file after it reaches a size of value kB. If this option is used together with the -b option, TShark will stop writing to the current capture file and switch to the next one if filesize is reached. When reading a capture file, TShark will stop reading the file after the number of bytes read exceeds this number (the complete packet will be read, so more bytes than this number may be read). Note that the filesize is limited to a maximum value of 2 TB, although you might have problems before then if the number of packets exceeds exceeds 232 (4294967296). ๐Ÿ’€๐Ÿ”ฅ
  • packets:value โ€” switch to the next file after it contains value packets. This does not include any packets that do not pass the display filter, so it may differ from -c<capture packet count>. ๐Ÿงฎ

๐Ÿ” -A <user>:<password>

Specify a user and a password when TShark captures from a rpcap:// interface where authentication is required. ๐Ÿ•ต๏ธโ€โ™€๏ธ

This option is available with libpcap with enabled remote support. ๐Ÿซถ


๐ŸŒธ -b | --ring-buffer <capture ring buffer option>

Cause TShark to run in "multiple files" mode. In "multiple files" mode, TShark will write to several capture files. When the first capture file fills up, TShark will switch writing to the next file and so on. ๐Ÿ”

The created filenames are based on the filename given with the -w option, the number of the file and on the creation date and time, e.g. outfile_00001_20260714120117.pcap, outfile_00002_20260714120523.pcap, ... ๐Ÿ—“๏ธโœจ

With the files option itโ€™s also possible to form a "ring buffer". This will fill up new files until the number of files specified, at which point TShark will discard the data in the first file and start writing to that file and so on. If the files option is not set, new files filled up until one of the capture stop conditions match (or until the disk is full). ๐Ÿ’พ๐Ÿ˜ฌ

The criterion is of the form key:value, where key is one of: ๐Ÿ”‘

  • duration:value โ€” bounce to the next file once value seconds have gone by, even if the current file isn't full yet. Yeah, you can use floats here (like 0.5) โ€” she's flexible. ๐Ÿ’…
  • files:value โ€” loop back around to the first file after value files have been written (that's a ring buffer, bestie, it just keeps going round ๐Ÿ”„). This number must be less than 100000. โš ๏ธ Be careful with big ol' numbers of files though โ€” some filesystems are lowkey not okay with tons of files in a single directory. Also note: the files criterion requires either duration, interval or filesize to be specified, otherwise nothing tells it when to move to the next file. And heads up: each -b parameter takes exactly one criterion โ€” want two criteria? You gotta spell out -b twice. Periodt.
  • filesize:value โ€” switch to the next file after it hits a size of value kB. Ngl the filesize is capped at a maximum of 2 TB โ€” although you might hit problems before then if the number of packets exceeds 232 (4294967296). ๐Ÿ’€
  • interval:value โ€” switch to the next file when the time is an exact multiple of value seconds. Like, use 3600 to get a fresh file every hour on the hour. Iconic behaviour, honestly. ๐Ÿ•
  • packets:value โ€” switch to the next file after it contains value packets.
  • printname:filename โ€” print the name of the most recently written file to filename after the file is closed. filename can be stdout or - for standard output, or stderr for standard error. ๐Ÿซถ
  • nametimenum:value โ€” picks between the two save filename templates. If value is 1, the running file number part goes before the start time part โ€” this is the original and the default behaviour (e.g. log_00001_20260714164426.pcap). If value is greater than 1, the start time part goes before the running number part (e.g. log_20210828164426_00001.pcap). The latter makes alphabetical sorting order equal to creation time order, and keeps related multiple file sets in the same directory nice and close to each other. โœจ

Example, because we love a demo:

tshark -b filesize:1000 -b files:5

โ€ฆresults in a ring buffer of five files of size one megabyte each. Ate. ๐Ÿ”ฅ


๐Ÿซง -B|--buffer-size <capture buffer size>

Sets the capture buffer size โ€” in MiB, default is 2 MiB. This is the thing the capture driver uses to buffer packet data until that data can actually be written to disk. If you're seeing packet drops while capturing, try bumping this size up. ๐Ÿ“ˆ

Ok but real talk: while TShark attempts to set the buffer size to 2 MiB by default, and can be told to set it to a larger value, the system or interface you're capturing on might silently limit the capture buffer size to a lower value โ€” or raise it to a higher value. Rude, but that's the vibe. ๐Ÿ™ˆ

This is available on UNIX-compatible systems โ€” like Linux, macOS, \*BSD, Solaris, and AIX โ€” with libpcap 1.0.0 or later, and on Windows. It is not available on UNIX-compatible systems with earlier versions of libpcap.

This option can occur multiple times, bestie. Used before the first occurrence of the -i option? It sets the default capture buffer size. Used after an -i option? Then it sets the capture buffer size for the interface specified by the last -i option occurring before this option. And if the capture buffer size isn't set specifically at all, the default capture buffer size is used instead. Easy. ๐Ÿ’–

๐Ÿ”ข -c <capture packet count>

Sets the maximum number of packets to read when capturing live data. And if you're reading a capture file, it sets the maximum number of packets to read. Important detail though: this includes any packets that don't pass the display filter, so it may differ from -a packets:<capture packet count>. Don't let that trip you up. ๐Ÿ˜ญ

๐Ÿ‘‘ -C <configuration profile>

Runs with the given configuration profile.

If used in conjunction with --global-profile, the specified profile will be loaded from the global configuration directory instead of the user's personal configuration directory. Typically on UN*X that's /usr/share/wireshark/profiles. On Windows, the directory is a profiles subdirectory of the directory in which Wireshark was installed, e.g. C:\Program Files\Wireshark\profiles. On macOS, when running from an app bundle, it's the Contents/Resources/share/wireshark/profiles subdirectory within the app bundle.

This option is lowkey so useful in shared environments or automated testing setups where consistent configurations are needed and user-specific settings should be avoided. ๐Ÿ”’

๐ŸŒˆ -D|--list-interfaces

Prints a list of the interfaces on which TShark can capture, and exits. For each network interface, a number and an interface name โ€” possibly followed by a text description of the interface โ€” is printed. The interface name or the number can be supplied to the -i flag to specify an interface on which to capture. The number is super handy on Windows systems, where the interfaces have long names that usually contain a GUID. ๐Ÿ’…

๐ŸŽ€ -e <field>

Adds a field to the list of fields to display if -T ek|fields|json|pdml is selected. You can use this option multiple times on the command line โ€” go off. At least one field must be provided if the -T fields option is selected.

Column types may be used, prefixed with _ws.col.. And prefixing the field name with an at sign (@) will display the data as hex bytes. ๐ŸŒธ

Example:

tshark -T fields -e frame.number -e ip.addr -e udp -e _ws.col.info

Fields are separated by tab characters by default โ€” -E controls the format of the printed fields. Giving a protocol rather than a single field will print the protocol summary (subtree label) from the packet details as a single field. And if the protocol summary contains only the protocol name (e.g. "Hypertext Transfer Protocol") then the protocol filter name ("http") will be printed. Iykyk. ๐Ÿฆ‹

๐Ÿ’œ -E <field print option>

Sets an option controlling the printing of fields when -T fields is selected.

The options are:

  • bom=y|n โ€” If y, prepend output with the UTF-8 byte order mark (hexadecimal ef, bb, bf). Defaults to n.
  • header=y|n โ€” If y, print a list of the field names given using -e as the first line of the output; the field name will be separated using the same character as the field values. Defaults to n.
  • separator=/t|/s|<character> โ€” Sets the separator character to use for fields. If /t, tab will be used (this is the default). If /s, a single space will be used. Otherwise any character that can be accepted by the command line as part of the option may be used.
  • occurrence=f|l|a โ€” Selects which occurrence to use for fields that have multiple occurrences. If f the first occurrence will be used, if l the last occurrence will be used, and if a all occurrences will be used (this is the default).
  • aggregator=,|/s|<character> โ€” Sets the aggregator character to use for fields that have multiple occurrences. If , a comma will be used (this is the default), if /s a single space will be used. Otherwise any character that can be accepted by the command line as part of the option may be used.
  • quote=d|s|n โ€” Sets the quote character to use to surround fields. d uses double-quotes, s single-quotes, n no quotes (the default). If the quote character appears in a field value, it will be escaped by being duplicated.
  • escape=y|n โ€” If y, the whitespace control characters (tab, line feed, carriage return, form feed, and vertical tab), backspace, and the backslash will be replaced in field values by C-style escapes, e.g. "\n" for line feed. If n, field value strings will be printed as-is. Defaults to y.
  • escape_formulas=y|n โ€” If y, prefix any field value that a spreadsheet application would evaluate as a formula with an apostrophe, so that packet data cannot inject a formula into a CSV file that is later opened in a spreadsheet. Values that begin with =, +, - or @ (optionally preceded by blanks) are affected. Note that this changes the exported values, and in particular that it also applies to legitimately negative numbers, so it is off by default โ€” enable it when the output is destined for a spreadsheet rather than for further machine processing. Defaults to n. ๐Ÿงš
  • split=<proto> โ€” Splits the output into one row per message instance of the protocol <proto> within a packet. This is useful when a single packet contains multiple protocol messages (e.g., several Diameter messages bundled in one SCTP packet). Fields that belong to a specific message instance are output only on that instance's row, while fields not under any instance (e.g., frame-level fields) are repeated on every row. Only applies to -T fields CSV output. By default, no splitting is performed.

๐Ÿ“ -f <capture filter>

Sets the capture filter expression.

This option can occur multiple times. If used before the first occurrence of the -i option, it sets the default capture filter expression. If used after an -i option, it sets the capture filter expression for the interface specified by the last -i option occurring before this option. If the capture filter expression is not set specifically, the default capture filter expression is used if provided.

Pre-defined capture filter names โ€” as shown in the GUI menu item Captureโ†’Capture Filters โ€” can be used by prefixing the argument with "predef:". Example:

tshark -f "predef:MyPredefinedHostOnlyFilter"

๐ŸŽฏ -F <file format>

Sets the file format of the output capture file written using the -w option. The output written with the -w option is raw packet data, not text, so there is no -F option to request text output. The option -F without a value will list the available formats. The default is the pcapng format (unless the default has been changed in preferences.). ๐Ÿ‘‘

๐Ÿงˆ -g

This option causes the output file(s) to be created with group-read permission (meaning that the output file(s) can be read by other members of the calling user's group). Sharing is caring, bestie. ๐Ÿซถ

๐Ÿ“š -G <report type>

The -G option will cause TShark to dump one of several types of glossaries and then exit. The glossary type is now mandatory โ€” previous versions generated the fields report by default when no type was given. With one exception, the reports reflect the current configuration, including that given by a -C option or as modified by other command line options. Using the report type of help lists all the current report types. ๐ŸŒŸ

The available report types include:

  • column-formats โ€” Dumps the column formats understood by TShark. There is one record per line. The fields are tab-delimited.
    • Field 1 โ€” format string (e.g. "%rD")
  • Field 2 โ€” text description of format string (e.g. "Dest port (resolved)")
    • Field 3 โ€” the field abbreviation used for the column text (e.g. "_ws.col.res_dst_port")

Right after this report there's a lil usage example showing how you change the columns by overriding the gui.column.format preference value with -o. Cute, right? ๐Ÿ’…

  • currentprefs โ€” dumps a copy of your current preferences file straight to stdout. Like a screenshot but for your config ๐Ÿซถ
  • decodes โ€” dumps the "layer type" / "decode as" associations to stdout. One record per line, fields are tab-delimited.
    • Field 1 โ€” layer type, e.g. "tcp.port"
    • Field 2 โ€” selector in the base for display
    • Field 3 โ€” the "decode as" name, e.g. "http"
  • defaultprefs โ€” dumps a default preferences file to stdout. Heads up bestie: this report is unaffected by other command line arguments ๐Ÿ™ˆ
  • dissectors โ€” dumps a list of registered dissectors to stdout. One record per line, tab-delimited.
    • Field 1 โ€” dissector name
    • Field 2 โ€” dissector description
  • dissector-tables โ€” dumps a list of dissector tables to stdout. One record per line, tab-delimited.
    • Field 1 โ€” dissector table name, e.g. "tcp.port"
    • Field 2 โ€” name used for the dissector table in the GUI
    • Field 3 โ€” type (textual representation of the ftenum type, or "heuristic")
    • Field 4 โ€” base for display (for integer types)
    • Field 5 โ€” protocol name
    • Field 6 โ€” "decode as" support (for non-heuristic tables)
  • elastic-mapping[,filter] โ€” dumps the ElasticSearch mapping file to stdout. Fields that fall in the default case (string) won't be mapped, no cap.

The filter is an optional list of comma separated protocol filter names that limits the generated mapping file to the specified protocols โ€” the whole point is to dodge a huge mapping file that can choke some software (such as Kibana) ๐Ÿ˜ญ E.g.:

tshark -G elastic-mapping,ip,udp,dns
  • enterprises โ€” dumps the IANA Private Enterprise Number (PEN) table. iconic registry behavior ๐Ÿ‘‘
  • fieldcount โ€” dumps the number of header fields to stdout. Just the count. One number. Minimalist queen โœจ
  • fields[,prefix] โ€” dumps the contents of the registration database to stdout. An independent program can take this output and format it into nice tables or HTML or whatever. One record per line. Each record is either a protocol or a header field, differentiated by the first field. Fields are tab-delimited.

Protocols

  • Field 1 โ€” 'P'
  • Field 2 โ€” descriptive protocol name
  • Field 3 โ€” protocol abbreviation

Header Fields

  • Field 1 โ€” 'F'
  • Field 2 โ€” descriptive field name
  • Field 3 โ€” field abbreviation
  • Field 4 โ€” type (textual representation of the ftenum type)
  • Field 5 โ€” parent protocol abbreviation
  • Field 6 โ€” base for display (for integer types); "parent bitfield width" for FT_BOOLEAN
  • Field 7 โ€” bitmask: format: hex: 0x....
  • Field 8 โ€” blurb describing field

You can also hand fields an optional search prefix argument, and then the output gets limited to protocols and fields whose abbreviation starts with that search prefix. Slay, filtered ๐Ÿ’…

Search Output

  • Field 1 โ€” protocol or field abbreviation
  • Field 2 โ€” descriptive protocol or field name
  • folders โ€” dumps various folders used by TShark. This is essentially the same data reported in Wireshark's About | Folders tab. One record per line, tab-delimited.
    • Field 1 โ€” Folder type (e.g "Personal configuration:")
    • Field 2 โ€” Folder location (e.g. "/home/vagrant/.config/wireshark/")
  • ftypes โ€” dumps the "ftypes" (fundamental types) understood by TShark. One record per line, tab-delimited.
    • Field 1 โ€” FTYPE (e.g "FT_IPv6")
    • Field 2 โ€” text description of type (e.g. "IPv6 address")
  • heuristic-decodes โ€” dumps the heuristic decodes currently installed. One record per line, tab-delimited.
    • Field 1 โ€” heuristic dissector table name (e.g. "tcp")
    • Field 2 โ€” name of heuristic decoder (e.g. "ucp")
    • Field 3 โ€” heuristic enabled (e.g. "T" or "F")
    • Field 4 โ€” heuristic enabled by default (e.g. "T" or "F")
    • Field 5 โ€” heuristic short name (e.g. "ucp_tcp")
    • Field 6 โ€” heuristic display name (e.g. "UCP over TCP")
  • help โ€” displays the available report types. The most self-aware option in the whole list fr fr ๐Ÿชž
  • manuf โ€” dumps the MAC address lookup table in manuf format. Vendor tea, served hot ๐Ÿ“
  • plugins โ€” dumps the plugins currently installed. One record per line, tab-delimited.
    • Field 1 โ€” plugin library/Lua script/extcap executable (e.g. "gryphon.so")
    • Field 2 โ€” plugin version (e.g. 0.0.4)
    • Field 3 โ€” plugin type ("dissector", "tap", "file type", etc.)
    • Field 4 โ€” full path to plugin file
  • profiles[,filter] โ€” dumps a list of profiles. You can list specific profile types with the "global", "personal", or "all" filters. By default, "all" are shown.
    • Field 1 โ€” Profile name
    • Field 2 โ€” Type of profile (personal, global, default)
  • protocols โ€” dumps the protocols in the registration database to stdout. An independent program can take this output and format it into nice tables or HTML or whatever. One record per line, tab-delimited.
    • Field 1 โ€” protocol name
    • Field 2 โ€” protocol short name
    • Field 3 โ€” protocol filter name
    • Field 4 โ€” protocol enabled (e.g. "T" or "F")
    • Field 5 โ€” protocol enabled by default (e.g. "T" or "F")
    • Field 6 โ€” protocol can toggle (e.g. "T" or "F")
  • services โ€” dumps the TCP, UDP, and SCTP transport service (port) table. Ports got range, periodt ๐ŸŒˆ
  • values โ€” dumps the value_strings, range_strings or true/false strings for fields that have them. One record per line, fields are tab-delimited. There are three types of records: Value String, Range String and True/False String. The first field โ€” 'V', 'R' or 'T' โ€” tells you which type of record you're looking at.

Value Strings

  • Field 1 โ€” 'V'
  • Field 2 โ€” field abbreviation to which this value string corresponds
  • Field 3 โ€” Integer value
  • Field 4 โ€” String

Range Strings

  • Field 1 โ€” 'R'
  • Field 2 โ€” field abbreviation to which this range string corresponds
  • Field 3 โ€” Integer value: lower bound
  • Field 4 โ€” Integer value: upper bound
  • Field 5 โ€” String

True/False Strings

  • Field 1 โ€” 'T'
  • Field 2 โ€” field abbreviation to which this true/false string corresponds
  • Field 3 โ€” True String
  • Field 4 โ€” False String

  • -h, --help โ€” prints the version number and options, then exits. The "hello, what is this" button ๐ŸŽ€
  • -H <input hosts file> โ€” reads a list of entries from a "hosts" file, which will then be written to a capture file. Implies -W n. Can be called multiple times. The "hosts" file format is documented at https://en.wikipedia.org/wiki/Hosts_(file).
  • -i, --interface <capture interface> | - โ€” sets the name of the network interface or pipe to use for live packet capture. ๐ŸŒธ

Network interface names should match one of the names listed in "tshark -D" (described above); a number, as reported by "tshark -D", can also be used.

If no interface is specified, TShark searches the list of interfaces, choosing the first non-loopback interface if there are any non-loopback interfaces, and choosing the first loopback interface if there are no non-loopback interfaces. If there are no interfaces at all, TShark reports an error and doesn't start the capture. No vibes to capture, I guess ๐Ÿ’€

Pipe names should be either the name of a FIFO (named pipe) or "-" to read data from the standard input. On Windows systems, pipe names must be of the form "\\.\pipe\pipename". Data read from pipes must be in standard pcapng or pcap format. Pcapng data must have the same endianness as the capturing host. Don't ask, just respect it ๐Ÿ™ˆ

This option can occur multiple times. When capturing from multiple interfaces, the capture file will be saved in pcapng format.

  • -I, --monitor-mode โ€” puts the interface in "monitor mode"; this is supported only on IEEE 802.11 Wi-Fi interfaces, and supported only on some operating systems. Niche but iconic ๐Ÿฆ‹
โš ๏ธ In monitor mode the adapter might disassociate from the network with which it's associated, so you won't be able to use any wireless networks with that adapter. This could prevent accessing files on a network server, or resolving host names or network addresses, if you're capturing in monitor mode and aren't connected to another network with another adapter. So likeโ€ฆ plan for that ๐Ÿ˜ญ

This option can occur multiple times. If used before the first occurrence of the -i option, it enables the monitor mode for all interfaces. If used after an -i option, it enables the monitor mode for the interface specified by the last -i option occurring before this option. Order matters, bestie โ€” it's giving choreography ๐Ÿ’…

  • -j <protocol match filter> โ€” protocol match filter used for ek|json|jsonraw|pdml output file types. Only the protocol's parent node is included. Child nodes are only included if explicitly specified in the filter. Strict queen behavior.

Example: tshark -T json -j "ip ip.flags http"

  • -J <protocol match filter> โ€” protocol top level filter used for ek|json|jsonraw|pdml output file types. The protocol's parent node and all child nodes are included. Lower-level protocols must be explicitly specified in the filter. Generous queen behavior ๐Ÿซถ

Example: tshark -T pdml -J "tcp http"

  • -l โ€” (okay this one's coming right up, hold that thought) ๐Ÿ’œ

okay so the -l saga continues bestie: technically it's not, strictly speaking, line-buffered if -V was specified ๐Ÿ˜ค โ€” BUT it is the same as line-buffered if -V wasn't specified, because only one line gets printed for each packet, and -l is normally used when piping a live capture to a program or script, so that the output for a packet shows up as soon as the packet is seen and dissected. Basically it works just as well as true line-buffering. We do this as a workaround for a deficiency in the Microsoft Visual C++ C library ๐Ÿซ  โ€” and it also sets --update-interval to 0 ms.

This is lowkey so useful when you're piping the output of TShark to another program, because it means the program you're piping into will see the dissected data for a packet as soon as TShark sees the packet and generates that output, rather than seeing it only when the standard output buffer containing that data fills up. โœจ iykyk.

  • -L, --list-data-link-types โ€” lists the data link types supported by the interface and then dips ๐Ÿ‘‹. The link types it reports are exactly what you can use for the -y option. ๐Ÿ’…
  • -o <preference>:<value> โ€” sets a preference value, overriding the default value and anything read from a preference file. The argument is a string shaped like prefname:value, where prefname is the name of the preference (the exact same name that would show up in the preference file) and value is the value you want it set to.
๐ŸŽ€ Note, bestie: TShark does not save preferences, so use this for temporary changes for a single execution only. To permanently set a preference, change it in the Wireshark GUI or edit the preference file directly โ€” and you can create multiple configuration profiles if you need different preference sets for different occasions. ๐ŸŒˆ
  • -O <protocols> โ€” similar to -V, but it makes TShark show a detailed view of only the comma-separated list of protocols you specified, and just the top-level detail line for all the other protocols, instead of a detailed view of everything. Use the output of tshark -G protocols to find the abbreviations of the protocols you can specify. ๐Ÿ”
  • -p, --no-promiscuous-mode โ€” does not put the interface into promiscuous mode. BUT lowkey important: the interface might be in promiscuous mode for some other reason, hence -p can't be used to guarantee that the only traffic captured is traffic sent to or from the machine TShark is running on, broadcast traffic, and multicast traffic to addresses received by that machine. ๐Ÿ™ˆ

This option can occur multiple times. If it's used before the first occurrence of the -i option, no interface will be put into promiscuous mode. If it's used after an -i option, the interface specified by the last -i option occurring before this option will not be put into promiscuous mode.

  • -P, --print โ€” decodes and displays the packet summary or details, even if you're writing raw packet data using the -w option, and even if packet output is otherwise suppressed with -Q. she said you're not silencing me ๐Ÿ”ฅ
  • -q โ€” when capturing packets, this skips the continuous count of packets captured that's normally shown when you're saving a capture to a file; instead it just displays, at the end of the capture, a count of packets captured. On systems that support the SIGINFO signal, like the various BSDs, you can make the current count show up by typing your "status" character (typically Ctrl+T, although it might be set to "disabled" by default on at least some BSDs, in which case you'd have to explicitly set it to use it). ๐Ÿ“Ÿ

When it's reading a capture file, or capturing and not saving to a file, it doesn't print packet information โ€” which is iconic if you're using a -z option to calculate statistics and you don't want the packet information printed, just the statistics. ๐Ÿ“Š

  • -Q โ€” when capturing packets, this hides, on the standard error, the initial message telling you which interfaces the capture is happening on, the continuous count of packets captured that's shown when saving a capture to a file, and the final message giving the count of packets captured. Only true errors get displayed on the standard error. ๐Ÿ’€

This outputs less than the -q option, so the interface name and total packet count and the end of a capture are not sent to stderr.

When it's reading a capture file, or capturing and not saving to a file, it doesn't print packet information โ€” again, chef's kiss if you're using a -z option to calculate statistics and you want just the statistics, not the packet info. ๐Ÿ“

  • -r, --read-file <infile> โ€” reads packet data from infile, and it can be any supported capture file format (including compressed files ๐Ÿ—œ๏ธ). You can use named pipes or stdin (-) here, but only with certain capture file formats โ€” in particular, the ones that can be read without seeking backwards.
๐Ÿ’ก Tip: reading a live capture from the standard out of another process through a pipe can circumvent restrictions that apply to TShark during live capture, such as file formats or compression. loophole slay ๐Ÿงš
  • -R, --read-filter <Read filter> โ€” makes the specified filter (which uses the syntax of read/display filters, not capture filters) get applied during the first pass of analysis. Packets that don't match the filter are not considered for future passes. Only makes sense with multiple passes โ€” see -2. For regular filtering on single-pass dissect, use -Y instead. ๐Ÿ‘‘

Heads up: forward-looking fields like 'response in frame #' cannot be used with this filter, since they won't have been calculated when this filter is applied. ๐Ÿ˜ญ

  • -s, --snapshot-length <capture snaplen> โ€” sets the default snapshot length to use when capturing live data. No more than snaplen bytes of each network packet get read into memory, or saved to disk. A value of 0 specifies a snapshot length of 262144, so that the full packet is captured โ€” and that's the default. ๐ŸŒธ

This option can occur multiple times. If it's used before the first occurrence of the -i option, it sets the default snapshot length. If it's used after an -i option, it sets the snapshot length for the interface specified by the last -i option occurring before this option. If the snapshot length isn't set specifically, the default snapshot length is used if provided.

  • -S <separator> โ€” sets the line separator to be printed between packets. ๐ŸŽ€
  • -T ek|fields|json|jsonraw|pdml|ps|psml|tabs|text โ€” sets the format of the output when viewing decoded packet data. The options are one of:
    • ek โ€” newline delimited JSON format for bulk import into Elasticsearch. It can be used with -j or -J to specify which protocols to include, or with -x to include raw hex-encoded packet data. If -P is specified it will print the packet summary only, with both -P and -V it will print the packet summary and packet details. If neither -P or -V are used it will print the packet details only. Example of usage to import data into Elasticsearch:
tshark -T ek -j "http tcp ip" -P -V -x -r file.pcap > file.json
curl -H "Content-Type: application/x-ndjson" -XPOST http://elasticsearch:9200/_bulk --data-binary "@file.json"

Elastic requires a mapping file to be loaded as template for packets-* index in order to convert Wireshark types to elastic types. This file can be auto-generated with the command tshark -G elastic-mapping. Since the mapping file can be huge, protocols can be selected by using the option --elastic-mapping-filter:

tshark -G elastic-mapping --elastic-mapping-filter ip,udp,dns

or by adding the filter directly to the -G elastic-mapping option:

tshark -G elastic-mapping,ip,udp,dns
  • fields โ€” the values of fields specified with the -e option, in a form specified by the -E option. For example,
tshark -T fields -E separator=, -E quote=d

would generate comma-separated values (CSV) output suitable for importing into your favorite spreadsheet program. ๐Ÿ“ˆ

  • json โ€” JSON file format. It can be used with -j or -J to specify which protocols to include, or with the -x option to include raw hex-encoded packet data. Example of usage:
tshark -T json -r file.pcap
tshark -T json -j "http tcp ip" -x -r file.pcap
  • jsonraw โ€” JSON file format including only raw hex-encoded packet data. It can be used with -j or -J to specify which protocols to include. Example of usage:
tshark -T jsonraw -r file.pcap
tshark -T jsonraw -j "http tcp ip" -x -r file.pcap
  • pdml โ€” Packet Details Markup Language, an XML-based format for the details of a decoded packet. This information is equivalent to the packet details printed with the -V option. Using the --color option will add color attributes to pdml output. These attributes are nonstandard. ๐ŸŒˆ
  • ps โ€” PostScript for a human-readable one-line summary of each of the packets, or a multi-line view of the details of each of the packets, depending on whether the -V option was specified.
  • psml โ€” Packet Summary Markup Language, an XML-based format for the summary information of a decoded packet. This information is equivalent to the information shown in the one-line summary printed by default. Using the --color option will add color attributes to pdml output. These attributes are nonstandard. (yes it really says pdml there too โ€” we keep it ๐Ÿ’…)
  • tabs โ€” similar to the default text report, except the human-readable one-line summary of each packet will include an ASCII horizontal tab (0x09) character as a delimiter between each column.
  • text โ€” text of a human-readable one-line summary of each of the packets, or a multi-line view of the details of each of the packets, depending on whether the -V option was specified. This is the default. โญ
  • --temp-dir <directory> โ€” specifies the directory into which temporary files (including capture files) are to be written. The default behavior on UNIX-compatible systems โ€” like Linux, macOS, *BSD, Solaris, and AIX โ€” is to use the environment variable $TMPDIR if it's set, and the system default, typically /tmp, if it isn't. On Windows, the %TEMP% environment variable is used, which typically defaults to %USERPROFILE%\AppData\Local\Temp. ๐Ÿ—‚๏ธ
  • -U <tap name> โ€” PDUs export, exports PDUs from infile to outfile according to the tap name given. Use -Y to filter. Enter an empty tap name "" or a tap name of ? to get a list of available names. ๐Ÿ”
  • -v, --version โ€” prints the full version information and dips. ๐Ÿ‘‹โœจ
  • -V โ€” makes TShark print a whole view of the packet details. yes bestie, all of them ๐Ÿ’…
  • -w outfile | - โ€” write raw packet data to outfile, or straight to standard output if outfile is -. The -F and --compress options control the file format and compression method. If --compress isn't given, the extension can be used to deduce the compression algorithm you want, if it's supported โ€” e.g. a gzip archive for .gz ๐ŸŽ€
โš ๏ธ okay this is important: -w gives you raw packet data, not text. If you want text output you gotta redirect stdout (e.g. using >), do NOT use -w for that. not me warning you twice ๐Ÿซถ
  • -W file format option โ€” saves extra info in the file, if the format supports it. for example:
tshark -F pcapng -W n

will save host name resolution records right along with the captured packets โœจ

Future versions of TShark may automatically change the capture format to pcapng as needed (so like, don't be surprised if that happens).

The argument is a string that may contain the following letter:

  • n โ€” write network address resolution information (pcapng only)
  • -x โ€” makes TShark print a hex and ASCII dump of the packet data after printing the summary and/or details, if either of those are also being displayed ๐Ÿ”ฅ
  • --hexdump hexoption โ€” makes TShark print a hex and ASCII dump of the packet data, but with choices: which data sources to dump, how to format or exclude the ASCII dump text, and whether to print the frame timestamp as a preamble. main character energy honestly ๐Ÿ‘‘

This option (and -x) can occur multiple times on the command line, and the hex dump will only be printed once. If options conflict, the last options given win. The possible hexoption values are:

  • all โ€” enable hexdump and generate hexdump blocks for all data sources associated with each frame. Used to negate earlier use of --hexdump frames. The -x option displays all data sources by default.
  • frames โ€” enable hexdump but generate hexdump blocks only for the frame data. Use this to exclude from hexdump output any hexdump blocks for secondary data sources such as 'Bitstring tvb', 'Reassembled TCP', 'De-chunked entity body', etc.
  • ascii โ€” enable hexdump, with undelimited ASCII dump text. Used to negate earlier use of --hexdump delimit or --hexdump noascii. The -x option displays undelimited ASCII dump text by default.
  • delimit โ€” enable hexdump with the ASCII dump text delimited with '|' characters. this is genuinely so useful for unambiguously determining the last of the hex byte text and the start of the ASCII dump text ๐Ÿฆ‹
  • noascii โ€” enable hexdump without printing any ASCII dump text.
  • time โ€” enable hexdump and print each frame timestamp as preamble. The -t option can be used to change the timestamp format.
  • notime โ€” enable hexdump without printing each frame timestamp as preamble.
  • help โ€” display --hexdump specific help then exit.

The use of --hexdump hexoption is particularly useful to generate output that can be used to create a pcap or pcapng file from a capture file type such as Microsoft NetMon 2.x, which TShark and Wireshark can read but can not directly do a "Save as" nor export packets from. iykyk ๐Ÿ˜ญ

Examples:

Generate hexdump output, with only the frame data source, with delimited ASCII dump text, and with each frame hex block preceded by a human readable timestamp in the local time zone that is directly usable by the text2pcap utility:

tshark ... --hexdump frames --hexdump delimit --hexdump time -t ad \
    | text2pcap -t 'ISO' - MYNEWPCAPNG

Generate hexdump output, with only the frame data source, with the default ASCII dump text with no delimiter, and with each frame hex block preceded by a human readable timestamp in UTC that is directly usable by the text2pcap utility with the -a option:

tshark ... --hexdump frames --hexdump time -t ud \
    | text2pcap -a -t 'ISO' - MYNEWPCAPNG

Generate hexdump output, with only the frame data source, with no ASCII dump text, and with each frame hex block preceded by an epoch timestamp that is directly usable by the text2pcap utility:

tshark ... --hexdump frames --hexdump noascii --hexdump time -t e \
    | text2pcap -t %s.%f - MYNEWPCAPNG

  • -X eXtension options โ€” specify an option to be passed to a TShark module. The eXtension option is in the form extension_key:value, where extension_key can be:
    • lua_script:lua_script_filename โ€” tells TShark to load the given script in addition to the default Lua scripts.
    • lua_scriptnum:argument โ€” tells TShark to pass the given argument to the lua script identified by 'num', which is the number indexed order of the 'lua_script' command. For example, if only one script was loaded with -X lua_script:my.lua, then -X lua_script1:foo will pass the string 'foo' to the 'my.lua' script. If two scripts were loaded, such as -X lua_script:my.lua and -X lua_script:other.lua in that order, then a -X lua_script2:bar would pass the string 'bar' to the second lua script, namely 'other.lua'. bestie that numbering is doing a lot of heavy lifting ngl ๐Ÿงš
    • read_format:file_format โ€” tells TShark to use the given file format to read in the file (the file given in the -r command option). Providing no file_format argument, or an invalid one, will produce a list of available file formats to use. For example,
tshark -r rtcp_broken.pcapng -X read_format:"MIME Files Format" -V

will display the internal file structure and allow access to the file-pcapng fields โœจ

  • -y|--linktype capture link type โ€” set the data link type to use while capturing packets. The values reported by -L are the values that can be used. slay, -L feeding -y, we love a self-sufficient ecosystem ๐Ÿ’–

This option can occur multiple times. If used before the first occurrence of the -i option, it sets the default capture link type. If used after an -i option, it sets the capture link type for the interface specified by the last -i option occurring before this option. If the capture link type is not set specifically, the default capture link type is used if provided.

  • -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. kinda ruthless but okay ๐Ÿ‘‘

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.

  • -M auto session reset โ€” automatically reset internal session when it reaches the specified number of packets. For example,
tshark -M 100000

will reset session every 100000 packets.

โš ๏ธ heads up: this feature does not support -2 two-pass analysis. โœ‹

๐ŸŒธ -z statistics ๐ŸŒธ

Get TShark to collect various types of statistics and display the result after finishing reading the capture file. Use the -q option if you're reading a capture file and only want the statistics printed, not any per-packet information. ๐Ÿ’…

Statistics are calculated independently of the normal per-packet output, unaffected by the main display filter. However, most have their own optional filter parameter, and only packets that match that filter (and any capture filter or read filter) will be used in the calculations. so like, separate little math bubble, no cap ๐Ÿซง

โš ๏ธ note that the -z proto option is different โ€” it doesn't cause statistics to be gathered and printed when the capture is complete, it modifies the regular packet summary output to include the values of fields specified with the option. Therefore you must not use the -q option, as that would suppress the printing of the regular packet summary output, and must also not use the -V option, as that would cause packet detail information rather than packet summary information to be printed. yes queen, conflicting flags, we've all been there ๐Ÿ˜ญ

Some of the currently implemented statistics are:

  • -z help โ€” display all possible values for -z. the "help me help you" of flags ๐ŸŽ€
  • -z afp,srt[,filter] โ€” show Apple Filing Protocol service response time statistics.
  • -z ancp,tree[,filter] โ€” calculate statistics on Access Node Control Protocol message types and adjacency packet codes.
  • -z ansi_a,bsmap[,filter] โ€” count the number of ANSI A-I/F BSMAP messages of each type.
  • -z ansi_a,dtap[,filter] โ€” count the number of ANSI A-I/F DTAP messages of each type.
  • -z ansi_map[,filter] โ€” count the number of ANSI MAP messages of each type, and calculate the total number of bytes and average bytes of each message type.
  • -z asap,stat[,filter] โ€” calculate statistics on Aggregate Service Access Protocol (ASAP). For each ASAP message type, displays the number, rate, and share among all ASAP message types of both packets and bytes, and the first and last time that it is seen. numbers AND time ranges, we love a thorough queen โญ
  • -z bacapp_instanceid,tree[,filter] โ€” calculate statistics on BACnet APDUs, collated by instance ID. Displayed information includes source and destination address and service type.
  • -z bacapp_ip,tree[,filter] โ€” calculate statistics on BACnet APDUs, collated by source and destination address. Displayed information includes service type, object ID, and instance ID.
  • -z bacapp_objectid,tree[,filter] โ€” calculate statistics on BACnet APDUs, collated by object ID. Displayed information includes source and destination address, service type, and instance ID.
  • -z bacapp_service,tree[,filter] โ€” calculate statistics on BACnet APDUs, collated by service type. Displayed information includes source and destination address, object ID, and instance ID.
  • -z calcappprotocol,stat[,filter] โ€” calculate statistics on the Calculation Application Protocol of Reliable Server Pooling. For each message type, displays the number, rate, and share among all message types of both packets and bytes, and the first and last time that it is seen.
  • -z camel,counter[,filter] โ€” count the number of CAMEL messages for each opcode.
  • -z camel,srt[,filter] โ€” collects request/response SRT (Service Response Time) data for CAMEL โœจ what you get back is the number of request messages with their matching responses for each CAMEL message type, plus the minimum, maximum, and average response time. Math AND vibes ๐Ÿ’…
  • -z collectd,tree[,filter] โ€” crunches stats for collectd ๐Ÿ“ it gathers the number of collectd packets and the total number of value segments, along with the host, plugin, and type of the values. Very structured, very demure.
  • -z componentstatusprotocol,stat[,filter] โ€” stats on the Calculation Status Protocol of Reliable Server Pooling ๐Ÿ‘‘ for each message type it shows the number, rate, and share among all message types of both packets and bytes, plus the first and last time that message type is seen. Timestamps and everything, obsessed.
  • -z conv,type[,filter] โ€” builds a table listing every conversation it could find in the capture ๐ŸŽ€ type is the conversation endpoint type you want stats for, and bestie the supported ones right now are:
    • "bluetooth" โ€” Bluetooth addresses
    • "bpv7" โ€” Bundle Protocol Version 7 addresses
    • "dccp" โ€” DCCP/IP socket pairs, both IPv4 and IPv6 are supported
    • "dnp3" โ€” DNP3 addresses
    • "eth" โ€” Ethernet addresses
    • "fc" โ€” Fibre Channel addresses
    • "fddi" โ€” FDDI addresses
    • "ip" โ€” IPv4 addresses
    • "ipv6" โ€” IPv6 addresses
    • "ipx" โ€” IPX addresses
    • "jxta" โ€” JXTA message addresses
    • "ltp" โ€” LTP addresses
    • "mptcp" โ€” Multipath TCP connections
    • "ncp" โ€” NCP connections
    • "openSAFETY" โ€” openSAFETY addresses
    • "rsvp" โ€” RSVP connections
    • "sctp" โ€” SCTP/IP socket pairs, both IPv4 and IPv6 are supported
    • "sll" โ€” Linux "cooked mode" capture addresses
    • "tcp" โ€” TCP/IP socket pairs, both IPv4 and IPv6 are supported
    • "tr" โ€” Token Ring addresses
    • "udp" โ€” UDP/IP socket pairs, both IPv4 and IPv6 are supported
    • "usb" โ€” USB addresses
    • "wlan" โ€” IEEE 802.11 addresses
    • "wpan" โ€” IEEE 802.15.4 addresses
    • "zbee_nwk" โ€” ZigBee Network Layer addresses

The table gives you one line per conversation, showing the number of frames/bytes in each direction, the total number of frames/bytes, relative start time, and duration ๐ŸŒธ and it's sorted according to the total number of frames, so the chattiest convos are right up top. Main character energy only โœจ

  • -z credentials โ€” scoops up credentials (username/passwords) straight out of packets ๐Ÿ•ต๏ธโ€โ™€๏ธ the report includes the packet number, the protocol that had that credential, the username, and the password. For protocols that only use one single field as authentication, that field shows up as the password and a placeholder sits where the user would be. Right now the implemented protocols include FTP, HTTP, IMAP, POP, and SMTP. (Bestie, maybe don't do this on a network you don't own ๐Ÿ˜ญ)
  • -z dcerpc,srt,uuid,major.minor[,filter] โ€” collects call/reply SRT (Service Response Time) data for the DCERPC interface uuid, version major.minor ๐Ÿ’œ what you get is the number of calls for each procedure, MinSRT, MaxSRT and AvgSRT.

Example โ€” this one collects data for the CIFS SAMR Interface:

-z dcerpc,srt,12345778-1234-abcd-ef00-0123456789ac,1.0

This option can be used multiple times on the command line ๐Ÿ‘‘

Example โ€” collects SAMR SRT statistics for a specific host:

-z dcerpc,srt,12345778-1234-abcd-ef00-0123456789ac,1.0,ip.addr==1.2.3.4
  • -z dests,tree[,filter] โ€” stats on IPv4 destination addresses, plus the protocols and ports that show up on each address ๐Ÿฆ‹ it's giving "who's getting all the traffic".
  • -z dhcp,stat[,filter] โ€” shows DHCP (BOOTP) statistics ๐ŸŒˆ short and sweet.
  • -z diameter,avp[,cmd.code,field,field,...] โ€” this one lets you pull the most important diameter fields out of huge capture files ๐Ÿ”ฅ exactly one text line gets printed for each diameter message that matches diameter.cmd.code.

You can specify an empty diameter command code, or '*', to match any diameter.cmd.code.

Example โ€” extract the default field set from diameter messages:

-z diameter,avp

Example โ€” extract the default field set from diameter DWR messages:

-z diameter,avp,280

Example โ€” extract the default field set from diameter CC messages:

-z diameter,avp,272

Extract the most important fields from diameter CC messages:

tshark -r file.cap.gz -q -z diameter,avp,272,CC-Request-Type,CC-Request-Number,Session-Id,Subscription-Id-Data,Rating-Group,Result-Code

These are the fields that get printed out for each diameter message:

  • "frame" โ€” Frame number.
  • "time" โ€” Unix time of the frame arrival.
  • "src" โ€” Source address.
  • "srcport" โ€” Source port.
  • "dst" โ€” Destination address.
  • "dstport" โ€” Destination port.
  • "proto" โ€” Constant string 'diameter', which you can use for post processing of tshark output. E.g. grep/sed/awk.
  • "msgnr" โ€” seq. number of the diameter message within the frame. E.g. '2' for the third diameter message in the same frame.
  • "is_request" โ€” '0' if the message is a request, '1' if the message is an answer.
  • "cmd" โ€” diameter.cmd_code, E.g. '272' for credit control messages.
  • "req_frame" โ€” number of the frame where the matched request was found, or '0'.
  • "ans_frame" โ€” number of the frame where the matched answer was found, or '0'.
  • "resp_time" โ€” response time in seconds, '0' in case the matched Request/Answer isn't found in the trace. E.g. at the begin or end of the capture.

Lowkey a flex: the -z diameter,avp option is much faster than the -V -T text or -T pdml options ๐Ÿ’จ

And it's more powerful than the -T field and -z proto,colinfo options ๐Ÿ‘‘

Multiple diameter messages in one frame are supported ๐Ÿ™Œ

Several fields with the same name within one diameter message are supported too, e.g. diameter.Subscription-Id-Data or diameter.Rating-Group.

Note: the tshark -q option is recommended to suppress default TShark output ๐Ÿ’–
  • -z diameter,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for Diameter โญ you get the number of request and response pairs of each Diameter command code, Minimum SRT, Maximum SRT, Average SRT, and Sum SRT. Currently no statistics are gathered on unpaired messages โ€” they're just out there, alone ๐Ÿ˜ญ
  • -z dis,streams โ€” collects statistics for all DIS radio streams discovered by the dis tap ๐ŸŽ€ the output includes start and end times, endpoints, radio and entity IDs, signal and transmitter packet counts, estimated lost packets, and jitter metrics derived from DIS transmitter timestamps. That's a LOT of info and honestly? Slay.
  • -z dns,tree[,filter] โ€” a lil summary of the captured DNS packets ๐Ÿฆ‹ general info gets collected, like the qtype and qclass distribution. For some data (like qname length or DNS payload) the max, min, and average values are displayed too.
  • -z endpoints,type[,filter] โ€” builds a table listing every endpoint it could spot in the capture โœจ type is the endpoint type you want stats for, and the supported ones right now are:
    • "bluetooth" โ€” Bluetooth addresses
    • "bpv7" โ€” Bundle Protocol Version 7 addresses
    • "dccp" โ€” DCCP/IP socket pairs, both IPv4 and IPv6 are supported
    • "dnp3" โ€” DNP3 addresses
    • "eth" โ€” Ethernet addresses
    • "fc" โ€” Fibre Channel addresses
    • "fddi" โ€” FDDI addresses
    • "ip" โ€” IPv4 addresses
    • "ipv6" โ€” IPv6 addresses
    • "ipx" โ€” IPX addresses
    • "jxta" โ€” JXTA message addresses
    • "ltp" โ€” LTP addresses
    • "mptcp" โ€” Multipath TCP connections
    • "ncp" โ€” NCP connections
    • "openSAFETY" โ€” openSAFETY addresses
    • "rsvp" โ€” RSVP connections
    • "sctp" โ€” SCTP/IP socket pairs, both IPv4 and IPv6 are supported
    • "sll" โ€” Linux "cooked mode" capture addresses
    • "tcp" โ€” TCP/IP socket pairs, both IPv4 and IPv6 are supported
    • "tr" โ€” Token Ring addresses
    • "udp" โ€” UDP/IP socket pairs, both IPv4 and IPv6 are supported
    • "usb" โ€” USB addresses
    • "wlan" โ€” IEEE 802.11 addresses
    • "wpan" โ€” IEEE 802.15.4 addresses
    • "zbee_nwk" โ€” ZigBee Network Layer addresses

The table gives you one line per endpoint, showing the total number of packets/bytes and the number of packets/bytes in each direction ๐Ÿ’œ and it's sorted according to the total number of packets.

  • -z enrp,stat[,filter] โ€” stats on the Endpoint Handlespace Redundancy Protocol (ENRP) ๐ŸŒธ for each message type it shows the number, rate, and share among all message types of both packets and bytes, plus the first and last time that it's seen.
  • -z expert[,error|,warn|,note|,chat|,comment][,filter] โ€” collects info about all the expert info and displays it in order, grouped by severity ๐ŸŽ€

Example โ€” shows expert items of all severity for frames that match the sip protocol:

-z expert,sip

This option can be used multiple times on the command line ๐Ÿ‘‘

Example โ€” only collects expert items for frames that include the tcp protocol, with a severity of note or higher:

-z "expert,note,tcp"
  • -z f1ap,tree[,filter] โ€” calculates the distribution of F1AP packets, grouped by packet types ๐Ÿฆ‹
  • -z f5_tmm_dist,tree[,filter] โ€” calculates the F5 Ethernet trailer Traffic Management Microkernel distribution ๐Ÿ”ฅ what you see is the number of packets and bytes, grouped by the TMM slot and number, whether packets are ingress or egress, and whether there's a flow ID and virtual server name, a flow ID without a virtual server name, or no flow ID at all โ€” plus the total for all packets with F5 trailers.
  • -z f5_virt_dist,tree[,filter] โ€” calculates the F5 Ethernet trailer Virtual Server distribution โญ shows the number of packets and bytes, grouped by the virtual server name if it exists, or by whether there's a flow ID or not if there's no virtual server name, as well as totals for all packets with F5 trailers.
  • -z fc,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for GTP ๐Ÿ’€ what you get is the number of request/response pairs, minimum SRT, maximum SRT, average SRT, and sum SRT for each value of the Type field (next protocol). No statistics are gathered on unpaired messages.
  • -z flow,name,mode[,filter] โ€” displays the flow of data between two nodes ๐ŸŒˆ the output is the same as the ASCII format saved from the GUI.
  • name โ€” the flow name, bestie. It's gotta be one of:
    • any โ€” all frames, the whole buffet
    • icmp โ€” ICMP
    • icmpv6 โ€” ICMPv6
    • lbm_uim โ€” UIM
    • tcp โ€” TCP
  • mode โ€” the address type, pick one:
    • standard โ€” any address, we're not picky
    • network โ€” network address

Example: -z flow,tcp,network will show data flow for all TCP frames


  • -z follow,prot,mode,filter[,range] โ€” shows you the contents of a stream between two nodes ๐Ÿ’… and listen, the data sent by the second node gets prefixed with a tab so you can tell the two apart. Iconic little detail.

prot is the transport protocol. Pick one:

  • tcp โ€” TCP
  • udp โ€” UDP
  • dccp โ€” DCCP
  • tls โ€” TLS or SSL
  • dtls โ€” DTLS
  • http โ€” HTTP streams
  • http2 โ€” HTTP/2 streams
  • quic โ€” QUIC streams
  • mp2t โ€” MPEG-2 TS PIDs
  • mpeg-pes โ€” MPEG-2 Packetized Element Stream
Note bestie ๐Ÿซถ โ€” even though the usage help presents sip as an option, the proper stream filters are not implemented, so SIP calls cannot be followed in TShark. Only in Wireshark. Don't get got.

mode is the output mode:

  • ascii โ€” ASCII output with dots for non-printable characters
  • carray โ€” C arrays of chars
  • ebcdic โ€” EBCDIC output with dots for non-printable characters
  • hex โ€” hexadecimal and ASCII data with offsets
  • raw โ€” hexadecimal data
  • utf-8 โ€” UTF-8 output with REPLACEMENT CHARACTERs for invalid sequences
  • yaml โ€” YAML format

Okay so since the output in ascii, ebcdic, or utf-8 mode may contain newlines, each section of output is preceded by its length in bytes plus a newline. (And note โ€” for utf-8 this is not UTF-8 characters, and may be different than the length as transmitted, because of the substitution of replacement characters for invalid sequences. Literally so important.)

filter specifies the stream to be displayed. Three formats, choose your fighter:

ip-addr0:port0,ip-addr1:port1
stream-index
stream-index,substream-index

The first format specifies IP addresses and TCP, UDP, or DCCP port pairs. (TCP ports are used for TLS, HTTP, and HTTP2; UDP ports are used for DTLS, QUIC, MP2T, and MPEG-PS.) Heads up though โ€” this format will include all streams multiplexed on the same address and port 5-tuple for transports with substreams such as HTTP/2, QUIC, and MP2T. And on top of that, for QUIC this format will include all connections sharing the same 5-tuple, and will not follow connection migration. ๐Ÿ˜ญ

The second format specifies stream indices, and is used for TCP, UDP, DCCP, TLS, DTLS, and HTTP. (HTTP uses TCP stream indices.)

The third format โ€” streams and substreams โ€” is used for HTTP/2, QUIC, MP2T, and MPEG-PES, because of their use of multiplexing. (TCP stream and HTTP/2 stream indices for HTTP/2, QUIC connection number and stream ID for QUIC, MP2T stream and PID for MP2T and MPEG-PS.)

range optionally specifies which "chunks" of the stream should be displayed.

Example: -z "follow,tcp,hex,1" will display the contents of the second TCP stream (the first is stream 0) in "hex" format.

===================================================================
Follow: tcp,hex
Filter: tcp.stream eq 1
Node 0: 200.57.7.197:32891
Node 1: 200.57.7.198:2906
00000000  00 00 00 22 00 00 00 07  00 0a 85 02 07 e9 00 02  ...".... ........
00000010  07 e9 06 0f 00 0d 00 04  00 00 00 01 00 03 00 06  ........ ........
00000020  1f 00 06 04 00 00                                 ......
00000000  00 01 00 00                                       ....
00000026  00 02 00 00

Example: -z "follow,tcp,ascii,200.57.7.197:32891,200.57.7.198:2906" will display the contents of a TCP stream between 200.57.7.197 port 32891 and 200.57.7.98 port 2906.

===================================================================
Follow: tcp,ascii
Filter: (omitted for readability)
Node 0: 200.57.7.197:32891
Node 1: 200.57.7.198:2906
38
...".....
................
4
....

Example: -z "follow,http2,hex,0,1" will display the contents of a HTTP/2 stream on the first TCP session (index 0) with HTTP/2 Stream ID 1.

===================================================================
Follow: http2,hex
Filter: tcp.stream eq 0 and http2.streamid eq 1
Node 0: 172.16.5.1:49178
Node 1: 172.16.5.10:8443
00000000  00 00 2c 01 05 00 00 00  01 82 04 8b 63 c1 ac 2a  ..,..... ....c..*
00000010  27 1d 9d 57 ae a9 bf 87  41 8c 0b a2 5c 2e 2e da  '..W.... A...\...
00000020  e1 05 c7 9a 69 9f 7a 88  25 b6 50 c3 ab b6 25 c3  ....i.z. %.P...%.
00000030  53 03 2a 2f 2a                                    S.*/*
    00000000  00 00 22 01 04 00 00 00  01 88 5f 87 35 23 98 ac  .."..... .._.5#..
    00000010  57 54 df 61 96 c3 61 be  94 03 8a 61 2c 6a 08 2f  WT.a..a. ...a,j./
    00000020  34 a0 5b b8 21 5c 0b ea  62 d1 bf                 4.[.!\.. b..
    0000002B  00 40 00 00 00 00 00 00  01 89 50 4e 47 0d 0a 1a  .@...... ..PNG...

  • -z fractalgeneratorprotocol,stat[,filter] โ€” calculates statistics on the Fractal Generator Protocol of Reliable Server Pooling. For each message type it displays the number, rate and share among all message types of both packets and bytes, plus the first and last time that it is seen. So thorough of it โœจ
  • -z gsm_a โ€” counts the number of GSM A-I/F messages of each type within these categories: BSSMAP, DTAP Mobility Management, DTAP Radio Resource Management, DTAP Call Control, DTAP GPRS Mobility Management, DTAP SMS messages, DTAP GPRS Session Management, DTAP Supplementary Services, DTAP Special Conformance Testing Functions, and SACCH Radio Resource Management.

And here's the difference โ€” unlike the individual statistics for each category that follow, this one only prints a line for each message type that appears, instead of including lines for message types with a count of zero. Clean. No filler. ๐Ÿ’…

  • -z gsm_a,category[,filter] โ€” counts the number of messages of each type in GSM A-I/F category, which can be one of:
    • bssmap โ€” BSSMAP
    • dtap_cc โ€” DTAP Call Control
    • dtap_gmm โ€” DTAP GPRS Mobility Management
    • dtap_mm โ€” DTAP Mobility Management
    • dtap_rr โ€” DTAP Radio Resource Management
    • dtap_sacch โ€” SACCH Radio Resource Management
    • dtap_sm โ€” DTAP GPRS Session Management
    • dtap_sms โ€” DTAP Short Message Service
    • dtap_ss โ€” DTAP Supplementary Services
    • dtap_tp โ€” DTAP Special Conformance Testing Functions
  • -z gsm_map,operation[,filter] โ€” calculates statistics on GSM MAP. For each op code, the total number of invokes and results, along with the average and total bytes for invokes and results separately and combined, is displayed. Numbers everywhere, we love to see it ๐Ÿ“Š
  • -z gtp,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for GTP. What you get: the number of calls, minimum SRT, maximum SRT, average SRT, and sum SRT for certain commands. Currently no statistics are gathered on unpaired messages, just so you know. ๐Ÿ™ˆ
  • -z gtpv2,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for GTP. What you get: the number of calls, minimum SRT, maximum SRT, average SRT, and sum SRT for certain commands. Currently no statistics are gathered on unpaired messages. Yes bestie, it's the same deal as above โ€” that's just how it is.
  • -z h225,counter[,filter] โ€” counts ITU-T H.225 messages and their reasons. First column? A list of H.225 messages and H.225 message reasons that occur in the current capture file. Second column? The number of occurrences of each message or reason. Two columns of pure information ๐Ÿ‘‘

Example: -z h225,counter.

Example: use -z "h225,counter,ip.addr==1.2.3.4" to only collect stats for H.225 packets exchanged by the host at IP address 1.2.3.4 .

This option can be used multiple times on the command line. Stack 'em. ๐Ÿ”ฅ

  • -z h225_ras,rtd[,filter] โ€” collects requests/response RTD (Response Time Delay) data for ITU-T H.225 RAS. What's collected: number of calls of each ITU-T H.225 RAS Message Type, Minimum RTD, Maximum RTD, Average RTD, Minimum in Frame, and Maximum in Frame. You'll also get the number of Open Requests (Unresponded Requests), Discarded Responses (Responses without matching request) and Duplicate Messages. So much data, we ate. ๐Ÿ“

Example: tshark -z h225_ras,rtd

This option can be used multiple times on the command line.

Example: -z "h225_ras,rtd,ip.addr==1.2.3.4" will only collect stats for ITU-T H.225 RAS packets exchanged by the host at IP address 1.2.3.4 .

  • -z hart_ip,tree[,filter] โ€” calculates statistics on HART-IP packets, grouping by message types and message IDs within types. Organized queen behavior ๐ŸŒธ
  • -z hosts[,ip][,ipv4][,ipv6] โ€” dumps any collected resolved IPv4 and/or IPv6 addresses in "hosts" format. Both IPv4 and IPv6 addresses are dumped by default. The ip argument will dump only IPv4 addresses.

Addresses are collected from a number of sources, including standard "hosts" files and captured traffic. Resolution must be enabled, e.g. through the -n option. Don't forget that part, it's lowkey the whole point ๐Ÿ˜ญ

  • -z hpfeeds,tree[,filter] โ€” calculates statistics for HPFEEDS traffic such as publish per channel, and opcode distribution.
  • -z http,stat[,filter] โ€” counts the HTTP response status codes and the HTTP request methods.
  • -z http,tree[,filter] โ€” calculates the HTTP packet distribution. The displayed values are the response status codes and request methods.
  • -z http_req,tree[,filter] โ€” calculates the HTTP requests by server. Displayed values are the server name and the URI path.
  • -z http_seq,tree[,filter] โ€” calculates the HTTP request sequence statistics, which correlate referring URIs with request URIs.
  • -z http_srv,tree[,filter] โ€” calculates the HTTP requests and responses by server. For the HTTP requests, displayed values are the server IP address and server hostname. For the HTTP responses, displayed values are the server IP address and status. Both sides, we're thorough like that ๐Ÿ’œ
  • -z http2,tree[,filter] โ€” calculates the HTTP/2 packet distribution. Displayed values are the frame types.
  • -z icmp,srt[,filter] โ€” computes total ICMP echo requests, replies, loss, and percent loss, plus minimum, maximum, mean, median and sample standard deviation SRT statistics โ€” you know, the typical stuff ping gives you. It's giving nostalgia honestly ๐Ÿฆ‹

Okay bestie, we're still in OPTIONS and we're deep in -z territory โ€” this is where tshark turns into a whole stats girlie ๐Ÿ’…

For example: -z icmp,srt,ip.src==1.2.3.4 will collect ICMP SRT statistics for ICMP echo request packets originating from a specific host.

You can drop this option multiple times on the command line, no cap.

  • -z icmpv6,srt[,filter] โ€” computes total ICMPv6 echo requests, replies, loss, and percent loss, plus the minimum, maximum, mean, median and sample standard deviation SRT statistics โ€” basically the whole ping-style glow-up โœจ

For example, -z icmpv6,srt,ipv6.src==fe80::1 will collect ICMPv6 SRT statistics for ICMPv6 echo request packets originating from a specific host.

This option can be used multiple times on the command line.

  • -z io,phs[,filter] โ€” builds a Protocol Hierarchy Statistics listing that shows both the number of packets and the bytes. iconic for seeing what's actually eating your capture ๐Ÿ“

This option can be used multiple times on the command line.

  • -z io,stat,interval[,filter][,filter][,filter]... โ€” collects packet/bytes statistics for the capture in intervals of interval seconds. The interval can be a whole or fractional second and can be specified with microsecond (us) resolution. If interval is 0, the statistics get calculated over all packets. (yes, all of them. main character behaviour ๐Ÿ’€)

If one or more filters are specified, statistics will be calculated for all filters and presented with one column of statistics for each filter.

This option can be used multiple times on the command line.

For example, -z io,stat,1,ip.addr==1.2.3.4 will generate 1 second statistics for all traffic to/from host 1.2.3.4.

For example, -z "io,stat,0.001,smb&&ip.addr==1.2.3.4" will generate 1ms statistics for all SMB packets to/from host 1.2.3.4.

The examples above all use the standard syntax for generating statistics, which only calculates the number of packets and bytes in each interval. cute but basic ๐ŸŽ€

io,stat can also do so much more โ€” it calculates COUNT(), SUM(), MIN(), MAX(), AVG() and LOAD() using a slightly different filter syntax:

-z io,stat,interval,"COUNT|SUM|MIN|MAX|AVG|LOAD(field)filter"
Note ๐Ÿ’ก One important thing to note here is that the filter is not optional, and that the field the calculation is based on MUST be part of the filter string or the calculation will fail. like it will simply not eat.

So: -z io,stat,0.010,AVG(smb.time) does not work. Use -z io,stat,0.010,AVG(smb.time)smb.time instead. Also be aware that a field can exist multiple times inside the same packet and will then be counted multiple times in those packets. lowkey important ๐Ÿ‘€

Note ๐Ÿ’ก A second important thing to note is that the system setting for decimal separator must be set to "."! If it is set to "," the statistics will not be displayed per filter. don't ask, just set it ๐ŸŒธ

COUNT โ€” calculates the number of times that the field name (not its value) appears per interval in the filtered packet list. field can be any display filter name.

Example: -z io,stat,0.010,"COUNT(smb.sid)smb.sid"

This will count the total number of SIDs seen in each 10ms interval. slay ๐Ÿ”ฅ

SUM โ€” unlike COUNT, the values of the specified field are summed per time interval. field can only be a named integer, float, double or relative time field.

Example: tshark -z io,stat,0.010,"SUM(frame.len)frame.len"

Reports the total number of bytes that were transmitted bidirectionally in all the packets within a 10 millisecond interval.

MIN/MAX/AVG โ€” the minimum, maximum, or average field value in each interval is calculated. The specified field must be a named integer, float, double or relative time field. For relative time fields, the output is presented in seconds with six decimal digits of precision rounded to the nearest microsecond. precision queen ๐Ÿ’…

In the following example, the time of the first Read_AndX call and the last Read_AndX response values are displayed, and the minimum, maximum, and average Read response times (SRTs) are calculated. NOTE: if the DOS command shell line continuation character, ^ is used, each line cannot end in a comma so it is placed at the beginning of each continuation line:

tshark -o tcp.desegment_tcp_streams:FALSE -n -q -r smb_reads.cap -z io,stat,0,
"MIN(frame.time_relative)frame.time_relative and smb.cmd==0x2e and smb.flags.response==0",
"MAX(frame.time_relative)frame.time_relative and smb.cmd==0x2e and smb.flags.response==1",
"MIN(smb.time)smb.time and smb.cmd==0x2e",
"MAX(smb.time)smb.time and smb.cmd==0x2e",
"AVG(smb.time)smb.time and smb.cmd==0x2e"

======================================================================================================
IO Statistics
Column #0: MIN(frame.time_relative)frame.time_relative and smb.cmd==0x2e and smb.flags.response==0
Column #1: MAX(frame.time_relative)frame.time_relative and smb.cmd==0x2e and smb.flags.response==1
Column #2: MIN(smb.time)smb.time and smb.cmd==0x2e
Column #3: MAX(smb.time)smb.time and smb.cmd==0x2e
Column #4: AVG(smb.time)smb.time and smb.cmd==0x2e
                |    Column #0   |    Column #1   |    Column #2   |    Column #3   |    Column #4   |
Time            |       MIN      |       MAX      |       MIN      |       MAX      |       AVG      |
000.000-                 0.000000         7.704054         0.000072         0.005539         0.000295
======================================================================================================

The following command displays the average SMB Read response PDU size, the total number of read PDU bytes, the average SMB Write request PDU size, and the total number of bytes transferred in SMB Write PDUs:

tshark -n -q -r smb_reads_writes.cap -z io,stat,0,
"AVG(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2e and smb.response_to",
"SUM(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2e and smb.response_to",
"AVG(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2f and not smb.response_to",
"SUM(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2f and not smb.response_to"

=====================================================================================
IO Statistics
Column #0: AVG(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2e and smb.response_to
Column #1: SUM(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2e and smb.response_to
Column #2: AVG(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2f and not smb.response_to
Column #3: SUM(smb.file.rw.length)smb.file.rw.length and smb.cmd==0x2f and not smb.response_to
                |    Column #0   |    Column #1   |    Column #2   |    Column #3   |
Time            |       AVG      |       SUM      |       AVG      |       SUM      |
000.000-                30018         28067522               72             3240
=====================================================================================

LOAD โ€” the LOAD/Queue-Depth in each interval is calculated. The specified field must be a relative time field that represents a response time โ€” for example smb.time. For each interval the Queue-Depth for the specified protocol is calculated.

The following command displays the average SMB LOAD. A value of 1.0 represents one I/O in flight. ๐Ÿฆ‹

tshark -n -q -r smb_reads_writes.cap
-z "io,stat,0.001,LOAD(smb.time)smb.time"

============================================================================
IO Statistics
Interval:   0.001000 secs
Column #0: LOAD(smb.time)smb.time
                        |    Column #0   |
Time                    |       LOAD     |
0000.000000-0000.001000         1.000000
0000.001000-0000.002000         0.741000
0000.002000-0000.003000         0.000000
0000.003000-0000.004000         1.000000

FRAMES | BYTES[()filter] โ€” displays the total number of frames or bytes. The filter field is optional, but if it's included it must be prepended with (). tiny detail, big consequences โœจ

The following command displays five columns: the total number of frames and bytes (transferred bidirectionally) using a single comma, the same two stats using the FRAMES and BYTES subcommands, the total number of frames containing at least one SMB Read response, and the total number of bytes transmitted to the client (unidirectionally) at IP address 10.1.0.64.

tshark -o tcp.desegment_tcp_streams:FALSE -n -q -r smb_reads.cap -z io,stat,0,,FRAMES,BYTES,
"FRAMES()smb.cmd==0x2e and smb.response_to","BYTES()ip.dst==10.1.0.64"

=======================================================================================================================
IO Statistics
Column #0:
Column #1: FRAMES
Column #2: BYTES
Column #3: FRAMES()smb.cmd==0x2e and smb.response_to
Column #4: BYTES()ip.dst==10.1.0.64
                |            Column #0            |    Column #1   |    Column #2   |    Column #3   |    Column #4   |
Time            |     Frames     |      Bytes     |     FRAMES     |     BYTES      |     FRAMES     |     BYTES      |
000.000-                33576         29721685            33576         29721685              870         29004801
=======================================================================================================================
  • -z ip_hosts,tree[,filter] โ€” calculates statistics on IPv4 addresses, with source and destination addresses all grouped together. everyone in the same group chat ๐Ÿซถ
  • -z ip_srcdst,tree[,filter] โ€” calculates statistics on IPv4 addresses, with source and destination addresses separated into separate categories. ok boundaries, we respect them.
  • -z ip_ttl,tree[,filter] โ€” calculates statistics on the time to live (TTL) values that occur for each IPv4 source address.
  • -z ip6_dests,tree[,filter] โ€” calculates statistics on IPv6 destination addresses and the protocols and ports appearing on each address.
  • -z ip6_hosts,tree[,filter] โ€” calculates statistics on IPv6 addresses, with source and destination addresses all grouped together.
  • -z ip6_ptype,tree[,filter] โ€” calculates statistics on port types that occur on IPv6 packets.
  • -z ip6_srcdst,tree[,filter] โ€” calculates statistics on IPv6 addresses, with source and destination addresses separated into separate categories.
  • -z ip6_hop,tree[,filter] โ€” calculates statistics on the hop limits that occur for each IPv6 source address. hop hop hop ๐Ÿ‡
  • -z isup_msg,tree[,filter] โ€” bestie, this one runs the numbers on ISUP messages ๐Ÿ’… what you get back is the message types plus the direction, and "direction" here means the originating point code and the destination point code. cute little pair, iconic.
  • -z lbmr_queue_ads_queue,tree[,filter] โ€” stats o'clock for LBM Topic Resolution Packets โœจ it shows queue advertisements, collated by queue name first and then by source addresses and port. nested vibes, we love a hierarchy.
  • -z lbmr_queue_ads_source,tree[,filter] โ€” same LBM Topic Resolution Packet energy, but flipped: queue advertisements collated by source address first, and then queue and port ๐ŸŒธ
  • -z lbmr_queue_queries_queue,tree[,filter] โ€” LBM Topic Resolution Packets again ๐Ÿฆ‹ this time it's queue queries, collated by queue name and then receiver addresses.
  • -z lbmr_queue_queries_receiver,tree[,filter] โ€” queue queries collated by receiver address and then queue. yes it's the mirror image of the one above, no cap โœจ
  • -z lbmr_topic_ads_source,tree[,filter] โ€” LBM Topic Resolution Packets, topic advertisement edition ๐ŸŽ€ collated by source address first, then topic name and source string.
  • -z lbmr_topic_ads_topic,tree[,filter] โ€” topic advertisements collated by topic name and then source address and source string. the other way round, and honestly both are valid ๐Ÿ’œ
  • -z lbmr_topic_ads_transport,tree[,filter] โ€” topic advertisements sorted by source string first, then topic name. transport said "my turn" ๐Ÿš€
  • -z lbmr_topic_queries_pattern,tree[,filter] โ€” LBM Topic Resolution Packets, but queries this time ๐Ÿ” collated by pattern and then receiver address.
  • -z lbmr_topic_queries_pattern_receiver,tree[,filter] โ€” topic queries collated by receiver address and then pattern. same data, reversed order, main character energy both times ๐Ÿ‘‘
  • -z lbmr_topic_queries_receiver,tree[,filter] โ€” topic queries collated by receiver address and then topic name ๐Ÿค
  • -z lbmr_topic_queries_topic,tree[,filter] โ€” and the last LBM one: topic queries collated by topic name and then receiver address. that's the whole lbmr set, slay ๐ŸŽ‰

  • -z mac-3gpp,stat[,filter] โ€” okay so this activates a counter for LTE or NR MAC messages ๐Ÿ’– you get info about the max number of UEs/TTI, common messages, and a bunch of counters for every UE that shows up in the log.

Example: tshark -z mac-3gpp,stat.

This option can be used multiple times on the command line.

Example: -z "mac-3gpp,stat,mac-lte.rnti>3000" will only collect stats for LTE UEs with an assigned RNTI whose value is more than 3000. filtered and fabulous โœจ

  • -z megaco,rtd[,filter] โ€” collects requests/response RTD (that's Response Time Delay, bestie) data for MEGACO ๐Ÿ’… this is similar to -z smb,srt. what you actually get: the number of calls for each known MEGACO Type, MinRTD, MaxRTD and AvgRTD. plus bonus content โ€” the number of duplicate requests/responses, unresponded requests, and responses that don't match with any request ๐Ÿ™ˆ

Example: -z megaco,rtd.

Example: -z "megaco,rtd,ip.addr==1.2.3.4" will only collect stats for MEGACO packets exchanged by the host at IP address 1.2.3.4 .

This option can be used multiple times on the command line.

  • -z mgcp,rtd[,filter] โ€” MEGACO's sibling ๐Ÿ˜Œ collects requests/response RTD (Response Time Delay) data for MGCP, also similar to -z smb,srt. data collected is the number of calls for each known MGCP Type, MinRTD, MaxRTD and AvgRTD. and yeah, you also get the number of duplicate requests/responses, unresponded requests, and responses which don't match with any request ๐Ÿซถ

Example: -z mgcp,rtd.

This option can be used multiple times on the command line.

Example: -z "mgcp,rtd,ip.addr==1.2.3.4" will only collect stats for MGCP packets exchanged by the host at IP address 1.2.3.4 .

  • -z mtp3,msus[,filter] โ€” stats on MTP3 MSUs ๐ŸŒˆ for each combination of originating point code, destination point code, and service indicator, it calculates the total number of MSUs, the total bytes, and the average bytes per MSU. trio of numbers, chef's kiss.
  • -z ncp,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for Netware Core Protocol โญ Minimum SRT, maximum SRT, average SRT, and sum SRT are displayed for request/response pairs, organized by group, function and subfunction, and verb. heads up though: no statistics are gathered on unpaired messages ๐Ÿ’€
  • -z oran-fh-cus,stat[,filter] โ€” collects flow summaries for ORAN FH CUS traffic ๐Ÿงš short and sweet.
  • -z osmux,tree[,filter] โ€” statistics for the OSmux voice/signaling multiplex protocol ๐ŸŽ€ you get the total number of OSmux packets, and for each stream: the number of packets, the number of packets with the RTP market bit set, the number of AMR frames, jitter analysis, and sequence number analysis. that's a whole lot of analysis and we're obsessed.
  • -z pfcp,srt[,filter] โ€” collects requests/response SRT (Service Response Time) data for PFCP ๐Ÿ’œ data collected is the number of calls, minimum SRT, maximum SRT, average SRT, and sum SRT for certain commands. currently no statistics are gathered on unpaired messages โ€” currently being the operative word ๐Ÿ‘€
  • -z pingpongprotocol,stat[,filter] โ€” stats on the Ping Pong Protocol of Reliable Server Pooling ๐Ÿ“ for each message type it displays the number, rate and share among all message types of both packets and bytes, plus the first and last time that it is seen.
  • -z plen,tree[,filter] โ€” packet length stats ๐ŸŒธ packets get grouped into buckets that grow exponentially with powers of two. math girlies rise.
  • -z proto,colinfo,filter,field โ€” this one's a whole vibe ๐Ÿ˜ญ it appends all field values for the packet to the Info column of the one-line summary output. you can use this to tack arbitrary fields onto the Info column on top of its normal content. field is the display-filter name of a field whose value should be placed in the Info column, and filter is a filter string that controls for which packets that field value actually shows up. so field will only be presented in the Info column for the packets which match filter ๐Ÿ’…
Note โ€” for TShark to be able to extract the field value from the packet, field MUST be part of the filter string. if it's not, TShark won't be able to extract its value. like, at all. ๐Ÿ”ฅ

Simple example to add the "nfs.fh.hash" field to the Info column for all packets containing the "nfs.fh.hash" field:

-z proto,colinfo,nfs.fh.hash,nfs.fh.hash

To put "nfs.fh.hash" in the Info column but only for packets coming from host 1.2.3.4 use:

-z "proto,colinfo,nfs.fh.hash && ip.src==1.2.3.4,nfs.fh.hash"

This option can be used multiple times on the command line.

  • -z ptype,tree[,filter] โ€” calculates statistics on port types that occur on IPv4 packets ๐Ÿฆ‹
  • -z radius,rtd[,filter] โ€” collects requests/response RTD (Response Time Delay) data for RADIUS ๐Ÿ‘‘ for each RADIUS code, the data collected is the number of calls, Minimum RTD, Maximum RTD, Average RTD, Minimum in Frame, and Maximum in Frame โ€” along with the number of Open Requests (Unresponded Requests), Discarded Responses (Responses without matching request) and Duplicate Messages.
  • -z rlc-3gpp,stat[,filter] โ€” activates a counter for LTE or NR RLC messages โญ you get info about common messages and various counters for each UE that appears in the log.

Example: tshark -z rlc-3gpp,stat.

This option can be used multiple times on the command line.

Example: -z "rlc-3gpp,stat,rlc-nr.ueid>3000" will only collect stats for NR UEs with a UEId of more than 3000. filter it, bestie โœจ

  • -z rpc,programs โ€” collects call/reply SRT data for all known ONC-RPC programs/versions ๐Ÿ’– data collected is number of calls for each protocol/version, MinSRT, MaxSRT and AvgSRT. this option can only be used once on the command line โ€” one and done, no double dipping ๐Ÿ’…
  • -z rpc,srt,program,version[,filter] โ€” collects call/reply SRT (Service Response Time) data for program/version ๐ŸŒธ data collected is the number of calls for each procedure, MinSRT, MaxSRT, AvgSRT, and the total time taken for each procedure.

Example: tshark -z rpc,srt,100003,3 will collect data for NFS v3.

This option can be used multiple times on the command line.

Example: -z rpc,srt,100003,3,nfs.fh.hash==0x12345678 will collect NFS v3 SRT statistics for a specific file. iykyk ๐Ÿ‘€

  • -z rtp,streams โ€” collects statistics for all RTP streams and calculates max. delta, max. and mean jitter and packet loss percentages ๐ŸŽง
  • -z rtsp,stat[,filter] โ€” counts the RTSP response status codes and the RSTP request methods. yes, the original says RSTP there and we're not touching it ๐Ÿซถ
  • -z rtsp,tree[,filter] โ€” calculates the RTSP packet distribution ๐Ÿฆ‹ displayed values are the response status codes and request methods.
  • -z sametime,tree[,filter] โ€” stats on SAMETIME messages ๐Ÿ’œ displayed values are the messages type, send type, and user status.
  • -z scsi,srt,cmdset[,filter] โ€” collects call/reply SRT (Service Response Time) data for SCSI commandset cmdset ๐Ÿ”ฅ

Commandsets are 0:SBC 1:SSC 5:MMC

Data collected is the number of calls for each procedure, MinSRT, MaxSRT and AvgSRT.

Example: -z scsi,srt,0 will collect data for SCSI BLOCK COMMANDS (SBC).

This option can be used multiple times on the command line.

Example: -z scsi,srt,0,ip.addr==1.2.3.4 will collect SCSI SBC SRT statistics for a specific iscsi/ifcp/fcip host. ๐Ÿ’…

  • -z sctp,stat โ€” activates a counter for SCTP chunks โœจ on top of the total number of SCTP packets, for each source and destination address and port combination it displays the number of chunks of the most common types: DATA, SACK, HEARTBEAT, HEARTBEAT ACK, INIT, INIT ACK, COOKIE ECHO, COOKIE ACK, ABORT, and ERROR. whole checklist, ate.
  • -z sip,stat[,filter] โ€” activates a counter for SIP messages ๐ŸŽ€ you get the number of occurrences of each SIP Method and of each SIP Status-Code. and wait, there's more โ€” you also get the number of resent SIP Messages (only for SIP over UDP ๐Ÿ‘€).

Example: -z sip,stat.

This option can be used multiple times on the command line.

Example: -z "sip,stat,ip.addr==1.2.3.4" will only collect stats for SIP packets exchanged by the host at IP address 1.2.3.4 .

  • -z smb,sids โ€” when this feature is used, TShark prints a report with all the discovered SID and account name mappings ๐ŸŒˆ only those SIDs where the account name is known will be presented in the table. no guessing games here ๐Ÿ’…

For this feature to actually do its thing, you've gotta either flip on "Edit/Preferences/Protocols/SMB/Snoop SID to name mappings" in the preferences, or just override the whole thing by passing -o "smb.sid_name_snooping:TRUE" right there on the TShark command line. Your call bestie ๐Ÿ’…

Side note: the way TShark currently hunts down that SIDโ†’name mapping is lowkey kinda restricted, but there's hope it'll expand in the future. Fingers crossed ๐Ÿซถ

  • -z smb,srt[,filter] โ€” collects call/reply SRT (Service Response Time) data for SMB. What you get: the number of calls for each SMB command, plus MinSRT, MaxSRT, and AvgSRT. Example: -z smb,srt

The data shows up as separate tables for all normal SMB commands, all Transaction2 commands, and all NT Transaction commands. Only the commands that actually show up in the capture get their stats displayed. And heads up โ€” only the first command in an xAndX command chain gets used in the calculation, so with those super common SessionSetupAndX + TreeConnectAndX chains, only the SessionSetupAndX call counts toward the stats. Yeah, it's a flaw, and it might get fixed in the future ๐Ÿคทโ€โ™€๏ธ

You can use this option multiple times on the command line, no cap.

Example: -z "smb,srt,ip.addr==1.2.3.4" will only collect stats for SMB packets exchanged by the host at IP address 1.2.3.4.

  • -z smb2,srt[,filter] โ€” collects call/reply SRT (Service Response Time) data for SMB versions 2 and 3. For each normal command type, the data collected is the number of calls, MinSRT, MaxSRT, AvgSRT, and SumSRT. Nothing gets collected on cancel or oplock break requests, or on unpaired commands. Only the first response to a given request is used โ€” retransmissions are literally not included in the calculation โœจ
  • -z smpp_commands,tree[,filter] โ€” calculates the SMPP command distribution. The displayed values are command IDs for both requests and responses, plus status for responses.
  • -z snmp,srt[,filter] โ€” collects call/reply SRT (Service Response Time) data for SNMP. For each PDU type, the data collected is the number of request/response pairs, MinSRT, MaxSRT, AvgSRT, and SumSRT. No data on unpaired messages, periodt.
  • -z someip_messages,tree[,filter] โ€” creates a statistic of SOME/IP messages. Messages get counted and displayed as Messages grouped by sender/receiver ๐Ÿ‘‘
  • -z someipsd_entries,tree[,filter] โ€” creates a statistic of SOME/IP-SD entries. Entries get counted and displayed as Entries grouped by sender/receiver.
  • -z sv โ€” prints out the time since the start of the capture and the sample count for each IEC 61850 Sampled Values packet ๐ŸŒˆ
  • -z ucp_messages,tree[,filter] โ€” calculates the message distribution of UCP packets. The displayed values are operation types for both operations and results, plus whether results are positive or negative โ€” with error codes displayed for negative results.
  • -z wsp,stat[,filter] โ€” counts the PDU types and the status codes of reply packets for WSP packets.

  • --capture-comment <comment> โ€” adds a capture comment to the output file, if the output file format supports it ๐ŸŽ€

You can specify this option multiple times. But FYI: Wireshark currently only displays the first comment of a capture file. One at a time, bestie.

  • --list-time-stamp-types โ€” lists the time stamp types supported for the interface. If no time stamp type can be set, then no time stamp types get listed at all. Empty list energy ๐Ÿ’€
  • --no-optimize โ€” don't run the libpcap optimizer when generating code for a capture filter. Super useful if you suspect there's a bug in the optimizer ๐Ÿ›

This option can occur multiple times. If you use it before the first occurrence of the -i option, capture filters aren't optimized for all interfaces. If you use it after an -i option, then the capture filter for the interface specified by the last -i option occurring before this option is not optimized. Order matters, iykyk.

  • --process-info[=basic|full] โ€” records, for each packet, the processes on this host that sent or received it, whenever the packet belongs to a TCP or UDP socket. The process ID goes in an epb_processid_threadid option of the packet's block, and a Process Information Block describing the process gets written once per output file. Wireshark shows them as the frame.process fields.

With basic โ€” which is the default โ€” a process is described by what identifies it: its ID, name, and start time, which is exactly what tools like netstat show. With full, its executable path, command line, parent process ID, and user are recorded as well ๐Ÿ‘€

Okay so those full extras can be sensitive: a command line can literally contain a password or a token, and a path can contain the name of a user. They're stored in the capture file as they are, for everybody the file is given to โ€” so only use full for files that will be handled accordingly. With basic they aren't even read ๐Ÿ™ˆ

The argument has to be attached with an equals sign, as in --process-info=full.

So how does it find the processes? It looks in the operating system's socket tables, which means a socket must still exist when its packet is captured โ€” very short-lived sockets can be missed ๐Ÿ˜ญ Which processes can be identified depends on privileges: on Windows, all of them; on Linux, the user's own, or all of them if dumpcap runs as root or has the CAP_SYS_PTRACE capability (which it then keeps, and nothing else, after opening the interfaces); on macOS, the user's own, or all of them if dumpcap runs as root. Not supported on other platforms. Requires the pcapng file format.

  • --time-stamp-type <type> โ€” changes the interface's timestamp method.
  • --update-interval <interval> โ€” sets the length of time in milliseconds between new packet reports during a capture. Also sets the granularity of file duration conditions. The default value is 100ms โฑ๏ธ
  • --color โ€” enables coloring of packets according to standard Wireshark color filters. On Windows, colors are limited to the standard console character attribute colors. Other platforms require a terminal that handles 24-bit "true color" terminal escape sequences. See https://wiki.wireshark.org/ColoringRules for more info on configuring color filters ๐ŸŒธ
  • --no-duplicate-keys โ€” if a key appears multiple times in an object, only write it a single time, with a json array containing all the separate values as its value. (Only works with -T json.)
  • --json-compact โ€” outputs compact JSON without indentation or extra whitespace. This significantly reduces output size and improves performance. (Only works with -T json and -T jsonraw.)
  • --elastic-mapping-filter <protocol>,<protocol>,... โ€” when generating the ElasticSearch mapping file, only put the specified protocols in it, so you avoid a huge mapping file that can choke some software (such as Kibana ๐Ÿ˜ต). The option takes a list of wanted protocol abbreviations, separated by comma.

Example: ip,udp,dns puts only those three protocols in the mapping file.

  • --export-objects <protocol>,<destdir> โ€” exports all objects within a protocol into the directory destdir. The available values for protocol can be listed with --export-objects help.

The objects are directly saved in the given directory. Filenames depend on the dissector, but typically it's named after the basename of a file. Duplicate files are not overwritten โ€” instead an increasing number gets appended before the file extension ๐Ÿ’พ

Heads up: this interface is subject to change, adding the possibility to filter on files.

  • --print-timers โ€” outputs JSON containing elapsed times for each pass tshark does to process a capture file, plus the sum elapsed time for all passes. The per-pass output contains the total elapsed time and aggregate counters for per-packet operations (dissection and filtering) โณ
  • --compress <type> โ€” compresses the output file using the type compression format. --compress with no argument provides a list of the compression formats supported for writing. The type you give takes precedence over the extension of outfile ๐Ÿ—œ๏ธ

๐Ÿ’… DISSECTION OPTIONS

  • -d <layer type>==<selector>,<decode-as protocol> โ€” bestie this is literally Wireshark's Decode As... feature but make it CLI โœจ It lets you say "hey, treat this layer type like this". So if the layer type you're talking about (say tcp.port or udp.port for a TCP or UDP port number) has that selector value, then those packets get dissected as the protocol you picked. Iconic.

Example 1. Decode As Port

-d tcp.port==8888,http

...will decode any traffic running over TCP port 8888 as HTTP. Obsessed.

Example 2. Decode As Port Range

-d tcp.port==8888-8890,http

...will decode any traffic running over TCP ports 8888, 8889 or 8890 as HTTP. A whole little range, slaying.

Example 3. Decode As Port Range via Length

-d tcp.port==8888:3,http

...will decode any traffic running over the three TCP ports 8888, 8889 or 8890 as HTTP. Same energy, different syntax ๐Ÿ’…

If you use an invalid selector or protocol, it prints out a list of valid selectors and protocol names, respectively. So it's not gonna leave you hanging.

Example 4. Decode As List of Selectors

-d .

...is a quick way to get a list of valid selectors. Literally a cheat sheet.

Example 5. Decode As List of Values for a Selector

-d ethertype==0x0800,.

...is a quick way to get a list of protocols that can be selected with an ethertype. iykyk ๐ŸŒธ


  • --disable-all-protocols โ€” nope, we're not dissecting anything. Disable dissection of all protocols. Periodt.
  • --disable-protocol <proto_name>[,<proto_name>,...] โ€” turns off dissection of proto_name. You can pass a comma-separated list. And if you use a proto_name of ALL, it overrides your chosen profile's default enabled protocol list and temporarily disables all protocols. Big "mute everyone" energy ๐Ÿ”‡
  • --disable-heuristic <short_name> โ€” disables dissection of that heuristic protocol. Bye ๐Ÿ‘‹
  • --enable-protocol <proto_name>[,<proto_name>,...] โ€” turns dissection of proto_name back on. Comma-separated list, go off. Use a proto_name of ALL to override your chosen profile's default disabled protocol list and temporarily enable all protocols which are enabled by default ๐Ÿซถ

And here's the cute part: if a protocol shows up in both --disable-protocol and --enable-protocol, the protocol is enabled. That's on purpose โ€” it lets you temporarily disable all protocols but keep a list of exceptions. Example:

--disable-protocol ALL --enable-protocol eth,ip

๐Ÿ’€ the "everyone get out except you two" of flags.

  • --enable-heuristic <short_name> โ€” enables dissection of that heuristic protocol. Welcome back bestie โœจ
  • -K <keytab> โ€” loads kerberos crypto keys from the specified keytab file. You can use this option multiple times to load keys from several files, so stack 'em up.

Example: -K krb5.keytab

  • -n โ€” disables network object name resolution (like hostname, TCP and UDP port names). Heads up though: the -N option might override this one ๐Ÿ‘€
  • -N <name resolving flags> โ€” turns on name resolving only for particular types of addresses and port numbers, with name resolving for other types of addresses and port numbers turned off. This option (along with -n) can be specified multiple times; the last value given overrides earlier ones. Also, this option and -n override the options from the preferences, including preferences set via the -o option. And if neither -N nor -n is present, the values from the preferences are used, which default to -N dmN. No cap.

The argument is a string that may contain the letters:

  • d โ€” to enable resolution from captured DNS packets
  • g โ€” to enable IP address geolocation information lookup from configured MaxMind databases
  • m โ€” to enable MAC address resolution
  • n โ€” to enable network address resolution
  • N โ€” to enable using external resolvers (e.g., DNS) for network address resolution; no effect without n also enabled
  • s โ€” to enable address resolution using SNI information found in captured handshake packets
  • t โ€” to enable transport-layer port number resolution
  • v โ€” to enable VLAN IDs to names resolution
โš ๏ธ Caution: in tshark single-pass mode, external resolution and geolocation lookup is performed synchronously. For live captures, which are always in single-pass mode, this makes it more difficult for dissection to keep up with a busy network, possibly leading to dropped packets. So like... be mindful ๐Ÿ˜ญ
  • --only-protocols <protocols> โ€” only enable dissection of these protocols, comma separated. Everything else gets disabled. Main character protocol energy ๐Ÿ‘‘
  • -t (a|ad|adoy|d|dd|e|r|rc|u|ud|udoy)[.[N]]|.[N] โ€” sets the format of the packet timestamp displayed in the default time column. The format can be one of:
    • a absolute: the absolute time, as local time in your time zone, is the actual time the packet was captured, with no date displayed
    • ad absolute with date: the absolute date, displayed as YYYY-MM-DD, and time, as local time in your time zone, is the actual time and date the packet was captured
    • adoy absolute with date using day of year: the absolute date, displayed as YYYY/DOY, and time, as local time in your time zone, is the actual time and date the packet was captured
    • d delta: the delta time is the time since the previous packet was captured
    • dd delta_displayed: the delta_displayed time is the time since the previous displayed packet was captured
    • e epoch: the time in seconds since epoch (Jan 1, 1970 00:00:00)
    • r relative: the relative time is the time elapsed between the first packet and the current packet
    • rc relative to capture start: the relative to capture start time is the time elapsed between the start of the capturing and the current packet
    • u UTC: the absolute time, as UTC with a "Z" suffix, is the actual time the packet was captured, with no date displayed
    • ud UTC with date: the absolute date, displayed as YYYY-MM-DD, and time, as UTC with a "Z" suffix, is the actual time and date the packet was captured
    • udoy UTC with date using day of year: the absolute date, displayed as YYYY/DOY, and time, as UTC with a "Z" suffix, is the actual time and date the packet was captured
    • .[N] โ€” set the precision: N is the number of decimals (0 through 9). If using "." without N, automatically determine precision from trace. Fancy ๐ŸŽ€

The default format is relative with precision based on capture format.

  • -u <s|hms> โ€” specifies how packet timestamp formats in -t which are relative times (i.e. relative, delta, and delta_displayed) are displayed. Valid choices are:
    • s for seconds
    • hms for hours, minutes, and seconds

The default format is seconds. โฑ๏ธ


๐Ÿฉบ DIAGNOSTIC OPTIONS

  • --log-level <level> โ€” sets the active log level. Supported levels in lowest to highest order are "noisy", "debug", "info", "message", "warning", "critical", and "error". Messages at each level and higher will be printed โ€” for example "warning" prints "warning", "critical", and "error" messages and "noisy" prints all messages. Levels are case insensitive ๐Ÿซถ
  • --log-fatal <level> โ€” aborts the program if any messages are logged at the specified level or higher. For example, "warning" aborts on any "warning", "critical", or "error" messages. It's giving "one strike and you're out" ๐Ÿ’€
  • --log-fatal-count <count> โ€” the amount of fatal log messages which may pass before the program is aborted. So you get a little grace period, cute.
  • --log-domains <list> โ€” only print messages for the specified log domains, e.g. "GUI,Epan,sshdump". List of domains must be comma-separated. Can be negated with "!" as the first character (inverts the match) ๐Ÿ’…
  • --log-debug <list> โ€” force the specified domains to log at the "debug" level. List of domains must be comma-separated. Can be negated with "!" as the first character (inverts the match).
  • --log-noisy <list> โ€” force the specified domains to log at the "noisy" level. List of domains must be comma-separated. Can be negated with "!" as the first character (inverts the match). Loud and proud ๐Ÿ”Š
  • --log-fatal-domains <list> โ€” abort the program if any messages are logged for the specified log domains. List of domains must be comma-separated. Yeah, it's serious-serious.
  • --log-file <path> โ€” write log messages and stderr output to the specified file. Everything in one place, we love a tidy queen ๐Ÿ“

๐ŸŽฃ CAPTURE FILTER SYNTAX

See the manual page of pcap-filter(7) or, if that doesn't exist, tcpdump(8), or, if that doesn't exist, https://wiki.wireshark.org/CaptureFilters. Like, whichever one you can actually find bestie ๐Ÿฆ‹

๐Ÿ” READ FILTER SYNTAX

For a complete table of protocol and protocol fields that are filterable in TShark, see the wireshark-filter(4) manual page. Go get your lookup on โœจ


๐Ÿ“‚ FILES

These files contain various Wireshark configuration settings. Very "settings and lore" of it.

Preferences

The preferences files contain global (system-wide) and personal preference settings. If the system-wide preference file exists, it is read first, overriding the default settings. If the personal preferences file exists, it is read next, overriding any previous values. Note: if the command line flag -o is used (possibly more than once), it will in turn override values from the preferences files. That's the hierarchy, respect it ๐Ÿ‘‘

The preferences settings are in the form prefname:value, one per line, where prefname is the name of the preference and value is the value to which it should be set; white space is allowed between : and value. A preference setting can be continued on subsequent lines by indenting the continuation lines with white space. A # character starts a comment that runs to the end of the line:

# Vertical scrollbars should be on right side?
# TRUE or FALSE (case-insensitive).
gui.scrollbar_on_right: TRUE

The global preferences file is looked for in the wireshark directory under the share subdirectory of the main installation directory. On macOS, this would typically be /Application/Wireshark.app/Contents/Resources/share; on other UNIX-compatible systems, such as Linux, \*BSD, Solaris, and AIX, this would typically be /usr/share/wireshark/preferences for system-installed packages and /usr/local/share/wireshark/preferences for locally-installed packages; on Windows, this would typically be C:\Program Files\Wireshark\preferences.

On UNIX-compatible systems, the personal preferences file is looked for in $XDG_CONFIG_HOME/wireshark/preferences, (or, if $XDG_CONFIG_HOME/wireshark does not exist while $HOME/.wireshark does exist, $HOME/.wireshark/preferences); this is typically $HOME/.config/wireshark/preferences. On Windows, the personal preferences file is looked for in %APPDATA%\Wireshark\preferences (or, if %APPDATA% isn't defined, %USERPROFILE%\Application Data\Wireshark\preferences). Path hunting is literally a side quest ๐Ÿ—บ๏ธ

Disabled (Enabled) Protocols

The disabled_protos files are basically the โœจdo-not-call listโœจ for dissectors โ€” there's a system-wide one and a personal one, and they hold lists of protocols that have been disabled, so their dissectors are never called. Each file just contains protocol names, one per line, and the protocol name is the exact same name you'd use in a display filter for that protocol:

http
tcp     # a comment

Okay and here's the thing, bestie, pay attention: if a protocol is listed in the global disabled_protos file, it cannot be enabled by the user. Locked. Periodt. ๐Ÿ”’

The global disabled_protos file uses the same directory as the global preferences file. The personal disabled_protos file uses the same directory as the personal preferences file.

Also the disabled_protos files list only protocols that are enabled by default but have been disabled; protocols that are disabled by default (such as some postdissectors) are not listed there. There are analogous enabled_protos files for protocols that are disabled by default but have been enabled โ€” the mirror-image vibe, iykyk. ๐Ÿชž

๐Ÿงš Heuristic Dissectors

The heuristic_protos files contain system-wide and personal lists of heuristic dissectors and say whether each one is enabled or disabled. Each file holds heuristic dissector unique short names, one per line, followed by a comma and 0 for disabled or 1 for enabled:

quic,1
rtcp_stun,1
rtcp_udp,1
rtp_stun,0
rtp_udp,0
tls_tcp,1

The global heuristic_protos file uses the same directory as the global preferences file. The personal heuristic_protos file uses the same directory as the personal preferences file. Same deal as always, no cap. ๐ŸŽ€

๐ŸŒธ Name Resolution (hosts)

Entries in hosts files in the global and personal preferences directory are used to resolve IPv4 and IPv6 addresses before any other attempts are made to resolve them. The file has the standard hosts file syntax; each line contains one IP address and name, separated by whitespace. And the personal hosts file, if present, overrides the one in the global directory โ€” personal wins, always. ๐Ÿ‘‘

Capture filter name resolution is handled by libpcap on UNIX-compatible systems, such as Linux, macOS, *BSD, Solaris, and AIX, and Npcap on Windows. As such the Wireshark personal hosts file will not be consulted for capture filter name resolution. Sorry babes, that's just how it is. ๐Ÿ˜ญ

๐Ÿฆ‹ Name Resolution (subnets)

If an IPv4 address cannot be translated via name resolution (no exact match is found) then a partial match is attempted via the subnets file. Both the global subnets file and personal subnets files are used if they exist.

Each line of this file consists of an IPv4 address, a subnet mask length separated only by a / and a name separated by whitespace. While the address must be a full IPv4 address, any values beyond the mask length are subsequently ignored.

An example is:

# Comments must be prepended by the # sign! 192.168.0.0/24
ws_test_network

A partially matched name will be printed as "subnet-name.remaining-address". For example, "192.168.0.1" under the subnet above would be printed as "ws_test_network.1"; if the mask length above had been 16 rather than 24, the printed address would be "ws_test_network.0.1". See how it eats? ๐Ÿ’…

๐Ÿ’œ Name Resolution (ethers)

The ethers files are consulted to correlate 6-byte EUI-48 and 8-byte EUI-64 hardware addresses to names. First the personal ethers file is tried and if an address is not found there the global ethers file is tried next.

The file has a similar format to that defined by ethers(5) on some UNIX-like systems. Each line contains one hardware address and name, separated by whitespace (tabs or spaces). The hexadecimal digits of the hardware address are separated by colons (:), dashes (-) or periods (.). The same separator character must be used consistently in an address. A # indicates a comment that extends to the rest of the line. Both 6-byte MAC and 8-byte EUI-64 addresses are supported. The following four lines are valid lines of an ethers file:

ff:ff:ff:ff:ff:ff          Broadcast
c0-00-ff-ff-ff-ff          TR_broadcast
00.00.00.00.00.00          Zero_broadcast
00:00:00:00:00:00:00:00    EUI64_zero_broadcast

Note that this accepts a greater variety of formats than the file defined by ethers(5) on most UN*X systems. We're flexible like that. ๐Ÿ™ˆ

The global ethers file is looked for in the /etc directory on UNIX-compatible systems, such as Linux, macOS, *BSD, Solaris, and AIX, and in the main installation directory (for example, C:\Program Files\Wireshark) on Windows systems.

The personal ethers file is looked for in the same directory as the personal preferences file.

Capture filter name resolution is handled by libpcap on UNIX-compatible systems and Npcap on Windows. As such the Wireshark personal ethers file will not be consulted for capture filter name resolution. Again. It's giving consistent, honestly. ๐Ÿ’€

โญ Name Resolution (manuf)

The manuf file is used to match the 3-byte vendor portion of a 6-byte hardware address with the manufacturer's name; it can also contain well-known MAC addresses and address ranges specified with a netmask. The format of the file is similar to the ethers files, except that entries such as:

00:00:0C      Cisco     Cisco Systems, Inc

can be provided, with the 3-byte OUI and both an abbreviated and long name for a vendor, and entries such as:

00-00-0C-07-AC/40     All-HSRP-routers

can be specified, with a MAC address and a mask indicating how many bits of the address must match. The above entry, for example, has 40 significant bits, or 5 bytes, and would match addresses from 00-00-0C-07-AC-00 through 00-00-0C-07-AC-FF. The mask need not be a multiple of 8. Math is math, she contains multitudes. ๐Ÿงฎ

A global manuf file is looked for in the same directory as the global preferences file, and a personal manuf file is looked for in the same directory as the personal preferences file.

In earlier versions of Wireshark, official information from the IEEE Registration Authority was distributed in this format as the global manuf file. This information is now compiled in to speed program startup, but the internal information can be written out in this format with tshark -G manuf.

In addition to the manuf file, another file with the same format, wka, is looked for in the global directory. This file is distributed with Wireshark, and contains data about well-known MAC addresses and address ranges assembled from various non IEEE but respected sources. Respect the sources. ๐Ÿซถ

๐ŸŒˆ Name Resolution (services)

The services file is used to translate port numbers into names. Both the global services file and personal services files are used if they exist โ€” both, together, no overriding drama here.

The file has the standard services file syntax; each line contains one (service) name and one transport identifier separated by white space. The transport identifier includes one port number and one transport protocol name (typically tcp, udp, or sctp) separated by a /.

An example is:

mydns       5045/udp     # My own Domain Name Server mydns
5045/tcp     # My own Domain Name Server

In earlier versions of Wireshark, official information from the IANA Registry was distributed in this format as the global services file. This information is now compiled in to speed program startup, but the internal information can be written out in this format with tshark -G services. Same glow-up as manuf, honestly iconic. โœจ

๐Ÿ“ Name Resolution (ipxnets)

The ipxnets files are used to correlate 4-byte IPX network numbers to names. First the global ipxnets file is tried and if that address is not found there the personal one is tried next. (Yes, opposite order from ethers โ€” don't come for me, I don't make the rules. ๐Ÿ˜…)

The format is the same as the ethers file, except that each address is four bytes instead of six. Additionally, the address can be represented as a single hexadecimal number, as is more common in the IPX world, rather than four hex octets. For example, these four lines are valid lines of an ipxnets file:

C0.A8.2C.00              HR
c0-a8-1c-00              CEO
00:00:BE:EF              IT_Server1
110f                     FileServer3

The global ipxnets file is looked for in the /etc directory on UNIX-compatible systems, such as Linux, macOS, *BSD, Solaris, and AIX, and in the main installation directory (for example, C:\Program Files\Wireshark) on Windows systems.

The personal ipxnets file is looked for in the same directory as the personal preferences file.

๐Ÿ”ฅ Name Resolution (ss7pcs)

The ss7pcs file is used to translate SS7 point codes to names. It is read from the personal configuration directory.

Each line in this file consists of one network indicator followed by a dash followed by a point code in decimal and a node name separated by whitespace. An example is:

2-1234 MyPointCode1

Short, sweet, slays. ๐Ÿ‘‘

๐ŸŽ€ Name Resolution (vlans)

The vlans file is used to translate VLAN tag IDs into names. It is read from the personal configuration directory.

Each line in this file consists of one VLAN tag ID separated by whitespace from a name. An example is:

123    Server-Lan
2049   HR-Client-LAN

Look at her. Organized. Structured. Main character energy. ๐Ÿ’–

๐Ÿ‘‘ Coloring Rules (Color Filters)

The coloring_rules.jsonc file contains system-wide and personal coloring rules. It contains an array of named JSON objects with the following key:value pairs:

[
    { "Filter name": {
        "filter": "<display filter string>",
        "foreground": "#rrggbb or rrggbb",
        "background": "#rrggbb or rrggbb",
        "enabled": "<boolean value>"
        }
    }
]

The global coloring_rules.jsonc file uses the same directory as the global preferences file. The personal coloring_rules.jsonc file uses the same directory as the personal preferences file. It is written through the View โ€บ Coloring Rules... dialog.

If the global coloring_rules.jsonc file exists, it is used only if the personal coloring_rules.jsonc file does not exist; global and personal color filters are not merged. It's all or nothing, bestie, that's the vibe check. ๐Ÿ’…

There is also a legacy colorfilters file which was the default name and format prior to Wireshark 5.0 and Stratoshark 1.0. Each line contains one filter, starting with the string displayed in the dialog box, followed by the corresponding display filter. Then the background and foreground colors are appended:

Heads up bestie, these lines below are literally from the legacy colorfilters file format โ€” keep them exactly as they are ๐Ÿ’…
# a comment
@tcp@tcp@[59345,58980,65534][0,0,0]
@udp@udp@[28834,57427,65533][0,0,0]

Wireshark will read the legacy colorfilters file if it exists, followed by coloring_rules.jsonc. And it will write the legacy colorfilters file only if it exists โ€” no surprise new files, no cap โœจ

๐Ÿงฉ Plugins (still FILES, we're not done yet)

Wireshark looks for plugins in two places, bestie: a personal plugin folder and a global plugin folder. Two icons, one mission ๐Ÿ’–

On UNIX-compatible systems โ€” like Linux, macOS, *BSD, Solaris and AIX โ€” the global plugin directory is lib/wireshark/plugins/ (on some systems substitute lib64 for lib) under the main installation directory (for example, /usr/local/lib/wireshark/plugins/). The personal plugin directory is $HOME/.local/lib/wireshark/plugins.

On macOS, if Wireshark is installed as an application bundle, the global plugin folder is instead %APPDIR%/Contents/PlugIns/wireshark.

On Windows, the global plugin folder is plugins/ under the main installation directory (for example, C:\Program Files\Wireshark\plugins\). The personal plugin folder is %APPDATA%\Wireshark\plugins (or, if %APPDATA% isn't defined, %USERPROFILE%\Application Data\Wireshark\plugins).

Lua plugins live right in the plugin folders; compiled plugins live in subfolders of the plugin folders, and that subfolder name is the Wireshark minor version number (X.Y). And there's yet another hierarchical level for each Wireshark plugin type (libwireshark, libwiretap and codecs). So for example, the location for a libwireshark plugin foo.so (foo.dll on Windows) would be PLUGINDIR/X.Y/epan โ€” and yes, libwireshark used to be called libepan, the other folder names are codecs and wiretap. Nesting dolls but make it packet analysis ๐Ÿช†

Note ๐ŸŽ€ On UNIX-compatible systems, Lua plugins (but not binary plugins) may also be placed in $XDG_CONFIG_HOME/wireshark/plugins, (or, if $XDG_CONFIG_HOME/wireshark does not exist while $HOME/.wireshark does exist, $HOME/.wireshark/plugins.)

Also keep in mind: a dissector plugin module may support more than one protocol โ€” there is not necessarily a one-to-one correspondence between dissector plugin modules and protocols. And protocols supported by a dissector plugin module are enabled and disabled in the same way as protocols built into Wireshark. Same buttons, same vibe ๐Ÿ’…


๐ŸŒˆ OUTPUT (how it talks back to you)

TShark uses UTF-8 to represent strings internally. In some cases the output might not be valid. For example, a dissector might generate invalid UTF-8 character sequences. So if you're writing a program that reads TShark output, expect UTF-8 and be prepared for invalid output. Fr fr, don't trust it blindly ๐Ÿ˜ญ

If TShark detects that it is writing to a TTY on a UNIX-compatible system โ€” such as Linux, macOS, *BSD, Solaris and AIX โ€” and the locale does not support UTF-8, output will be re-encoded to match the current locale. It's giving adaptive queen โœจ

If TShark detects that it is writing to the console on Windows, dissection output will be encoded as UTF-16LE. Other output will be UTF-8. And if extended characters don't display properly in your terminal, you might try setting your console code page to UTF-8 (chcp 65001) and using a modern terminal application if possible. Honestly? Do it, your eyes will thank you ๐Ÿ’–


๐ŸŒธ ENVIRONMENT VARIABLES (the settings your shell whispers to TShark)

  • WIRESHARK_CONFIG_DIR โ€” overrides the location of personal configuration files. On UNIX-compatible systems (Linux, macOS, *BSD, Solaris, AIX) it defaults to $XDG_CONFIG_HOME/wireshark (or, if that directory doesn't exist but $HOME/.wireshark does exist, $HOME/.wireshark) โ€” this is typically $HOME/.config/wireshark. On Windows, it defaults to %APPDATA%\Wireshark (or, if %APPDATA% isn't defined, %USERPROFILE%\Application Data\Wireshark). Available since Wireshark 3.0. ๐Ÿ‘‘
  • WIRESHARK_DEBUG_WMEM_OVERRIDE โ€” setting this forces the wmem framework to use the specified allocator backend for all allocations, regardless of which backend is normally specified by the code. Mainly useful to developers when testing or debugging. See README.wmem in the source distribution for the deets ๐Ÿงš
  • WIRESHARK_RUN_FROM_BUILD_DIRECTORY โ€” causes the plugins and other data files to be loaded from the build directory (where the program was compiled) rather than from the standard locations. It has no effect when the program in question is running with root (or setuid) permissions on UNIX-compatible systems, such as Linux, macOS, *BSD, Solaris and AIX. ๐Ÿ”ฅ
  • WIRESHARK_DATA_DIR โ€” causes the various data files to be loaded from a directory other than the standard locations. No effect when the program in question is running with root (or setuid) permissions on UNIX-compatible systems.
  • WIRESHARK_EXTCAP_DIR โ€” causes the various extcap programs and scripts to be run from a directory other than the standard locations. No effect when the program in question is running with root (or setuid) permissions on UNIX-compatible systems.
  • WIRESHARK_PLUGIN_DIR โ€” causes the various plugins to be loaded from a directory other than the standard locations. No effect when the program in question is running with root (or setuid) permissions on UNIX-compatible systems. ๐Ÿฆ‹
  • ERF_RECORDS_TO_CHECK โ€” controls the number of ERF records checked when deciding if a file really is in the ERF format. Setting this to a number higher than the default (20) would make false positives less likely. Detective mode ๐Ÿ”
  • IPFIX_RECORDS_TO_CHECK โ€” controls the number of IPFIX records checked when deciding if a file really is in the IPFIX format. Setting this to a number higher than the default (20) would make false positives less likely.
  • WIRESHARK_ABORT_ON_DISSECTOR_BUG โ€” if this is set, TShark will call abort(3) when a dissector bug is encountered. abort(3) will cause the program to exit abnormally; if you're running TShark in a debugger, it should halt in the debugger and allow inspection of the process, and if you're not running it in a debugger, it will, on some OSes, assuming your environment is configured correctly, generate a core dump file. Useful to developers attempting to troubleshoot a problem with a protocol dissector. โญ
  • WIRESHARK_ABORT_ON_TOO_MANY_ITEMS โ€” if this is set, TShark will call abort(3) if a dissector tries to add too many items to a tree (generally this is an indication of the dissector not breaking out of a loop soon enough). abort(3) will cause the program to exit abnormally; if you're running TShark in a debugger, it should halt in the debugger and allow inspection of the process, and if you're not running it in a debugger, it will, on some OSes, assuming your environment is configured correctly, generate a core dump file. Again: dev troubleshooting tool, don't just leave it on ๐Ÿ’€
  • WIRESHARK_LOG_LEVEL โ€” controls the verbosity of diagnostic messages to the console. From less verbose to most verbose, the levels can be critical, warning, message, info, debug or noisy. Levels above the current level are also active. Levels critical and error are always active. ๐Ÿ“ข
  • WIRESHARK_LOG_FATAL โ€” sets the fatal log level. Fatal log levels cause the program to abort. This level can be set to Error, critical or warning. Error is always fatal and is the default. ๐Ÿ™ˆ
  • WIRESHARK_LOG_DOMAINS โ€” selects which log domains are active. The filter is given as a case-insensitive comma separated list. If set, only the included domains will be enabled. The default domain is always considered to be enabled. Domain filter lists can be preceded by '!' to invert the sense of the match. Iconic little filter ๐Ÿ’œ
  • WIRESHARK_LOG_DEBUG โ€” list of domains with debug log level. This sets the level of the provided log domains and takes precedence over the active domains filter. If preceded by '!' this disables the debug level instead.
  • WIRESHARK_LOG_NOISY โ€” same as above but for the noisy log level instead. ๐Ÿ”Š

๐Ÿ‘€ SEE ALSO

wireshark-filter(4), wireshark(1), editcap(1), pcap(3), dumpcap(1), text2pcap(1), mergecap(1), pcap-filter(7) or tcpdump(8)

The whole friend group, together at last ๐Ÿซถ


๐Ÿ“ NOTES

This is the manual page for TShark 4.7.4. TShark is part of the Wireshark distribution. The latest version of Wireshark can be found at https://www.wireshark.org.

HTML versions of the Wireshark project man pages are available at https://www.wireshark.org/docs/man-pages.

Save those links, bestie, seriously ๐ŸŒŸ


๐Ÿ‘‘ AUTHORS

TShark uses the same packet dissection code that Wireshark does, as well as using many other modules from Wireshark; see the list of authors in the wireshark(1) man page for a list of authors of that code.


And that's a wrap on the whole page, no cap ๐Ÿ’– This absolute unit of a manpage is TShark 4.7.4, dated 2026-10-08 โ€” go dissect something iconic, you main character ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from