Professional Documents
Culture Documents
Wireshark Capture Filters
Wireshark Capture Filters
Wireshark Capture Filters
1. CAPTURE FILTERS
The capture filter syntax is the same as the one used by programs using the Lipcap (Linux) or
Winpcap (Windows) library like the famous TCPdump. The capture filter must be set before
launching the Wiershark capture, which is not the case for the display filters that can be
modified at any time during the capture.
Protocol:
Values: ether, fddi, ip, arp, rarp, decnet, lat, sca, moprc, mopdl, tcp and udp.
If no protocol is specified, all the protocols are used.
Direction:
Values: src, dst, src and dst, src or dst
If no source or destination is specified, the "src or dst" keywords are applied.
For example, "host 10.2.2.2" is equivalent to "src or dst host 10.2.2.2".
Host(s):
Values: net, port, host, portrange.
If no host(s) is specified, the "host" keyword is used.
For example, "src 10.1.1.1" is equivalent to "src host 10.1.1.1".
Logical Operations:
Values: not, and, or.
Negation ("not") has highest precedence. Alternation ("or") and concatenation ("and")
have equal precedence and associate left to right.
For example,
"not tcp port 3128 and tcp port 23" is equivalent to "(not tcp port 3128) and tcp port 23".
"not tcp port 3128 and tcp port 23" is NOT equivalent to "not (tcp port 3128 and tcp port
23)".
Examples:
host 10.1.2.3
Displays packets with source UDP or TCP ports in the 2000-2500 range.
not imcp
Displays everything except icmp packets. (icmp is typically used by the Ping tool)
Displays packets with source IP address equals to 10.7.2.12 and in the same time not with the
destination IP network 10.200.0.0/16.
(src host 10.4.1.12 or src net 10.6.0.0/16) and tcp dst portrange 200-10000 and dst net
10.0.0.0/8
Displays packets with source IP address 10.4.1.12 or source network 10.6.0.0/16, the result is
then concatenated with packets having destination TCP portrange from 200 to 10000 and
destination IP network 10.0.0.0/8.
Notes:
The "multicast" and "broadcast" keywords can also be used after "ip" or "ether".
"no broadcast" is useful when you want to exclude broadcast requests.
Check the TCPdump man page for information about the capture filters syntax.
Other capture filters examples can be found in the Wiki Wireshark website.
2. DISPLAY FILTERS:
The display filter is used to search inside captured data obtained with a capture filter.
Its search capabilities are more extended than those of the capture filter and it is not
necessary to restart the capture when you need to change your filter.
Logical Other
Protoco String Strin Compariso
Syntax: . . Value Operation expressio
l 1 g 2 n operator
s n
Exampl passiv 10.2.3.
ftp ip == xor icmp.type
e: e 4
Protocol:
A large number of protocols, located between layers two and seven of the OSI model, is
available. They can be seen when you click on the "Expression..." button in the main screen.
Some examples are: IP,TCP,DNS,SSH
Supported protocols with a little description can also be consulted as indicated below:
The Wireshark website provides explanations about protocols and their sub categories.
Logical expressions:
Example:
Displays the packets with a source IP address different from 10.1.2.3 or with a destination IP
different from 10.4.5.6.
In other words, the displayed packets will have:
Source IP address: anything but 10.1.2.3, destination IP address: anything
and
Source IP address: anything, destination IP address: anything but 10.4.5.6
Displays the packets with source IP different from 10.1.2.3 and in the same time with
destination IP different from 10.4.5.6
In other words, the displayed packets will have:
Source IP address: anything but 10.1.2.3 and destination IP address: anything but 10.4.5.6
If the filter syntax is correct, it will be highlighted in green, otherwise if there is a syntax
mistake it will be highlighted in red.
Correct syntax
Wrong snythax