Skip to content

Commit 2bfde6c

Browse files
committed
refactor: consolidate protocol analysis and add tool profiles
1 parent 3ae1ae6 commit 2bfde6c

59 files changed

Lines changed: 1572 additions & 2502 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub Copilot Repository Instructions
22

3-
For packet capture, protocol analysis, network forensics, incident response, and troubleshooting tasks, prefer the project skill in `.github/skills/wireshark-traffic-analysis/`.
3+
For packet capture, protocol analysis, network security monitoring, incident response, and troubleshooting tasks, prefer the project skill in `.github/skills/wireshark-traffic-analysis/`.
44

55
Use the skill to:
66

.github/prompts/wireshark-traffic-analysis.prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Use the `wireshark-traffic-analysis` project skill in this repository to investi
33
Inputs:
44

55
- Capture path: `${input:capture_path:Path to the pcap or pcapng file}`
6-
- Goal: `${input:goal:triage | security | incident-response | troubleshoot | ctf}`
6+
- Goal: `${input:goal:triage | security | incident-response | troubleshoot}`
77
- Optional scope: `${input:scope:Suspicious host, protocol, time window, domain, stream, or symptom}`
88

99
Requirements:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ htmlcov/
2020
# Runtime caches
2121
.mcpregistry_*
2222
.claude/worktrees/
23+
.codex_resume_work/
2324

2425
# OS metadata
2526
.DS_Store

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ Use it for:
77
- `pcap` and `pcapng` analysis
88
- security hunting and incident response
99
- network troubleshooting
10-
- CTF and forensics-style packet work
1110

1211
Prefer the skill playbooks, evidence rubric, and report template over ad hoc analysis.

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,57 @@ Point your AI client at a `.pcap` file and try:
7070

7171
```
7272
Analyze capture.pcap using the Wireshark MCP tools.
73-
Start with wireshark_open_file, then run wireshark_security_audit.
73+
Start with wireshark_open_file, then run wireshark_quick_analysis.
7474
Write findings to report.md.
7575
```
7676

7777
---
7878

7979
## Tools
8080

81-
80+ tools, each backed by real `tshark` output — organized into categories:
81+
51 tools, each backed by real `tshark` output — organized into categories:
8282

8383
| Category | Highlights | Count |
8484
|----------|-----------|:-----:|
85-
| **Entry & Workflow** | `wireshark_open_file`, `wireshark_quick_analysis`, `wireshark_security_audit` | 3 |
86-
| **Packet Analysis** | Packet list, details, bytes, context, stream follow, search | 8 |
87-
| **Data Extraction** | HTTP requests, DNS queries, TLS handshakes, credentials, fields | 11 |
88-
| **Statistics** | Protocol hierarchy, endpoints, conversations, I/O graph, HTTP/SMB/RTP stats, plots | 13 |
89-
| **Security & Threat** | Credential scan, port scan, DNS tunnel, DoS, beaconing, exfiltration | 12 |
90-
| **Protocol Deep-Dive** | TCP health, QUIC, WebSocket, gRPC, MQTT, TLS/WPA decrypt, fingerprints | 11 |
91-
| **ICS / IoT / Wireless** | Modbus, S7comm, DNP3, CoAP, Zigbee, BLE, Wi-Fi, WireGuard | 8 |
92-
| **Forensics & Decode** | File carving, evidence chain, YARA scan, payload decode, GeoIP | 8 |
93-
| **File Ops, Capture & Suite** | Live capture, merge, filter-save, editcap trim/split/dedup, text2pcap | 11 |
85+
| **Entry & Workflow** | `wireshark_open_file`, `wireshark_quick_analysis` | 2 |
86+
| **Packet Analysis** | Packet list, details, bytes, context, stream follow, search, file info | 8 |
87+
| **Data Extraction** | HTTP requests, DNS queries, arbitrary fields, object export | 4 |
88+
| **Statistics** | Protocol hierarchy, endpoints, conversations, I/O graph, expert info, service response time, flow graph | 7 |
89+
| **Security & Anomaly** | Credential scan, port scan, DNS tunnel, DoS, beaconing, exfiltration, protocol anomalies, YARA | 8 |
90+
| **Protocol Analysis** | `wireshark_analyze_protocol` (20 protocols), TCP health, ARP spoofing | 3 |
91+
| **Decrypt & Dissection** | TLS/WPA decrypt, decryption check, decode-as, protocol preferences | 5 |
92+
| **Forensics & Enrichment** | TLS fingerprints, file signature scan, GeoIP | 3 |
93+
| **File Ops, Capture & Suite** | Live capture, interfaces, merge, filter-save, editcap trim/split/dedup/time-shift, frame extract, text2pcap, capabilities | 11 |
94+
95+
One tool covers 20 protocols rather than 20 tools covering one each: `wireshark_analyze_protocol` takes a `protocol` argument (`tls_handshakes`, `mqtt`, `modbus`, `s7comm`, `zigbee`, `wifi`, `rtp`, `kerberos`, …) and applies the right fields and display filter for it. The field names are the point — `s7comm.param.item.dbnum` is not something a caller should have to guess, and a wrong guess returns an empty result that reads like a clean capture.
9496

9597
The server starts with only `tshark` required. Optional tools (`capinfos`, `mergecap`, `editcap`, `dumpcap`, `text2pcap`) are auto-detected and enable extra features when present.
9698

9799
### Context cost
98100

99-
The tool list travels in the prompt prefix of every request your client sends, so its size is a fixed per-request cost. The advertised surface is ~27 KB (~6.9k tokens) of schema plus ~5 KB of annotations, and it is byte-identical across restarts so clients can cache the prefix rather than re-reading it each session.
101+
The tool list travels in the prompt prefix of every request your client sends, so its size is a fixed per-request cost. The default surface is ~21 KB — about 9 KB of parameter schema, 5 KB of descriptions, and 3 KB of read/write annotations — and it is byte-identical across restarts so clients can cache the prefix rather than re-reading it each session.
102+
103+
If your client never captures live traffic or writes pcaps, `--profile` advertises less:
104+
105+
| Profile | Tools | Payload | Drops |
106+
|---------|:-----:|:-------:|-------|
107+
| `full` (default) | 51 | ~21 KB | nothing |
108+
| `analysis` | 41 | ~17 KB | live capture, interface listing, all file-writing tools |
109+
| `core` | 33 | ~14 KB | the above, plus decryption, dissection overrides, and low-level views |
110+
111+
```bash
112+
wireshark-mcp serve --profile core
113+
```
114+
115+
Every profile still contains every tool the bundled prompts, resources, skill files, and protocol recommendations can point the model at, so reducing the surface never leaves it chasing a tool that is not there.
100116

101117
Tool results are bounded too, since a result stays in the conversation for the rest of the session. Output over 8000 characters is truncated head-and-tail with a marker, and the tool's `offset` / `limit` / `display_filter` parameters are the way to page through the rest. Raise or lower the ceiling with:
102118

103119
```bash
104120
export WIRESHARK_MCP_MAX_RESULT_CHARS=16000
105121
```
106122

107-
Every tool also declares whether it reads or writes, so clients can auto-approve the 74 read-only analysis tools and still prompt for the 11 that create files (live capture, merge, filter-save, editcap, text2pcap, object export).
123+
Every tool also declares whether it reads or writes, so clients can auto-approve the 40 read-only analysis tools and still prompt for the 11 that create files (live capture, merge, filter-save, editcap, text2pcap, frame extract, object export).
108124

109125
---
110126

README_zh.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,57 @@ wireshark-mcp install # 自动配置所有检测到的 MCP 客户端
7070

7171
```
7272
使用 Wireshark MCP 工具分析 capture.pcap。
73-
先用 wireshark_open_file 打开,然后运行 wireshark_security_audit
73+
先用 wireshark_open_file 打开,然后运行 wireshark_quick_analysis
7474
将发现写入 report.md。
7575
```
7676

7777
---
7878

7979
## 工具
8080

81-
80+ 工具,每个都由真实 `tshark` 输出支撑,按类别组织:
81+
51 个工具,每个都由真实 `tshark` 输出支撑,按类别组织:
8282

8383
| 类别 | 亮点 | 数量 |
8484
|------|------|:----:|
85-
| **入口与工作流** | `wireshark_open_file``wireshark_quick_analysis``wireshark_security_audit` | 3 |
86-
| **数据包分析** | 数据包列表、详情、字节、上下文、流追踪、搜索 | 8 |
87-
| **数据提取** | HTTP 请求、DNS 查询、TLS 握手、凭据、字段提取 | 11 |
88-
| **统计** | 协议层次、端点、会话、I/O 图、HTTP/SMB/RTP 统计、绘图 | 13 |
89-
| **安全与威胁** | 凭据扫描、端口扫描、DNS 隧道、DoS、信标、外泄 | 12 |
90-
| **协议深入** | TCP 健康、QUIC、WebSocket、gRPC、MQTT、TLS/WPA 解密、指纹 | 11 |
91-
| **工控/物联网/无线** | Modbus、S7comm、DNP3、CoAP、Zigbee、BLE、Wi-Fi、WireGuard | 8 |
92-
| **取证与解码** | 文件雕刻、证据链、YARA 扫描、载荷解码、GeoIP | 8 |
93-
| **文件操作、抓包与套件** | 实时抓包、合并、过滤保存、editcap 裁剪/分割/去重、text2pcap | 11 |
85+
| **入口与工作流** | `wireshark_open_file``wireshark_quick_analysis` | 2 |
86+
| **数据包分析** | 数据包列表、详情、字节、上下文、流追踪、搜索、文件信息 | 8 |
87+
| **数据提取** | HTTP 请求、DNS 查询、任意字段提取、对象导出 | 4 |
88+
| **统计** | 协议层次、端点、会话、I/O 图、专家信息、服务响应时间、流图 | 7 |
89+
| **安全与异常** | 凭据扫描、端口扫描、DNS 隧道、DoS、信标、外泄、协议异常、YARA | 8 |
90+
| **协议分析** | `wireshark_analyze_protocol`(20 种协议)、TCP 健康、ARP 欺骗 | 3 |
91+
| **解密与解析** | TLS/WPA 解密、解密校验、decode-as、协议偏好设置 | 5 |
92+
| **取证与富化** | TLS 指纹、文件特征扫描、GeoIP | 3 |
93+
| **文件操作、抓包与套件** | 实时抓包、接口列表、合并、过滤保存、editcap 裁剪/分割/去重/时移、帧提取、text2pcap、能力查询 | 11 |
94+
95+
20 种协议由一个工具覆盖,而不是 20 个工具各覆盖一种:`wireshark_analyze_protocol` 接受 `protocol` 参数(`tls_handshakes``mqtt``modbus``s7comm``zigbee``wifi``rtp``kerberos` 等),并为其套用正确的字段与显示过滤器。字段名正是关键——`s7comm.param.item.dbnum` 不该由调用方去猜,而猜错时返回的空结果看起来和"干净的流量"没有区别。
9496

9597
服务器仅需 `tshark` 即可启动。可选工具(`capinfos``mergecap``editcap``dumpcap``text2pcap`)自动检测,存在时启用额外功能。
9698

9799
### 上下文开销
98100

99-
工具列表会随客户端的每一次请求进入 prompt 前缀,因此它的体积是每请求的固定成本。当前对外暴露的表面约为 27 KB(约 6.9k tokens)的 schema,加上约 5 KB 的 annotations;并且它在重启之间逐字节一致,客户端可以缓存该前缀,而不必每个会话重新读取。
101+
工具列表会随客户端的每一次请求进入 prompt 前缀,因此它的体积是每请求的固定成本。默认表面约为 21 KB——其中参数 schema 约 9 KB、描述约 5 KB、读写 annotations 约 3 KB;并且它在重启之间逐字节一致,客户端可以缓存该前缀,而不必每个会话重新读取。
102+
103+
如果你的客户端从不实时抓包、也不写入 pcap,可以用 `--profile` 暴露更小的表面:
104+
105+
| Profile | 工具数 | 载荷 | 移除的内容 |
106+
|---------|:-----:|:----:|-----------|
107+
| `full`(默认) | 51 | ~21 KB ||
108+
| `analysis` | 41 | ~17 KB | 实时抓包、接口列表、以及全部写文件的工具 |
109+
| `core` | 33 | ~14 KB | 以上全部,再加解密、解析覆写与底层视图 |
110+
111+
```bash
112+
wireshark-mcp serve --profile core
113+
```
114+
115+
每个 profile 都仍然包含内置 prompts、resources、skill 文档以及协议推荐可能指向的全部工具,因此缩小表面不会让模型去调用一个并不存在的工具。
100116

101117
工具结果同样有上限,因为一条结果会在会话余下的全部轮次里一直留在上下文中。超过 8000 字符的输出会保留首尾并标注截断位置,其余部分请用工具自带的 `offset` / `limit` / `display_filter` 参数翻页。调整上限:
102118

103119
```bash
104120
export WIRESHARK_MCP_MAX_RESULT_CHARS=16000
105121
```
106122

107-
每个工具都声明了自己是只读还是写入,因此客户端可以自动放行 74 个只读分析工具,同时仍然对会创建文件的 11 个工具(实时抓包、合并、过滤保存、editcap、text2pcap、对象导出)进行确认。
123+
每个工具都声明了自己是只读还是写入,因此客户端可以自动放行 40 个只读分析工具,同时仍然对会创建文件的 11 个工具(实时抓包、合并、过滤保存、editcap、text2pcap、帧提取、对象导出)进行确认。
108124

109125
---
110126

skills/wireshark-traffic-analysis/SKILL.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "wireshark-traffic-analysis"
3-
description: "Use when analyzing packet captures or live network traffic with Wireshark MCP; choose the right workflow for triage, security hunting, incident response, troubleshooting, or CTF work, then produce evidence-backed findings with exact filters, streams, frames, and next steps."
3+
description: "Use when analyzing packet captures or live network traffic with Wireshark MCP; choose the right workflow for triage, security hunting, incident response, or troubleshooting, then produce evidence-backed findings with exact filters, streams, frames, and next steps."
44
---
55

66
# Wireshark Traffic Analysis
@@ -13,13 +13,12 @@ Use this skill to turn raw packet captures into a disciplined investigation. The
1313
- live traffic review after capture
1414
- security triage, threat hunting, or incident response
1515
- network and protocol troubleshooting
16-
- CTF and forensics-style packet challenges
1716
- any task where packet evidence matters more than intuition
1817

1918
## Required inputs
2019

2120
- capture path
22-
- primary goal: `triage`, `security`, `incident-response`, `troubleshoot`, or `ctf`
21+
- primary goal: `triage`, `security`, `incident-response`, or `troubleshoot`
2322
- any known scope: suspicious host, port, domain, time window, protocol, or symptom
2423

2524
If the user does not name a goal, default to `triage`.
@@ -46,7 +45,6 @@ If the user does not name a goal, default to `triage`.
4645
- Prefer Wireshark MCP tools over freehand `tshark` syntax.
4746
- Never guess display filter syntax. Use `wireshark://reference/display-filters`.
4847
- Use `wireshark://reference/protocol-fields` when you need field names for extraction or filters.
49-
- Never decode payloads manually when `wireshark_decode_payload` can verify the result.
5048
- Treat `wireshark_stats_expert_info` as a lead generator, not a final verdict.
5149
- When a finding depends on context, follow the full stream before concluding.
5250
- For large captures, paginate instead of treating the first page as representative.
@@ -95,7 +93,6 @@ Use the matching playbook in [references/playbooks.md](references/playbooks.md):
9593
- `security`: suspicious traffic, exfiltration, credential exposure, malware behavior
9694
- `incident-response`: reconstruct the timeline, scope, and affected systems
9795
- `troubleshoot`: retransmissions, latency, resets, failed handshakes, unstable services
98-
- `ctf`: flags, hidden payloads, staged transfers, encoded streams
9996

10097
## Built-in prompts and references
10198

@@ -105,7 +102,6 @@ If the user mainly needs a starting workflow rather than a full investigation, t
105102
- `security_audit`
106103
- `performance_analysis`
107104
- `incident_response`
108-
- `ctf_solve`
109105

110106
Use `wireshark://guide/usage` when you need the repo's built-in MCP workflow reference.
111107

skills/wireshark-traffic-analysis/references/evidence-rubric.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Counterexamples:
131131

132132
Good confirmation tools:
133133

134-
- `wireshark_extract_tls_handshakes`
134+
- `wireshark_analyze_protocol(protocol="tls_handshakes")`
135135
- `wireshark_follow_stream`
136136

137137
### TCP health problems

skills/wireshark-traffic-analysis/references/playbooks.md

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Use these mode-specific playbooks after the initial overview in `SKILL.md`.
88
- [Security](#security)
99
- [Incident Response](#incident-response)
1010
- [Troubleshoot](#troubleshoot)
11-
- [CTF](#ctf)
1211

1312
## Triage
1413

@@ -21,7 +20,7 @@ Recommended flow:
2120
3. `wireshark_stats_protocol_hierarchy`
2221
4. `wireshark_stats_endpoints`
2322
5. `wireshark_stats_conversations`
24-
6. `wireshark_plot_traffic` or `wireshark_stats_io_graph` if timing matters
23+
6. `wireshark_stats_io_graph` if timing matters
2524
7. Follow the most relevant streams with `wireshark_follow_stream`
2625

2726
Interpretation notes:
@@ -44,16 +43,17 @@ Goal: determine whether the capture shows suspicious behavior and explain why.
4443
Recommended flow:
4544

4645
1. Start with the triage playbook.
47-
2. Run `wireshark_security_audit` for a broad first pass.
46+
2. Run `wireshark_quick_analysis` for a broad first pass.
4847
3. Verify specific signals with:
4948
- `wireshark_extract_credentials`
5049
- `wireshark_detect_port_scan`
5150
- `wireshark_detect_dns_tunnel`
52-
- `wireshark_analyze_suspicious_traffic`
51+
- `wireshark_detect_beaconing`
52+
- `wireshark_detect_exfiltration`
5353
4. If HTTP, DNS, or TLS matter, extract evidence with:
5454
- `wireshark_extract_http_requests`
5555
- `wireshark_extract_dns_queries`
56-
- `wireshark_extract_tls_handshakes`
56+
- `wireshark_analyze_protocol(protocol="tls_handshakes")`
5757
5. Follow suspicious conversations with `wireshark_follow_stream`.
5858
6. Use `wireshark_get_packet_details` or `wireshark_get_packet_context` to anchor claims in exact frames.
5959

@@ -78,7 +78,7 @@ Recommended flow:
7878

7979
1. Start with the triage playbook.
8080
2. Use `wireshark_get_file_info` to understand duration and capture boundaries.
81-
3. Use `wireshark_list_ips`, `wireshark_stats_endpoints`, and `wireshark_stats_conversations` to map actors.
81+
3. Use `wireshark_stats_endpoints` and `wireshark_stats_conversations` to map actors.
8282
4. Use security-focused tools to identify IOCs and suspicious traffic.
8383
5. Follow the streams that matter most for:
8484
- initial contact
@@ -111,7 +111,7 @@ Recommended flow:
111111
- `wireshark_stats_protocol_hierarchy`
112112
- `wireshark_stats_endpoints`
113113
- `wireshark_stats_conversations`
114-
- `wireshark_plot_traffic` or `wireshark_stats_io_graph`
114+
- `wireshark_stats_io_graph`
115115
3. Use protocol health tools:
116116
- `wireshark_analyze_tcp_health`
117117
- `wireshark_stats_expert_info`
@@ -130,31 +130,3 @@ Deliver:
130130
- probable bottleneck or failure mode
131131
- exact evidence
132132
- what to test next outside the capture if needed
133-
134-
## CTF
135-
136-
Goal: recover the flag or hidden payload while documenting the extraction path.
137-
138-
Recommended flow:
139-
140-
1. Start with `wireshark_open_file` and `wireshark_quick_analysis`.
141-
2. Search for obvious markers:
142-
- `wireshark_search_packets(..., "flag", scope="bytes")`
143-
- `wireshark_search_packets(..., "CTF", scope="bytes")`
144-
- `wireshark_search_packets(..., "password", scope="bytes")`
145-
3. Inspect DNS, HTTP, TLS, ICMP, SMTP, or unusual protocols for encoded payloads.
146-
4. Use `wireshark_follow_stream` on interesting streams.
147-
5. Use `wireshark_decode_payload` for Base64, hex, URL encoding, gzip, and similar content.
148-
6. If files were transferred, use `wireshark_export_objects`.
149-
150-
Interpretation notes:
151-
152-
- `wireshark_follow_stream` stream indexes are zero-based, mirroring Wireshark's stream selection behavior.
153-
- If the flag path is not obvious, pivot from endpoints to conversations to candidate streams instead of opening streams at random.
154-
155-
Deliver:
156-
157-
- flag or recovered artifact
158-
- extraction path
159-
- exact evidence chain
160-
- any decoding steps required

skills/wireshark-traffic-analysis/references/report-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Adapt this template to the user's goal. Keep it short unless the user asks for d
77

88
## Scope
99
- Capture: `<path>`
10-
- Goal: `<triage | security | incident-response | troubleshoot | ctf>`
10+
- Goal: `<triage | security | incident-response | troubleshoot>`
1111
- Assumptions: `<none>` or `<brief list>`
1212

1313
## Executive Summary

0 commit comments

Comments
 (0)