Wireshark Filters

Table of contents

1. Wireshark Filters For Beginners

2. Wireshark Filter Operators

3. Logical Wireshark Filter Operators

4. Interface Filters

5. Link layer traffic

6. Internet layer traffic

7. Transport layer traffic

8. Application layer traffic

9. Filters for Wi-Fi frames


Wireshark Filters For Beginners

Wireshark has a huge variety of different filters. And there is a huge documentation devoted to these filters. This documentation is not easy to understand. I have compiled the most interesting Wireshark Filters for me – for novice users this can become something like a reference for Wireshark filters. By the way, here in the comments you can share filters that you like – I will add them to this list.

Remember that Wireshark has display filters and capture filters. Here I consider the display filters that are entered in the main window of the program in the top field below the menu and icons of the main functions.

To fully understand the importance of filters and their meanings, it is necessary to understand how the network works.

Some filters are written here in a general form, and some are made as literal examples. Remember that in any case you can substitute your data, for example, change the port number to any one of your interest, and also do the same with the IP address, MAC address, time value, etc.

Wireshark Filter Operators

Filters can have different values, for example, it can be a string, a hexadecimal format or a number.

If an inaccurate entry is sought (better suited for non-numeric values) then contains is used. For example, to show TCP packets containing the string hackware you need the following filter:

tcp contains hackware

Operators are used to find exact values. Consider them:

Operator

 Description

==/eq Equals
!=/ne Not equal
</lt Less than
<=/le Less than or equal
>/gt More than
>=/ge Greater than or equal

As you can see, there are two versions, for example, if we want to indicate that the filter value is equal to something, then we can use == or eq.

Filters using logical operands can be used to build rather complex structures, but apparently, usage of the same filter with comparison operators is buggy. For example, as here in an attempt to filter not one port, but the range of ports:

tcp.port>=8000 && tcp.port<=8180

But actually the filter value (in this case, tcp.port) is overwritten by the last value, so as a result, instead of the expected behavior, we get the result of only the last part, in this case it is

tcp.port<=8180

Keep in mind this bug!

When using with == (equal), this bug is missing.

Logical Wireshark Filter Operators

Logical operators allow you to create detailed filters using several conditions at once. It is recommended to use brackets additionally, because otherwise you may not get the result you expect.

Operator Description
AND/&& Logical AND, data is output if they match to both parts of the filter. For example, the ip.src==192.168.1.1 and tcp filter will show only packets that originate from 192.168.1.1 and which are associated with the TCP protocol. Only data matching both conditions will be displayed.
OR/|| Logical OR, it is enough that only one condition is true; if both are true, then this also fine. For example, the tcp.port==80 or tcp.port==8080 filter will show TCP packets that are related (are the source or destination) to port 80 or 8080.
NOT/! Boolean is NOT used when we want to exclude some packages. That is, all packets will be shown, except those that satisfy the condition following the NOT. For example, the filter !dns will show all packets except DNS.

Combination examples:

Show HTTP or DNS traffic:

http or dns

Show all traffic except ARP, ICMP and DNS:

!(arp or icmp or dns)

Interface Filters

Show packets only sent or received on the wlan0 interface:

frame.interface_name == "wlan0"

Link Layer Traffic

To show ARP traffic:

arp

Show ARP protocol frames sent from device with MAC address 00:c0:ca:96:cf:cb:

arp.src.hw_mac == 00:c0:ca:96:cf:cb

Show ARP protocol frames sent from a device with an IP address 192.168.50.90:

arp.src.proto_ipv4 == 192.168.50.90

Show ARP protocol frames sent to a device with a MAC address 00:00:00:00:00:00 (this address is used when the protocol tries to find out the target MAC address. Another popular address that can confuse you is ff:ff:ff:ff:ff:ff, this is broadcast address, that is, messages with this address are for all devices on the local network):

arp.dst.hw_mac == 00:00:00:00:00:00

Show ARP protocol frames sent to the device having the IP address 192.168.50.1:

arp.dst.proto_ipv4 == 192.168.50.1

Show Ethernet traffic:

eth

Show frames (in general, all frames, not just ARP, as it was in the previous examples) sent from a device that has the MAC address 00:c0:ca:96:cf:cb:

eth.src == 00:c0:ca:96:cf:cb

Show frames sent to device with MAC address 78:cd:8e:a6:73:be:

eth.dst == 78:cd:8e:a6:73:be

Internet Layer Traffic

Show IP traffic (this includes TCP, UDP, as well as application layer protocols DNS, HTTP – that is, almost everything except the data link layer protocols that do not use IP addresses for data transmission (in local Ethernet networks they use MAC addresses)):

ip

More precisely, it means IPv4 traffic, which is usually called just IP (Internet Protocol).

Show traffic associated with a specific IP address (enter it instead of x.x.x.x). Packets will be shown in which this IP address is the source of the data OR the recipient:

ip.addr == x.x.x.x

Show traffic associated with these two IP addresses. According to the only possible situation, one of these addresses is the source, and the second is the destination address.

ip.addr == x.x.x.x && ip.addr == y.y.y.y

Show traffic originated from the host with the IP address 138.201.81.199:

ip.src == 138.201.81.199

Show traffic whose destination is the host with the IP address 138.201.81.199:

ip.dst == 138.201.81.199

Please note, IP protocol operates with IP addresses, but does not operate with ports. Ports are part of the TCP and UDP protocols. IP protocol is only responsible for routing traffic between nodes.

Show IPv6 traffic (Internet Protocol version 6):

ipv6

Other filters with an IP address are similar for IPv6 and IPv4.

Transport Layer Traffic

To see only TCP traffic:

tcp

Show traffic whose source or destination port is a specific port, for example, 8080:

tcp.port==8080

Show traffic originating from port 80:

tcp.srcport == 80

Show the traffic that is sent to the service listening on port 80:

tcp.dstport == 80

Show TCP packets with the SYN flag enabled:

tcp.flags.syn==1

Show TCP packets with the SYN flag enabled and the ACK flag disabled:

tcp.flags.syn==1 && tcp.flags.ack==0

Similarly for other flags:

  • SYN
tcp.flags.syn==1
  • ACK
tcp.flags.ack==1
  • RST
tcp.flags.reset==1
  • FIN
tcp.flags.fin==1
  • CWR
tcp.flags.cwr
  • ECE
tcp.flags.ecn
  • URG
tcp.flags.urg==1
  • PSH
tcp.flags.push==1

You can also use syntax like tcp.flags == 0x0XX, for example:

  • FIN is tcp.flags == 0x001
  • SYN is tcp.flags == 0x002
  • RST is tcp.flags == 0x004
  • ACK is tcp.flags == 0x010
  • ACK and FIN set simultaneously is tcp.flags == 0x011
  • ACK and SYN set simultaneously is tcp.flags == 0x012
  • ACK and RST set simultaneously is tcp.flags == 0x014

To show packages containing any string, for example, the hackware string:

tcp contains hackware

Follow TCP stream number X:

tcp.stream eq X

Filter by stream number:

tcp.seq == x

Show transmitted packets. Helps track application performance and packet loss:

tcp.analysis.retransmission

This filter displays problematic packets (lost segments, transmiting, etc.) TCP Keep-Alive packets pass this filter, but they are not an indication of problems.

tcp.analysis.flags

To see only UDP traffic:

udp

Flags are not used for UDP. For this protocol, you can only specify the port.

Show traffic originating from port 53:

udp.srcport == 53

Show the traffic that is sent to the service listening on port 53:

udp.dstport == 53

A UDP packet containing a specific string, for example, a hackware string:

udp contains hackware

To see only ICMP traffic:

icmp

To see only ICMP v6 traffic (sixth version)

icmpv6

Show all answers to ping:

icmp.type==0

Show all ping requests:

icmp.type==8

Show all unreachable/prohibited host and port errors

icmp.type==3

Show all attempts to redirect routing using ICMP:

icmp.type==8

Other ICMP types and CODE options are here: https://www.frozentux.net/iptables-tutorial/iptables-tutorial.html#TCPOPTIONS

An example of using the CODE value, the following filter will show messages about the port unreachable:

icmp.type == 3 && icmp.code == 3

Application layer traffic

For the application protocols of HTTP, DNS, SSH, FTP, SMTP, RDP, SNMP, RTSP, GQUIC, CDP, LLMNR, SSDP there are filters that are called like the protocols themselves, but are written in small letters.

For example, to see HTTP traffic:

http

To see the traffic of the new HTTP/2 protocol:

http2

Remember that when deciding which protocol the transmitted data belongs to, the program considers the used port number. If a non-standard port is used, the program will not be able to find the necessary data. For example, if you connect to SSH on port 1234, the ssh filter will not find SSH traffic.

A filter that shows only the data sent by the POST method:

http.request.method == "POST"

A filter that shows only the data transmitted by the GET method:

http.request.method == "GET"

Search for requests to a specific site (host):

http.host == "<URL>"

Search requests to a specific site by part of the name:

http.host contains "here.particle.name"

To see transmitted cookies:

http.cookie

You can also filter requests that contain a specific HTTP REFERRER header value. For example, to search for queries in which the referrer is ru-board.com:

http.referer contains "ru-board.com"

Search requests with any authorization. Similarly, with the help of contains you can search for certain types of authorization:

http.authorization

Search for files in the HTTP stream:

http.file_data

To see which HTTP data is delayed, use the following construct:

http.time>1

It will show traffic received after 1 second.

To investigate problems, you can analyze the status of HTTP response codes. For example, the following filter will show traffic for which a 404 Not Found error was received (page not found):

http.response.code==404

The following filter is very interesting. Firstly, it shows which complex structures can be built from separate filters. Secondly, it allows you to explore HTTP requests and overall web activity, eliminating unnecessary data. With this filter you can view high level web activity. The rules inside the brackets exclude images, JavaScript files and style sheets — everything embeded the page requests within itself. If the examined pages contain other embedded objects, exclude them in a similar way:

http.request && !(http.request.uri contains ".ico" or http.request.uri contains ".css" or http.request.uri contains ".js" or http.request.uri contains ".gif" or http.request.uri contains ".jpg")

To see all DNS queries and answers:

dns

To see which DNS queries took a lot of time:

dns.time>1

The answers that came more than a second after sending the request will be shown.

This filter shows which dns requests cannot be correctly resolved:

dns.flags.rcode != 0

Show only DNS queries:

dns.flags.response == 0

Show only DNS responses:

dns.flags.response == 1

Show requests and responses in which the IP for google.com is searched:

dns.qry.name == "google.com"

Show DNS requests and responses for A record:

dns.qry.type == 1

Show DNS requests and responses for AAAA records:

dns.qry.type == 28

Show answers in which 216.58.196.3 is sent for the A record as IP:

dns.a == 216.58.196.3

Show replies in which 2a01:4f8:172:1d86::1 sent to the AAAA as IP

dns.aaaa == 2a01:4f8:172:1d86::1

Find certain value (apollo.archlinux.or) of CNAME:

dns.cname == "apollo.archlinux.org"

Show answers longer than 30:

dns.resp.len > 30

Show requests with a length of more than 25:

dns.qry.name.len >25

Show DNS server responses for which recursion is available:

dns.flags.recavail == 1

Show DNS server responses for which recursion is not available:

dns.flags.recavail == 0

Is recursion desirable (if the requested DNS server does not have host name information, should it query other DNS servers for this information):

dns.flags.recdesired == 1

If 1 is set, then recursion is needed, if 0 is set, then it is not desirable.

Whether to accept unauthenticated data (0 means do not accept, 1 means accept):

dns.flags.checkdisable == 0

To see how IP addresses are assigned by DHCP:

udp.dstport==67

Or so:

bootp.option.dhcp

To show DHCP requests:

bootp.option.dhcp == 3

To show DHCP Discover:

bootp.option.dhcp == 1

SMB filter. This filter in the Info column shows the entire tree (ball) of connections, open directories and open files in the trace.

smb2.cmd==3 or smb2.cmd==5

Filters for Wi-Fi frames

Show elements of four-ways handshakes (i.e. EAPOL protocol frames):

eapol

Show Beacon frames:

wlan.fc.type_subtype == 0x08

Show Probe Response frames:

wlan.fc.type_subtype == 0x05

Show all at once: EAPOL, beacons, Probe Response:

wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05 || eapol

Show wireless frames for a specific device with the BSSID MAC address:

wlan.addr==BSSID

Show EAPOL, Beacons, Probe Response for a specific device with a MAC address of 28:28:5D:6C:16:24:

(wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05 || eapol) && wlan.addr==28:28:5D:6C:16:24

Show all PMKID:

eapol && wlan.rsn.ie.pmkid

Show PMKID, Beacons, Probe Response:

(wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05 || (eapol && wlan.rsn.ie.pmkid))

Show PMKID, Beacons, Probe Response for access point with MAC address 40:3D:EC:C2:72:B8:

(wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05 || (eapol && wlan.rsn.ie.pmkid)) && wlan.addr==40:3D:EC:C2:72:B8

Show only the first message of the handshake:

wlan_rsna_eapol.keydes.msgnr == 1

Show only the second message of the handshake (can be used for the handshake Message of any number):

wlan_rsna_eapol.keydes.msgnr == 2

Show frames for access points with a speed (Data Rate) of 1 Mb/s:

wlan_radio.data_rate == 1

Show frames for access points at speeds above 10 Mb/s:

wlan_radio.data_rate > 10

Show access points on a specific frequency:

radiotap.channel.freq == 2412

Show access points with a certain signal level:

wlan_radio.signal_dbm > -50

Filters associated with the presence of an antenna on a device:

radiotap.present.antenna == 1

and

radiotap.antenna == 1

If you know other interesting Wireshark filters, please share them in the comment section.

Recommended for you:

Leave a Reply

Your email address will not be published.

Please consider supporting this blog

Love the stuff I create? Please consider donating to help things rolling faster! miloserdov.org/?p=1460