Skip to content

Commit 1787705

Browse files
committed
feat: Introduce a tool registry and agent system, and refine existing threat detection tools.
1 parent 50da197 commit 1787705

14 files changed

Lines changed: 1339 additions & 202 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.6.0] - 2025-06-27
11+
12+
### Added
13+
14+
#### 🚀 Agentic Workflows — Server-side Orchestrated Analysis
15+
- `wireshark_security_audit`: One-call comprehensive security audit (8 analysis phases, risk scoring 0-100, structured report with findings and recommendations)
16+
- `wireshark_quick_analysis`: One-call traffic overview (file info, protocol distribution, top talkers, conversations, hostnames, anomaly summary)
17+
18+
#### 🔍 Progressive Discovery — Dynamic Tool Registration
19+
- `wireshark_open_file`: New entry-point tool that analyzes pcap content and dynamically activates protocol-specific tools
20+
- `ToolRegistry` system: Server starts with ~17 core tools; protocol-specific tools activate on demand when matching protocols are detected
21+
- `PROTOCOL_TOOL_MAP`: Configurable mapping from protocols (HTTP, DNS, TLS, etc.) to relevant tool sets
22+
23+
### Changed
24+
- Security tools (`wireshark_check_threats`, `wireshark_extract_credentials`) are now contextual — activated via `wireshark_open_file`
25+
- Protocol tools (`wireshark_extract_tls_handshakes`, `wireshark_analyze_tcp_health`, `wireshark_detect_arp_spoofing`, `wireshark_extract_smtp_emails`, `wireshark_extract_dhcp_info`) are now contextual
26+
- Threat detection tools (`wireshark_detect_port_scan`, `wireshark_detect_dns_tunnel`, `wireshark_detect_dos_attack`, `wireshark_analyze_suspicious_traffic`) are now contextual
27+
- Extract tools (`wireshark_extract_http_requests`, `wireshark_extract_dns_queries`, `wireshark_export_objects`, `wireshark_verify_ssl_decryption`) are now contextual
28+
1029
## [0.4.0] - 2025-06-01
1130

1231
### Added
@@ -37,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3756
- Decoding: `wireshark_decode_payload` with auto-detection (Base64, Hex, URL, Gzip, Deflate, Rot13)
3857
- Visualization: ASCII traffic plot, ASCII protocol hierarchy tree
3958

40-
[Unreleased]: https://github.com/bx33661/Wireshark-MCP/compare/v0.4.0...HEAD
59+
[Unreleased]: https://github.com/bx33661/Wireshark-MCP/compare/v0.6.0...HEAD
60+
[0.6.0]: https://github.com/bx33661/Wireshark-MCP/compare/v0.4.0...v0.6.0
4161
[0.4.0]: https://github.com/bx33661/Wireshark-MCP/compare/v0.2.1...v0.4.0
4262
[0.2.1]: https://github.com/bx33661/Wireshark-MCP/releases/tag/v0.2.1

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ Paste this into your AI client after pointing it at a pcap file:
180180
```
181181
Analyze <path/to/file.pcap> using the Wireshark MCP tools.
182182
183-
- Start with wireshark_get_packet_list to map the traffic.
184-
- Drill into interesting frames with wireshark_get_packet_details.
185-
- For TCP/HTTP sessions, use wireshark_follow_stream.
183+
- Start with wireshark_open_file to load the file and activate relevant tools.
184+
- Use wireshark_security_audit for a one-call security analysis.
185+
- Or use wireshark_quick_analysis for a fast traffic overview.
186+
- Drill into details with wireshark_follow_stream or wireshark_get_packet_details.
186187
- Never guess — always verify with tools.
187188
- Write findings to report.md.
188189
```
@@ -191,6 +192,21 @@ Analyze <path/to/file.pcap> using the Wireshark MCP tools.
191192

192193
## Tools
193194

195+
<details>
196+
<summary><b>⚡ Agentic Workflows</b> — one-call comprehensive analysis (NEW in v0.6)</summary>
197+
198+
<br>
199+
200+
| Tool | Description |
201+
|---|---|
202+
| `wireshark_security_audit` | **One-call security audit**: 8-phase analysis (threat intel, credential scan, port scan, DNS tunnel, cleartext, anomalies) with risk scoring (0-100) and recommendations |
203+
| `wireshark_quick_analysis` | **One-call traffic overview**: file info, protocol distribution, top talkers, conversations, hostnames, anomaly summary, suggested next steps |
204+
| `wireshark_open_file` | **Smart file opener**: analyzes pcap content and dynamically activates protocol-specific tools (Progressive Discovery) |
205+
206+
> 💡 These tools replace the need to manually chain 5-10 tool calls. Just call one and get a complete report.
207+
208+
</details>
209+
194210
<details>
195211
<summary><b>Packet Analysis</b> — inspect, navigate, and search packets</summary>
196212

@@ -298,6 +314,8 @@ Analyze <path/to/file.pcap> using the Wireshark MCP tools.
298314

299315
</details>
300316

317+
> **Note**: Security, Protocol, and Threat tools are *contextual* — they activate automatically when you call `wireshark_open_file`. The Agentic tools (`security_audit`, `quick_analysis`) are always available.
318+
301319
---
302320

303321
## MCP Resources

README_zh.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ args = ["tool", "run", "wireshark-mcp"]
180180
```
181181
使用 Wireshark MCP 工具分析 <path/to/file.pcap>。
182182
183-
- 先用 wireshark_get_packet_list 获取流量概览
184-
- 对感兴趣的帧使用 wireshark_get_packet_details 查看详情
185-
- 对于 TCP/HTTP 会话,使用 wireshark_follow_stream 查看完整对话
183+
- 先用 wireshark_open_file 加载文件并激活相关工具
184+
- 使用 wireshark_security_audit 一键安全审计
185+
- 或用 wireshark_quick_analysis 快速了解流量概况
186+
- 需要细节时使用 wireshark_follow_stream 或 wireshark_get_packet_details
186187
- 不要猜测 — 始终用工具验证
187188
- 将分析结果写入 report.md
188189
```
@@ -191,6 +192,21 @@ args = ["tool", "run", "wireshark-mcp"]
191192

192193
## 工具集
193194

195+
<details>
196+
<summary><b>⚡ Agentic Workflows</b> — 一键综合分析(v0.6 新增)</summary>
197+
198+
<br>
199+
200+
| 工具 | 描述 |
201+
|---|---|
202+
| `wireshark_security_audit` | **一键安全审计**:8 阶段分析(威胁情报、凭证扫描、端口扫描、DNS 隧道、明文协议、异常检测),输出风险评分(0-100)和修复建议 |
203+
| `wireshark_quick_analysis` | **一键流量概览**:文件信息、协议分布、Top Talkers、会话统计、域名/主机名、异常摘要、下一步建议 |
204+
| `wireshark_open_file` | **智能打开文件**:分析 pcap 内容并自动激活协议相关工具(Progressive Discovery)|
205+
206+
> 💡 这些工具替代了手动串联 5-10 次 tool call。只需一次调用即可获得完整报告。
207+
208+
</details>
209+
194210
<details>
195211
<summary><b>数据包分析</b> — 检查、浏览、搜索数据包</summary>
196212

@@ -298,6 +314,8 @@ args = ["tool", "run", "wireshark-mcp"]
298314

299315
</details>
300316

317+
> **注意**:安全分析、协议分析、威胁检测工具为*上下文工具* — 调用 `wireshark_open_file` 后自动激活。Agentic 工具(`security_audit``quick_analysis`)始终可用。
318+
301319
---
302320

303321
## MCP Resources

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "wireshark-mcp"
7-
version = "0.5.0"
7+
version = "0.6.0"
88
description = "A production-grade Model Context Protocol (MCP) server for Wireshark"
99
readme = "README.md"
1010
keywords = ["mcp", "wireshark", "tshark", "packet-analysis", "network", "pcap", "model-context-protocol", "llm", "security"]

src/wireshark_mcp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""
22
Wireshark MCP - A Model Context Protocol server for Wireshark.
33
"""
4-
__version__ = "0.5.0"
4+
__version__ = "0.6.0"

src/wireshark_mcp/server.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,41 @@
1313
from .tools.decode import register_decode_tools
1414
from .tools.extract import register_extract_tools
1515
from .tools.files import register_files_tools
16-
from .tools.protocol import register_protocol_tools
17-
from .tools.security import register_security_tools
16+
from .tools.agents import register_agent_tools
17+
from .tools.registry import ToolRegistry, register_open_file_tool
1818
from .tools.stats import register_stats_tools
19-
from .tools.threat import register_threat_tools
2019
from .tools.visualize import register_visualize_tools
2120

2221
logger = logging.getLogger("wireshark_mcp")
2322

2423

2524
def _build_server() -> FastMCP:
26-
"""Build and configure the MCP server with all tools registered."""
25+
"""Build and configure the MCP server with progressive discovery."""
2726
# Read allowed directories from environment
2827
allowed_dirs_env = os.environ.get("WIRESHARK_MCP_ALLOWED_DIRS", "")
2928
allowed_dirs = [d.strip() for d in allowed_dirs_env.split(",") if d.strip()] or None
3029

3130
mcp = FastMCP("Wireshark MCP", dependencies=["tshark"])
3231
client = TSharkClient(allowed_dirs=allowed_dirs)
3332

34-
# Register all tool modules
33+
# ── Core tools (always registered) ──────────────────────────────────
3534
register_capture_tools(mcp, client)
3635
register_stats_tools(mcp, client)
3736
register_extract_tools(mcp, client)
3837
register_files_tools(mcp, client)
39-
register_security_tools(mcp, client)
4038
register_decode_tools(mcp)
4139
register_visualize_tools(mcp, client)
42-
register_protocol_tools(mcp, client)
43-
register_threat_tools(mcp, client)
40+
register_agent_tools(mcp, client)
4441

45-
# Register Resources and Prompts
42+
# ── Progressive Discovery ───────────────────────────────────────────
43+
# Build the contextual tool catalog (not registered yet)
44+
registry = ToolRegistry(mcp, client)
45+
registry.build_catalog()
46+
47+
# Register the entry-point tool that activates contextual tools
48+
register_open_file_tool(mcp, client, registry)
49+
50+
# ── Resources and Prompts ───────────────────────────────────────────
4651
register_resources(mcp)
4752
register_prompts(mcp)
4853

@@ -97,3 +102,4 @@ def main() -> None:
97102

98103
if __name__ == "__main__":
99104
main()
105+

0 commit comments

Comments
 (0)