tcpdump
$ tcpdump Foundation High Risktcpdump captures and decodes network packets matching Berkeley Packet Filter (BPF) expressions (tcpdump -i any -nn port 443 -w cap.pcap). While live interface capture requires elevated privileges, offline .pcap inspection (tcpdump -r cap.pcap -nn -c 20) runs unprivileged, fast, and non-interactively.
brew install tcpdump Reads local .pcap files and kernel BPF capture interfaces directly (tcpdump -r, tcpdump -c); MCP tools cannot inspect kernel packet streams.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
tcpdump version 4.99.1 -- Apple version 161 libpcap version 1.10.1 LibreSSL 3.3.6 Usage: tcpdump [-AbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ] [--count] [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ] [ -i interface ] [ --immediate-mode ] [ -j tstamptype ] [ -M secret ] [ --number ] [ --print ] [ -Q in|out|inout|out|packet-metadata-filter ] [ -r file ] [ -s snaplen ] [ -T type ] [ --version ] [ -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ] [ --time-stamp-precision precision ] [ --micro ] [ --nano ] [ -z postrotate-command ] [ -Z user ] [ expression ] [ --apple-oneline] [ -g ] [ --apple-md-print (metadata_arg)] [ -k (metadata_arg)] [ --apple-pcapng] [ -P ] [ --apple-md-filter meta-data-expression] [ -Q meta-data-expression ] [ --apple-ext-fmt n ] [--apple-arp-plain] [ --apple-compression n ] [--apple-truncate] [--apple-pktapv2 ] [ --apple-head-drop ]
FCRS-1.0 6-Dimension Breakdown
Deterministic BPF filtering, bounded -c <N> packet count, -nn clean numeric output, and -l line buffering, though output is plain text rather than JSON.
-c <N>bounds capture count;-nnsuppresses DNS noise- Plain-text packet summaries; use
tshark -T jsonfor JSON
Offline -r reading is safe and unprivileged, but live capture requires root/sudo and exposes raw unencrypted payloads or secrets on the wire.
- Live capture needs root/BPF access and captures sensitive traffic
Pre-installed on macOS (/usr/sbin/tcpdump) and nearly all Linux distributions; Windows requires separate WinDump/Npcap.
- Built into macOS and standard Linux distros
Low-overhead standard for fast packet capture and BPF filtering prior to deeper tshark inspection.
- Minimal CPU/memory footprint with kernel-level BPF filtering
Maintained by The Tcpdump Group (the-tcpdump-group/tcpdump) under BSD-3-Clause.
- Foundation-grade
the-tcpdump-group/tcpdumprepo
Canonical tcpdump(1) and pcap-filter(7) man pages plus --help.
- Official man pages at tcpdump.org
Security, Auth & Guardrails
No authentication credentials required; live packet capture requires root/sudo or BPF device permissions.
Free, BSD-3-Clause open-source C tool maintained by The Tcpdump Group.
# tcpdump Agent Rules - Always pass `-c <count>` and `-nn` on live or offline runs so `tcpdump` terminates cleanly without slow DNS lookups. - Use `tcpdump -r <file>` unprivileged for analysis; only invoke `sudo tcpdump` for live capture with explicit user approval and tight BPF filters.
Agent-Ready Command Recipes
Safe Read-Only Queries
tcpdump -r cap.pcap -nn -c 20
Reads cap.pcap without root privileges (-r), disables DNS/port name resolution (-nn), and stops after 20 packets (-c 20).
tcpdump -D
Prints network interface names and indices recognized by libpcap.
Controlled Writes & Previews
sudo tcpdump -i lo0 -nn -c 50 port 443 -w cap.pcap
Captures exactly 50 packets (-c 50) on loopback port 443 and writes them to cap.pcap.
Strengths for Agents
- + Pre-installed on macOS and almost every Linux host with minimal overhead.
- +
-c <N> -nnmakes bounded capture and offline.pcapinspection fast and deterministic.
Caveats & Pitfalls
- ! No JSON output—pair with
tshark -r cap.pcap -T jsonwhen structured dissection is needed. - ! Live packet sniffing requires
sudoor BPF/network capture privileges.