// WSUG Chapter Customizing [#ChapterCustomize] == Customizing Wireshark [#ChCustIntroduction] === Introduction Wireshark’s default behavior will usually suit your needs pretty well. However, as you become more familiar with Wireshark, it can be customized in various ways to suit your needs even better. In this chapter we explore: * How to start Wireshark with command line parameters * How to colorize the packet list * How to control protocol dissection * How to use the various preference settings [#ChCustCommandLine] === Start Wireshark from the command line You can start Wireshark from the command line, but it can also be started from most Window managers as well. In this section we will look at starting it from the command line. Wireshark supports a large number of command line parameters. To see what they are, simply enter the command _wireshark -h_ and the help information shown in <> (or something similar) should be printed. [#ChCustEx1] .Help information available from Wireshark ---- include::wireshark-h.txt[] ---- We will examine each of the command line options in turn. The first thing to notice is that issuing the command `wireshark` by itself will launch Wireshark. However, you can include as many of the command line parameters as you like. Their meanings are as follows ( in alphabetical order ): // XXX - is the alphabetical order a good choice? Maybe better task based? -a :: --autostop :: Specify a criterion that specifies when Wireshark 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 of seconds have elapsed. filesize:value:: Stop writing to a capture file after it reaches a size of value kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). If this option is used together with the -b option, Wireshark will stop writing to the current capture file and switch to the next one if filesize is reached. files:value:: Stop writing to capture files after value number of files were written. packets:value:: Stop writing to a capture file after value number of packets were written. -- -b :: If a maximum capture file size was specified, this option causes Wireshark to run in “ring buffer” mode, with the specified number of files. In “ring buffer” mode, Wireshark will write to several capture files. Their name is based on the number of the file and on the creation date and time. + When the first capture file fills up Wireshark will switch to writing to the next file, and so on. 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 the data in the first file will be discarded so a new file can be written. + If the optional duration is specified, Wireshark will also switch to the next file when the specified number of seconds has elapsed even if the current file is not completely filled up. + -- duration:value:: Switch to the next file after value seconds have elapsed, even if the current file is not completely filled up. filesize:value:: Switch to the next file after it reaches a size of value kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). files:value:: Begin again with the first file after value number of files were written (form a ring buffer). packets:value:: Switch to the next file after value number of packets were written, even if the current file is not completely filled up. interval:value:: Switch to the next file when the time is an exact multiple of value seconds. -- -B :: --buffer-size :: Set capture buffer size (in MB, default is 2MB). This is used by the capture driver to buffer packet data until that data can be written to disk. If you encounter packet drops while capturing, try to increase this size. Not supported on some platforms. -C :: Start with the specified configuration profile. -c :: This option specifies the maximum number of packets to capture when capturing live data. It would be used in conjunction with the `-k` option. --capture-comment :: Add the comment string to the capture file, if supported by the file format. -d ==,:: "Decode As", see <> for details. Example: tcp.port==8888,http -D:: --list-interfaces:: Print a list of the interfaces on which Wireshark can capture, then exit. 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. + This can be useful on systems that don’t have a command to list them (e.g., Windows systems, or UNIX systems lacking `ifconfig -a`). The number can be especially useful on Windows, where the interface name is a GUID. + Note that “can capture” means that Wireshark was able to open that device to do a live capture. If, on your system, a program doing a network capture must be run from an account with special privileges, then, if Wireshark is run with the `-D` flag and is not run from such an account, it will not list any interfaces. --display :: Set the X display to use, instead of the one defined in the environment, or the default display. --enable-protocol :: --disable-protocol :: Enable and disable the dissection of the protocol. --enable-heuristic :: --disable-heuristic :: Enable and disable the dissection of the heuristic protocol. -f :: This option sets the initial capture filter expression to be used when capturing packets. --fullscreen:: Start Wireshark in full screen. -g :: After reading in a capture file using the -r flag, go to the given packet number. -h:: --help:: This option requests Wireshark to print its version and usage instructions (as shown here) and exit. -H:: Hide the capture info dialog during live packet capture. -i :: --interface :: Set 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 `wireshark -D` (described above). A number, as reported by `wireshark -D`, can also be used. If you’re using UNIX, `netstat -i`, `ifconfig -a` or `ip link` might also work to list interface names, although not all versions of UNIX support the `-a` flag to `ifconfig`. + If no interface is specified, Wireshark 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, Wireshark reports an error and doesn’t start the capture. + Pipe names should be either the name of a FIFO (named pipe) or “-” to read data from the standard input. Data read from pipes must be in standard libpcap format. -J :: After reading in a capture file using the `-r` flag, jump to the first packet which matches the filter expression. The filter expression is in display filter format. If an exact match cannot be found the first packet afterwards is selected. -I:: --monitor-mode:: Capture wireless packets in monitor mode if available. -j:: Use this option after the `-J` option to search backwards for a first packet to go to. -k:: The `-k` option specifies that Wireshark should start capturing packets immediately. This option requires the use of the `-i` parameter to specify the interface that packet capture will occur from. -K :: Use the specified file for Kerberos decryption. -l:: This option turns on automatic scrolling if the packet list pane is being updated automatically as packets arrive during a capture (as specified by the `-S` flag). -L:: --list-data-link-types:: List the data link types supported by the interface and exit. --list-time-stamp-types:: List timestamp types configurable for the interface and exit. -m :: This option sets the name of the font used for most text displayed by Wireshark. // XXX - add an example! -n:: Disable network object name resolution (such as hostname, TCP and UDP port names). -N :: Turns on name resolving for particular types of addresses and port numbers. The argument is a string that may contain the following letters: + -- N:: Use external name resolver. d:: Enable name resolution from captured DNS packets. m:: Enable MAC address resolution. n:: Enable network address resolution. t:: Enable transport layer port number resolution. v:: Enable VLAN ID resolution. -- -o :: Sets a preference or recent value, overriding the default value and any value read from a preference or recent file. The argument to the flag is a string of the form _prefname:value_, where _prefname_ is the name of the preference (which is the same name that would appear in the `preferences` or `recent` file), and _value_ is the value to which it should be set. Multiple instances of `-o ` can be given on a single command line. + -- An example of setting a single preference would be: ---- wireshark -o mgcp.display_dissect_tree:TRUE ---- An example of setting multiple preferences would be: ---- wireshark -o mgcp.display_dissect_tree:TRUE -o mgcp.udp.callagent_port:2627 ---- You can get a list of all available preference strings from the preferences file. See <> for details. User access tables can be overridden using “uat,” followed by the UAT file name and a valid record for the file: ---- wireshark -o "uat:user_dlts:\"User 0 (DLT=147)\",\"http\",\"0\",\"\",\"0\",\"\"" ---- The example above would dissect packets with a libpcap data link type 147 as HTTP, just as if you had configured it in the DLT_USER protocol preferences. -- -p:: --no-promiscuous-mode:: Don’t put the interface into promiscuous mode. Note that the interface might be in promiscuous mode for some other reason. Hence, `-p` cannot be used to ensure that the only traffic that is captured is traffic sent to or from the machine on which Wireshark is running, broadcast traffic, and multicast traffic to addresses received by that machine. -P :: Special path settings usually detected automatically. This is used for special cases, e.g., starting Wireshark from a known location on an USB stick. + The criterion is of the form key:path, where key is one of: + -- persconf:path:: Path of personal configuration files, like the preferences files. persdata:path:: Path of personal data files, it’s the folder initially opened. After the initialization, the recent file will keep the folder last used. -- -r :: --read-file :: This option provides the name of a capture file for Wireshark to read and display. This capture file can be in one of the formats Wireshark understands. -R :: --read-filter :: This option specifies a display filter to be applied when reading packets from a capture file. The syntax of this filter is that of the display filters discussed in <>. Packets not matching the filter are discarded. -s :: --snapshot-length :: This option specifies the snapshot length to use when capturing packets. Wireshark will only capture _snaplen_ bytes of data for each packet. -S:: This option specifies that Wireshark will display packets as it captures them. This is done by capturing in one process and displaying them in a separate process. This is the same as “Update list of packets in real time” in the “Capture Options” dialog box. -t