Command-line packet analyzer for capturing, filtering, decoding, and exporting live or saved network traffic.
$brew install wireshark
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
TShark is Wireshark's command-line packet analyzer for live captures and saved trace files. It exposes Wireshark's dissectors and filtering engine through flags, stdout, and capture files that fit shell-driven network debugging.
What It Enables
- Capture traffic on chosen interfaces, apply capture or display filters, and write rolling
pcaporpcapngfiles for incident evidence and later analysis. - Read saved or compressed traces, print packet summaries or full protocol trees, and extract selected fields or statistics from network traffic.
- Export decoded packets as JSON, raw-packet JSON, EK NDJSON, CSV-like field output, or XML for downstream parsing, Elasticsearch ingest, or follow-up tooling.
Agent Fit
- Real machine-readable output exists through
-T json,jsonraw,ek, andfields, with-jor-Jprotocol filters and--no-duplicate-keysto narrow or normalize output. - Non-interactive flags,
-lline buffering, interface and link-type discovery, and documented exit codes make it workable in inspect, capture, and verify loops. - Live capture still needs permissions and network-specific judgment, and decoded output can be large enough that agents usually need tight filters or a capture-first workflow.
Caveats
- Live capture depends on
dumpcapprivileges or access to capture devices; the README explicitly discourages runningtsharkitself as root. - Verbose decode and JSON modes can explode in size on busy traces, so automation is usually safer when it saves captures first and re-reads them with narrower filters.