MCP Pwnbox
一套用于渗透测试工作流的MCP(模型上下文协议)服务器。通过标准化协议公开安全工具,允许AI助手执行自动侦察、枚举、利用和后利用。
建筑
┌─────────────┐
│ AI Client │ (Claude Code, etc.)
└──────┬──────┘
│ MCP Protocol (stdin/stdout)
▼
┌─────────────────────────────────────┐
│ ORCHESTRATOR (MCP Server) │
│ ┌───────────┐ ┌───────────────┐ │
│ │ State │ │ Phase │ │
│ │ Machine │ │ Controller │ │
│ └───────────┘ └───────────────┘ │
└─────────────────────────────────────┘
│
▼
┌──────┴──────┬───────────┬───────────┐
│pwnbox-recon │pwnbox-enum│pwnbox-exploit│pwnbox-post
│ nmap │ gobuster │ sqlmap │ linpeas
│ masscan │ ffuf │ hydra │ chisel
│ dig │ ferox │ nikto │ nxc
└─────────────┴───────────┴──────────────┴───────────快速开始
先决条件
- Docker和Docker组合
- Python 3.11+(例如客户端)
pip install mcp(MCP客户端库)- 单词列表位于
/usr/share/wordlists(或调整docker组成卷)
设置
# Clone and enter directory
cd mcp-pwnbox
# Build all containers
docker compose build
# Start all services
docker compose up -d
# Verify containers are running
docker ps | grep pwnbox测试设置
# Test orchestrator
docker exec -i pwnbox-orchestrator python -c "
from server import handle_get_state
import asyncio
print(asyncio.run(handle_get_state({})))
"
# Test recon server
docker exec -it pwnbox-recon nmap --version
# Run example client
python example_client.pyAPI命令(CLI示例)
这些示例直接通过每个容器的stdio服务器调用MCP工具。
# List tools from a server (example: recon)
python - <<'PY'
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def main():
params = StdioServerParameters(
command="docker",
args=["exec", "-i", "pwnbox-recon", "python", "/app/server.py"],
env=None,
)
async with stdio_client(params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
for t in tools.tools:
print(f"{t.name}: {t.description}")
asyncio.run(main())
PY
# Call a tool (example: nmap_scan)
TARGET=10.10.10.5
python - <
dict:
cmd = ["tool", args["param"]]
return await run_command(cmd)- 如果需要新的二进制文件,请更新Dockerfile
- 如果工具属于特定阶段,则更新phase_controller.py
测试目标
scanme.nmap.org-官方nmap测试服务器(安全)localhost-本地测试- HTB目标-需要主机上的VPN连接(tun0)
资源
安全说明
这是为了 仅限学习和授权测试。仅扫描您拥有或明确允许测试的系统。
