Utilities
Filter a saved packet capture with BPF
tcpdump-filter is a saved-packet filter that returns PCAP through native tcpdump.
overview
What tcpdump-filter does
Filter a local packet capture with a BPF expression and return a PCAP file. Reads saved packets only; no live capture, commands or post-processing hooks are exposed.
Read a supplied capture with tcpdump 4.99.3 and write matching packets to a new PCAP file. Omitting filter keeps every packet. A valid filter with no matches returns a successful header-only PCAP. No interface selection, live capture, rotation or command hooks are exposed.
Input is limited to 100 MiB, the filter expression to 4096 bytes and native execution to 60 seconds. The expression is one argv value after --, never shell code. -n disables output name resolution, but hostnames inside a BPF expression can still trigger resolver lookups. Use numeric addresses and ports for reproducible offline filtering. Invalid captures or filters fail without partial output; symlinks and existing outputs are rejected.
Packaged version: 4.99.3-deb12. Upstream license: BSD-3-Clause.
source github.com/the-tcpdump-group/tcpdump/tree/032e4923e5202ea4d5a6d1cead83ed1927135874
use cases
Where tcpdump-filter fits
Select packets by port
Keep packets matching a numeric BPF port expression.
Reduce a saved capture
Pass the filtered PCAP artifact to a separate analysis tool.
Handle zero matches explicitly
Receive a valid header-only PCAP when a valid filter selects nothing.
reference
tcpdump-filter inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | --input | Local PCAP or supported PCAPNG file, at most 100 MiB. |
| filter | STRING | --filter | Optional BPF expression, for example udp dst port 45678. Omit to retain all packets. Use numeric addresses for offline reproducibility. |
Showing key inputs. tcpdump-filter exposes 2 inputs in total.
example
Run tcpdump-filter
python3 /app/run.py --input ./input.txt --filter "udp dst port 45678" ./outputguidance
Choosing tcpdump-filter
Use tcpdump-filter to reduce an existing capture before another analysis stage. The saved fixture covers Ethernet PCAP. PCAPNG support depends on the installed libpcap and supported link types; this node does not collect new traffic or provide arbitrary tcpdump flags.
faq
tcpdump-filter questions
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
Run tcpdump-filter yourself
The saved verifier parsed two synthetic input packets and confirmed exactly one output packet, destination port 45678, its addresses, timestamp and payload. These are verifier-confirmed packet properties; no native packet dump is invented here. The command shows the container entrypoint with example paths.
Facts on this page come from the live Trickest tool library.