Lflores15/Kali-CTF-MCP
GitHub: Lflores15/Kali-CTF-MCP
一个模块化 MCP 服务器,将 Kali Linux 安全工具以类别服务暴露给 AI 助手,解决 CTF 与渗透测试中工具统一编排与上下文管理问题。
Stars: 0 | Forks: 0
# Kali-MCP
一个模块化的 [Model Context Protocol (MCP)](https://modelcontextprotocol.io) 服务器,适用于 CTF 挑战。为 AI 助手暴露安全工具,涵盖密码学、Web、漏洞利用、逆向工程、取证、内存分析、PCAP 和网络等类别。
基于 [CTF-MCP](https://github.com/Coff0xc/CTF-MCP)(由 Coff0xc 开发),并扩展了更多工具、专注的类别服务器、SSE 传输、进程管理器和 TUI 仪表板。
## 功能特性
- **专注的类别服务器** — 仅运行你需要的工具,减少每会话的令牌开销
- **SSE 传输** — 每个服务器通过 HTTP/SSE 运行,可被任何兼容 MCP 的客户端连接
- **`manage.sh`** — 一个脚本即可启动、停止、重启所有服务器并查看日志
- **`dashboard.py`** — curses 风格的 TUI,用于管理服务器、浏览已加载工具并查看 Claude 统计信息
## 架构
```
sse_server.py # HTTP/SSE entrypoint — accepts category + port args
ctf_mcp/
server_factory.py # Shared make_server() factory used by all servers
server.py # Full server (all tools, stdio transport)
servers/ # Focused category servers (stdio transport)
tools/ # MCP tool definitions (thin wrappers over adapters)
adapters/ # CLI/library wrappers with input validation
manage.sh # Process manager using PID files and log files
dashboard.py # Curses TUI
```
## 类别服务器
| 类别 | 端口 | 描述 |
|------|------|------|
| full | 8000 | 所有工具 + 编排器 |
| crypto | 8001 | 密码、编码、哈希、RSA 攻击 |
| web | 8002 | SQL 注入、XSS、JWT、SSRF、SSTI、XXE、反序列化 |
| pwn | 8003 | ROP、Shellcode、堆利用、pwntools |
| reverse | 8004 | ELF/PE 分析、反汇编、 gadget 查找 |
| forensics | 8005 | 隐写术、PCAP 分析、内存取证 |
## 所需外部工具
以下工具必须安装并在 `PATH` 中可用:
| 工具 | 用途 | 安装方式 |
|------|------|----------|
| [Volatility3](https://github.com/volatilityfoundation/volatility3) | 内存取证 | `pip install volatility3` |
| [tshark](https://www.wireshark.org/docs/man-pages/tshark.html) | PCAP 分析 | 通过 Wireshark 或 `brew install wireshark` |
| [nmap](https://nmap.org) | 网络扫描 | `brew install nmap` / `apt install nmap` |
| [hashcat](https://hashcat.net) | 密码破解 | `brew install hashcat` / `apt install hashcat` |
| [John the Ripper](https://www.openwall.com/john/) | 密码破解 | `brew install john-jumbo` / `apt install john` |
| [binwalk](https://github.com/ReFirmLabs/binwalk) | 固件分析 | `pip install binwalk` |
| [steghide](https://steghide.sourceforge.net) | 隐写术 | `apt install steghide` |
| [pwntools](https://github.com/Gallopsled/pwntools) | 二进制利用 | `pip install pwntools`(仅 Linux) |
| [angr](https://github.com/angr/angr) | 二进制分析 | `pip install angr`(仅 Linux) |
## 安装
```
git clone https://github.com/Lflores15/Kali-MCP.git
cd Kali-MCP
python3 -m venv venv
source venv/bin/activate
# 使用所有 Python 依赖项安装
pip install -e ".[full]"
# 配置环境
cp .env.dist .env
# 编辑 .env 并将 VENV_PYTHON 设置为您的虚拟环境 Python 路径
```
## 配置
`.env.dist` 提供了模板文件 — 复制为 `.env` 并填写你的配置值:
```
# 虚拟环境中 Python 解释器的路径
VENV_PYTHON=/path/to/your/venv/bin/python
```
`manage.sh` 和 `dashboard.py` 会读取此文件以启动服务器。
## 运行服务器
### manage.sh
```
./manage.sh start all # start all category servers
./manage.sh start crypto # start only the crypto server
./manage.sh stop all # stop all servers
./manage.sh restart forensics # restart one server
./manage.sh status # show running/stopped state
./manage.sh logs forensics # tail a server's log
```
服务器以后台方式运行,并在 `.pids/` 中保存 PID 文件,日志记录在 `.logs/` 中。
### 手动启动
```
python3 sse_server.py # full server, port 8000
python3 sse_server.py crypto 8001 # crypto only, port 8001
python3 sse_server.py forensics 8005 # forensics only, port 8005
```
### 仪表板
```
python3 dashboard.py
```
| 按键 | 操作 |
|------|------|
| `↑` / `↓` | 导航服务器 |
| `s` | 启动/停止所选服务器 |
| `r` | 重启所选服务器 |
| `PgUp` / `PgDn` | 滚动工具列表 |
| `q` | 退出 |
## 连接到 Claude
将以下内容添加到你的 `claude_desktop_config.json`:
```
{
"mcpServers": {
"ctf-crypto": {
"url": "http://localhost:8001/sse"
},
"ctf-web": {
"url": "http://localhost:8002/sse"
},
"ctf-pwn": {
"url": "http://localhost:8003/sse"
},
"ctf-reverse": {
"url": "http://localhost:8004/sse"
},
"ctf-forensics": {
"url": "http://localhost:8005/sse"
}
}
}
```
或直接连接到 8000 端口以同时使用所有工具。
## 许可证
MIT — 参见 [LICENSE](LICENSE)。
标签:AI助手, API密钥检测, Curses界面, FTP漏洞扫描, HTTP流式传输, JARM, JWT, LLM 安全, MCP, OISF, PCAP分析, pwntools, ROP, Shellcode, SSE传输, SSRF, SSTI, TUI仪表盘, Web安全, XSS, XXE, 云资产清单, 内存分析, 减少Token开销, 加密破解, 反序列化, 取证, 堆利用, 安全编排, 密码学, 工具包装器, 开源安全工具, 手动系统调用, 技术调研, 日志管理, 模块化服务器, 模型上下文协议, 漏洞情报, 系统分析, 网络分析, 聚焦类别服务器, 蓝队分析, 调试分析, 输入验证, 进程守护, 逆向工具, 逆向工程, 逆向工程平台, 隐写术