Performing Network Traffic Analysis with TShark
Overview
This skill automates packet capture analysis using tshark (Wireshark CLI) and pyshark (Python wrapper). It extracts protocol distribution statistics, identifies suspicious network flows (port scans, beaconing, data exfiltration), extracts IOCs (IPs, domains, URLs), and detects DNS tunneling patterns from PCAP files.
Prerequisites
- tshark (Wireshark CLI) installed and in PATH
- Python 3.8+ with pyshark library
- PCAP or PCAPNG capture file for analysis
Steps
-
Extract Protocol Statistics — Generate protocol hierarchy and conversation statistics from the capture
-
Identify Top Talkers — Rank source/destination IPs by volume and connection count
-
Detect Suspicious Flows — Flag port scanning patterns, unusual port usage, and high-frequency connections
-
Extract Network IOCs — Pull unique IPs, domains from DNS queries, and URLs from HTTP traffic
-
Analyze DNS Traffic — Detect DNS tunneling via high-entropy subdomain queries and excessive TXT records
-
Generate Analysis Report — Produce structured report with flow summaries and threat indicators
Expected Output
- JSON report with protocol statistics and top talkers
- Suspicious flow detections with severity ratings
- Extracted IOCs (IPs, domains, URLs)
- DNS anomaly analysis results