


























This post is a quick reference for using the display filters in Wireshark. The display filter is used to filter a packet capture file or live traffic, and it is essential to know at least the basics if you want to use Wireshark for troubleshooting and other evaluations.
In this post, I'll focus on the display filters for IPv4 only. Wireshark offers a wide range of tools that are out of this post's scope. IPv6 will be added at some point.
There is no way to list every filter, and I try to concentrate on the most commonly used ones. In general, it is recommended to use the right-click function to add specific protocols/ fields/ values, etc, to the filter.

Nevertheless, a list of all display filters can be found here. I've added links to the specific category to every protocol in the rest of the post.
If you think I forgot something important or want to share more tips, feel free to reach out. I'd appreciate it, and I am happy to learn.
In an attempt to keep it to the basics, I left out topics like functions, variables, macros, arithmetic operators, and some other advanced things. As mentioned before, I'll add IPv6 filters, some more context for when I use certain filters, more topics like OSPF, HTTP/s, and so others, and some more functions.

The capture filter - as the name suggests - is a filter for the capturing of packets itself. With this filter turned on, you can start packet capture, and everything filtered out won't be saved. This is mainly for long packet captures or connections/devices with a lot of traffic helpful, and often enough necessary. Capture filters can have a different syntax and won't be tackled in this post.

The display filter hides filtered packets and is mainly used on already saved packet capture files or live traffic.
Just so you know the difference when you search for more commands.
There are two common ways to save filters. They can then be used in later sessions or help you switch between different filters, especially since certain filters can get very long.


It runs from left to right and can be grouped with parentheses ().
AND:and / &&OR:or / ||NOT:not / !!ip.src == 10.10.10.1 - this would filter out everything with the source IP of 10.10.10.1XOR):xor / ^^(x and !y)or(!x and y)eq / ==ne / !=gt / >lt / <ge / >=le / <=containsmatches / ~The following formats are accepted:
option == 1
option == True
option == TRUE
option == 0
option == False
option == FALSE
smb.path contains r"\\SERVER\SHARE"List of escape sequences:
smb.path contains "\\\\SERVER\\SHARE"
\' single quote
\" double quote
\\ backslash
\a audible bell
\b backspace
\f form feed
\n line feed
\r carriage return
\t horizontal tab
\v vertical tab
\NNN arbitrary octal value
\xNN arbitrary hexadecimal value
\uNNNN Unicode codepoint U+NNNN
\UNNNNNNNN Unicode codepoint U+NNNNNNNN
frame.time >= "Dec 23, 2022 17:00:00" && frame.time <= "Dec 23, 2022 17:05:00"
This filter is a simple time filter. Right-click on frame.time / Arrival time in the frame, and add it to the filter to work with it. Directly right-clicking on the 'time' column and applying the filter won't work since it inserts another format. I bet you can configure this, but I never bothered to try.
If you want to add more filters, simply put the time segment into parentheses, and add the new filter after or before it.
Side note: I am not sure if I am happy with the following format, and I might change it at some point. It is food enough for now, though.
aa-bb-cc-dd-ee-ff # dash delimiteraa:bb:cc:dd:ee:ff # colon delimiteraabb.ccdd.eeff # Cisco styleeth.addr==aa-bb-cc-dd-ee-ff # Source+Destination MAC addresseth.src==aa-bb-cc-dd-ee-ff # Source MAC addresseth.dst==aa-bb-cc-dd-ee-ff # Destination MAC addresseth.vlan.id==1ipip.addr == 10.10.10.10 # source+destination IP addressip.src == 10.10.20.50 # source IP addressip.dst == 10.10.20.50 # destination IP addressSide note: You can filter whole subnets with CIDR notation like 10.10.20.0/24 too.
ip.ttl == 64ICMP:icmpicmp.type == 8icmp.type == 0arp.dst.hw_mac arp.src.hw arp.dst.proto_ipv4 arp.src.proto_ipv4 tcptcp.port == 53 # source+destination TCP porttcp.srcport == 68 # source TCP porttcp.dstport == 68 # destination TCP portSide note: filtering 'TCP streams' is helpful, but it is easier to right click on the TCP segment, and filter there instead of tpying in a filter.
tcp.analysis.flags && !tcp.analysis.window_update((tcp.flags == 0x02) || (tcp.flags == 0x12) ) || ((tcp.flags == 0x10) && (tcp.ack==1) && (tcp.len==0))tcp.flags.reset==1udpudp.port == 53 # source+destination UDP portudp.srcport == 68 # source UDP portudp.dstport == 68 # destination UDP portdhcpdhcp.option.dhcp == 1 # Discoverdhcp.option.dhcp == 2 # Offerdhcp.option.dhcp == 3 # Requestdhcp.option.dhcp == 5 # Discoverhostname:dhcp.option.hostname == "pleasejustwork"dhcp.option.type == 3 # Search for a specific option numberdhcp.option.dhcp_server_id == 10.10.20.1 # Option: (54) DHCP Server Identifierdhcp.option.type == 51 # Option: (51) IP Address Lease Timedhcp.option.subnet_mask == 255.255.255.0 # Option: (1) Subnet Mask (255.255.255.0)dhcp.option.router == 10.10.20.1 # Option: (3) Routerdhcp.option.domain_name_server == 9.9.9.9 # Option: (6) Domain Name Server(dhcp.hw.mac_addr == aa:bb:cc:dd:ee:ff) && (dhcp.option.dhcp == 1)(eth.src == aa:bb:cc:dd:ee:ff) && (dhcp.option.dhcp == 1)dhcp && !dhcp.option.dhcp == 1 && !dhcp.option.dhcp_server_id == 10.10.20.1 (udp.dstport == 68) && !(dhcp.option.dhcp_server_id == 10.10.20.1)dhcp.option.dhcp == 2 && !(dhcp.option.domain_name_server == 9.9.9.9) && !(dhcp.option.domain_name_server == 149.112.112.112)dnsdns.flags.response == 0dns.flags.response == 1dns.qry.name == "ittavern.com" # Discoverdns.qry.type == 1 # A recorddns.qry.type == 28 # AAAA recorddns.qry.type == 16 # txt recorddns.qry.type == 5 # CNAME recorddns.qry.type == 33 # srv recorddns.qry.type == 15 # MX recorddns.qry.type == 2 # NS recorddns.a == 94.130.76.189 # answer of a A recorddns.txt == "v=spf1 include:spf.protection.outlook.com -all" # answer of a TXT record request(ip.dst == 10.64.0.1) && (dns)dns && (ip.dst==10.10.20.1 or ip.src==10.10.20.1)dns.flags.rcode == 0 && dns.time > .3 # might needs some fine tuning depending on the envdns.flags.rcode != 0 此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。