4 min read

Packet Filter Cheat Sheet: Display Filters and BPF

Filters are the efficiency core of packet analysis. This article compiles a cheat sheet of commonly used filter expressions organized by protocol — Wireshark display filters and tcpdump BPF syntax side by side — and shows how to achieve the same filtering in PcapDecoder with zero syntax overhead.

Packet Filter Cheat Sheet: Display Filters and BPF
SummaryKey Points
  • Two syntaxes: Wireshark display filters (post-dissection fields) and tcpdump BPF (capture-time filtering)
  • The highest-frequency filters: IP, ports, protocols, flags, and content — five categories
  • Logical combinations: and/or/not with parentheses to assemble complex conditions in seconds
  • PcapDecoder click-to-filter: click a protocol, host, or conversation to filter instantly — no syntax to memorize

Two Kinds of Filters — Don't Mix Them Up

BPF (Berkeley Packet Filter): the capture-time filter used by tcpdump. It runs in kernel space, with simple syntax but limited capability (host, port, tcp, and the like).

Display Filter: the post-dissection filter used by Wireshark. It runs in user space and can filter on any protocol field (http.request.uri contains "admin", for example).

The difference in one sentence: BPF decides "what to capture"; display filters decide "what to view". This article focuses on display filters, with BPF equivalents noted alongside.

Five Categories of High-Frequency Expressions

1. By Address and Port

GoalDisplay filterBPF equivalent
A specific IPip.addr == 10.0.0.5host 10.0.0.5
Source/destination onlyip.src == 10.0.0.5src host 10.0.0.5
A specific subnetip.addr matches "^10\.0\."net 10.0.0.0/24
A specific porttcp.port == 443port 443
Port rangetcp.port >= 8000 && tcp.port <= 9000portrange 8000-9000
Exclude a port!(tcp.port == 22)not port 22

2. By Protocol

GoalFilter
A specific protocol onlydns / http / tls / quic / sip / rtp
Protocol variantshttp.request / http.response
Protocol anomaliesicmp.type == 3 (destination unreachable)
Exclude background protocols!(arp or dns or icmp)

3. By TCP State (the Core of Troubleshooting)

GoalFilter
All retransmissionstcp.analysis.retransmission
Duplicate ACKstcp.analysis.duplicate_ack
Out of ordertcp.analysis.out_of_order
Zero windowtcp.analysis.zero_window
Connection resettcp.flags.reset == 1
Handshake onlytcp.flags.syn == 1 && tcp.flags.ack == 0
Fast opentcp.flags.syn == 1 && tcp.flags.ack == 1

4. By Content

GoalFilter
Keyword in a URLhttp.request.uri contains "login"
Keyword in a domain namedns.qry.name contains "evil"
Keyword in the SNItls.handshake.extensions_server_name contains "bank"
Password field in a formhttp.request.method == "POST" && http contains "password"
Email bodysmtp.req.parameter contains "@"

5. By Size and Time

GoalFilter
Large packetsframe.len > 1400
Small packetsframe.len < 100
A specific time periodframe.time >= "2026-10-13 14:00:00"
Capture duration statisticsStatistics → I/O Graphs (menu item, not an expression)

Logical Combinations and Practical Templates

Combination rules: and or not (or && || !) plus parentheses to control precedence.

Practical template library (copy and use):

# 1. All HTTPS connections for a host (the SNI tells you who it connected to)
ip.addr == 10.0.0.5 && tls.handshake.type == 1

# 2. Failed login POST requests (password errors are distinguished by the response code)
http.request.method == "POST" && http.response.code >= 400

# 3. Suspected DNS tunneling: queries with overly long subdomains
dns.qry.name matches ".{30,}"

# 4. Callback heartbeat from an IP (Beacon pre-filter)
ip.addr == 203.0.113.10 && frame.time_delta < 1

# 5. Cleartext password traffic
ftp.request.command == "PASS" || http contains "password="

# 6. Connected but no data (suspicious outbound)
tcp.flags.syn == 1 && tcp.flags.ack == 0 && ip.addr == 10.0.0.5

PcapDecoder's Zero-Syntax Filtering

Syntax is a tool, not the goal. PcapDecoder's design philosophy: everyday filters shouldn't require memorizing syntax.

Click-to-filter: in the dashboard, protocol cards, or conversation list, click any IP / domain / port / conversation to filter on it directly — one click equals writing an ip.addr == x.

!Packet list

Protocol cards are filters: the DNS, HTTP, and TLS cards are themselves "all packets related to this protocol" — viewing a card is equivalent to completing a dns / http / tls filter.

Security conclusions are filters: suspicious items hit by the deep scan, or events on the attack timeline, jump straight to the corresponding evidence packets with one click — from "conclusion" to "evidence" in one step, while the reverse — sifting conclusions out of the full data set — is left to the engine.

When do you actually need syntax: when you genuinely have complex conditions ("host A's HTTPS connections to domain B after 3 PM"), PcapDecoder's filter bar also supports full expression input. But for 80% of everyday scenarios, clicking is enough.


Next up: VoIP Call Analysis: A How-to, or head back to What Is a PCAP File? to start from the beginning.

FiltersWiresharktcpdumpBPFCheat Sheet
Share
Back to home