DUMPCAP(1) | The Wireshark Network Analyzer | DUMPCAP(1) |
dumpcap - Dump network traffic
dumpcap [ -a <capture autostop condition> ] ... [ -b <capture ring buffer option>] ... [ -B <capture buffer size> ] [ -c <capture packet count> ] [ -C <byte limit> ] [ -d ] [ -D ] [ -f <capture filter> ] [ -g ] [ -h ] [ -i <capture interface>|rpcap://<host>:<port>/<capture interface>|TCP@<host>:<port>|- ] [ -I ] [ -L ] [ -M ] [ -n ] [ -N <packet limit> ] [ -p ] [ -P ] [ -q ] [ -s <capture snaplen> ] [ -S ] [ -t ] [ -v ] [ -w <outfile> ] [ -y <capture link type> ] [ --capture-comment <comment> ] [ --list-time-stamp-types ] [ --time-stamp-type <type> ]
Dumpcap is a network traffic dump tool. It lets you capture packet data from a live network and write the packets to a file. Dumpcap's default capture file format is pcapng format. When the -P option is specified, the output file is written in the pcap format.
Without any options set it will use the libpcap/WinPcap library to capture traffic from the first available network interface and writes the received raw packet data, along with the packets' time stamps into a pcap file.
If the -w option is not specified, Dumpcap writes to a newly created pcap file with a randomly chosen name. If the -w option is specified, Dumpcap writes to the file specified by that option.
Packet capturing is performed with the pcap library. The capture filter syntax follows the rules of the pcap library.
duration:value Stop writing to a capture file after value seconds have elapsed.
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, dumpcap will stop writing to the current capture file and switch to the next one if filesize is reached. Note that the filesize is limited to a maximum value of 2 GiB.
files:value Stop writing to capture files after value number of files were written.
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_20200714120117.pcap, outfile_00002_20200714120523.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 Dumpcap 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 switch to the next file after value seconds have elapsed, 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
filesize:value switch to the next file after it reaches a size of value kB. Note that the filesize is limited to a maximum value of 2 GiB.
files:value begin again with the first file after value number of files were written (form a ring buffer). This value must be less than 100000. Caution should be used when using large numbers of files: some filesystems do not handle many files in a single directory well. The files criterion requires either duration, interval or filesize to be specified to control when to go to the next file. It should be noted that each -b parameter takes exactly one criterion; to specify two criterion, each must be preceded by the -b option.
Example: -b filesize:1000 -b files:5 results in a ring buffer of five files of size one megabyte each.
This is available on UNIX systems with libpcap 1.0.0 or later and on Windows. It is not available on UNIX systems with earlier versions of libpcap.
This option can occur multiple times. If used before the first occurrence of the -i option, it sets the default capture buffer size. If used after an -i option, it sets the capture buffer size for the interface specified by the last -i option occurring before this option. If the capture buffer size is not set specifically, the default capture buffer size is used instead.
This can be useful on systems that don't have a command to list them (UNIX systems lacking ifconfig -a or Linux systems lacking ip link show). The number can be useful on Windows systems, where the interface name might be a long name or a GUID.
Note that "can capture" means that Dumpcap was able to open that device to do a live capture. Depending on your system you may need to run dumpcap from an account with special privileges (for example, as root) to be able to capture network traffic. If "dumpcap -D" is not run from such an account, it will not list any interfaces.
The entire filter expression must be specified as a single argument (which means that if it contains spaces, it must be quoted).
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: -f "predef:MyPredefinedHostOnlyFilter"
Network interface names should match one of the names listed in "dumpcap -D" (described above); a number, as reported by "dumpcap -D", can also be used. If you're using UNIX, "netstat -i" or "ifconfig -a" might also work to list interface names, although not all versions of UNIX support the -a option to ifconfig.
If no interface is specified, Dumpcap 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, Dumpcap 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 pcap format.
This option can occur multiple times. When capturing from multiple interfaces, the capture file will be saved in pcapng format.
Note: the Win32 version of Dumpcap doesn't support capturing from pipes or stdin!
Note that in monitor mode the adapter might disassociate from the network with which it's associated, so that you will not 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 are capturing in monitor mode and are not connected to another network with another adapter.
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.
This option can occur multiple times. If used before the first occurrence of the -i option, no interface will be put into the promiscuous mode. If used after an -i option, the interface specified by the last -i option occurring before this option will not be put into the promiscuous mode.
This option can occur multiple times. If used before the first occurrence of the -i option, it sets the default snapshot length. If 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 is not set specifically, the default snapshot length is used if provided.
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.
This option is only available if we output the captured packets to a single file in pcapng format. Only one capture comment may be set per output file.
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>.
wireshark(1), tshark(1), editcap(1), mergecap(1), capinfos(1), pcap(3), pcap-filter(7) or tcpdump(8)
Dumpcap 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>.
Dumpcap is derived from the Wireshark capturing engine code; see the list of authors in the Wireshark man page for a list of authors of that code.
2022-05-29 | 2.6.20 |