performing-network-traffic-analysis-with-tshark skill (Anthropic-Cybersecurity-Skills)
What it does. Automate network traffic analysis using tshark (Wireshark CLI) and pyshark to compute protocol distribution statistics, detect suspicious flows such as port scans and beaconing, extract IOCs (IPs, domains, URLs), and identify DNS tunneling patterns from PCAP files. Use when scripted or repeatable analysis of packet captures is needed rather than interactive inspection. Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).
| Upstream | mukul975/Anthropic-Cybersecurity-Skills |
| Skill file | skills/performing-network-traffic-analysis-with-tshark/SKILL.md |
| License | Apache-2.0 (skill folder LICENSE) |
| Author | mukul975 |
| Fetched | 2026-09-10 |
Install
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-network-traffic-analysis-with-tshark, or copy the skill folder into~/.claude/skills/performing-network-traffic-analysis-with-tshark/.- Raw file:
curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/performing-network-traffic-analysis-with-tshark/SKILL.md
SKILL.md (verbatim)
name: performing-network-traffic-analysis-with-tshark
description: Automate network traffic analysis using tshark (Wireshark CLI) and pyshark to compute protocol distribution statistics, detect suspicious flows such as port scans and beaconing, extract IOCs (IPs, domains, URLs), and identify DNS tunneling patterns from PCAP files. Use when scripted or repeatable analysis of packet captures is needed rather than interactive inspection.
domain: cybersecurity
subdomain: network-security
tags:
- tshark
- pyshark
- pcap
- packet-analysis
- network-forensics
- wireshark
- traffic-analysis
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.IR-01
- DE.CM-01
- ID.AM-03
- PR.DS-02
mitre_attack:
- T1046
- T1040
- T1557
- T1071
- T1005
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.
When to Use
- When conducting security assessments that involve performing network traffic analysis with tshark
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
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
Other files in this skill
references/api-reference.md (verbatim)
Network Traffic Analysis with TShark API Reference
TShark CLI Commands
# Protocol hierarchy statistics
tshark -r capture.pcap -q -z io,phs
# IP conversations
tshark -r capture.pcap -q -z conv,ip
# TCP conversations
tshark -r capture.pcap -q -z conv,tcp
# Extract specific fields
tshark -r capture.pcap -T fields -e ip.src -e ip.dst -e tcp.dstport
# DNS query extraction
tshark -r capture.pcap -Y "dns.qry.name" -T fields -e dns.qry.name -e dns.qry.type
# HTTP requests
tshark -r capture.pcap -Y "http.request" -T fields -e http.host -e http.request.uri
# SYN-only packets (port scan detection)
tshark -r capture.pcap -Y "tcp.flags.syn==1 && tcp.flags.ack==0" \
-T fields -e ip.src -e ip.dst -e tcp.dstport
# Follow TCP stream
tshark -r capture.pcap -z follow,tcp,ascii,0
# Export objects (HTTP files)
tshark -r capture.pcap --export-objects http,/tmp/exported/
# Read live capture
tshark -i eth0 -c 1000 -w output.pcap
PyShark Python API
import pyshark
# Read PCAP file
cap = pyshark.FileCapture("capture.pcap")
for pkt in cap:
print(pkt.ip.src, pkt.ip.dst)
# Live capture with display filter
cap = pyshark.LiveCapture(interface="eth0", display_filter="http")
cap.sniff(timeout=30)
# Access packet layers
for pkt in cap:
if hasattr(pkt, "dns"):
print(pkt.dns.qry_name)
if hasattr(pkt, "http"):
print(pkt.http.host, pkt.http.request_uri)
# BPF capture filter
cap = pyshark.LiveCapture(interface="eth0", bpf_filter="port 53")
Common Display Filters
| Filter | Purpose |
|---|---|
dns.qry.name |
DNS queries |
http.request |
HTTP requests |
tcp.flags.syn==1 && tcp.flags.ack==0 |
SYN scans |
tls.handshake.type==1 |
TLS Client Hello |
ip.addr==10.0.0.1 |
Traffic to/from IP |
tcp.analysis.retransmission |
Retransmissions |
frame.len > 1400 |
Large frames |
Output Formats
# JSON output
tshark -r capture.pcap -T json > output.json
# CSV-style fields
tshark -r capture.pcap -T fields -E separator=, -e ip.src -e ip.dst
# PDML (XML)
tshark -r capture.pcap -T pdml > output.xml
Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.