渗透测试MCP服务器
一个全面的模型上下文协议(MCP)服务器,提供专业的渗透测试工具和实用程序。此服务器与无缝集成 克劳德桌面 以及其他兼容MCP的客户端,使您可以在人工智能对话中直接访问行业标准的安全测试工具。
🛡️ 特性
网络安全工具
- Nmap扫描:具有各种扫描类型的全面端口扫描(快速、完整、隐形、UDP、版本检测、操作系统检测)
- 域名解析:查询DNS记录(A、AAAA、MX、NS、TXT、CNAME、SOA)
- WHOIS查询:域名注册和所有权信息
Web应用程序安全
- Nikto扫描:针对常见安全问题的Web漏洞扫描
- DIRB:使用单词表对目录和文件进行暴力破解
- Gobuster:快速目录、DNS和虚拟主机暴力破解
侦察与OSINT
- 转租人3r:使用多个搜索引擎(谷歌、必应、雅虎等)枚举子域
🚀 快速开始
先决条件
- 码头工人 (推荐)或Python 3.10+
- 克劳德桌面 应用
步骤1:构建MCP服务器
选项A:Docker(推荐)
# Clone the repository
git clone https://github.com/FrenzyVJN/pentestfrenzymcp
cd pentestfrenzymcp
# Build the Docker image
./build.sh
# Test the installation
./simple-test.sh选项B:本地安装
# Install Python dependencies
pip install httpx mcp dnspython sublist3r
# Install system tools (macOS)
brew install nmap nikto dirb gobuster whois
# Install system tools (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install nmap nikto dirb gobuster whois dnsutils步骤2:配置Claude桌面
适用于macOS
- 打开Claude Desktop配置文件:
# Create the directory if it doesn't exist
mkdir -p ~/Library/Application\ Support/Claude
# Edit the configuration file
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json- 添加MCP服务器配置:
Docker设置(推荐):
{
"mcpServers": {
"pentest-mcp": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"pentest-mcp:latest"
]
}
}
}本地安装:
{
"mcpServers": {
"pentest-mcp": {
"command": "python3",
"args": ["/full/path/to/pentest-mcp/main.py"],
"cwd": "/full/path/to/pentest-mcp"
}
}
}对于Windows
- 打开Claude Desktop配置文件:
# Navigate to the Claude config directory
cd %APPDATA%\Claude
# Create/edit the configuration file
notepad claude_desktop_config.json- 添加MCP服务器配置:
Docker设置(推荐):
{
"mcpServers": {
"pentest-mcp": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"pentest-mcp:latest"
]
}
}
}WSL(Linux的Windows子系统):
{
"mcpServers": {
"pentest-mcp": {
"command": "wsl",
"args": [
"-e",
"docker",
"run",
"--rm",
"-i",
"--network=host",
"pentest-mcp:latest"
]
}
}
}本地Windows安装:
{
"mcpServers": {
"pentest-mcp": {
"command": "python",
"args": ["C:\\full\\path\\to\\pentest-mcp\\main.py"],
"cwd": "C:\\full\\path\\to\\pentest-mcp"
}
}
}步骤3:重新启动克劳德桌面
在更新配置文件之后, 完全重新启动克劳德桌面 加载新的MCP服务器。
步骤4:验证连接
- 打开克劳德桌面
- 开始新的对话
- 查找MCP服务器指示器(通常是一个小图标或状态指示器)
- 尝试一个简单的命令:“你能为google.com进行DNS查找吗?”
💬 使用示例
配置后,您可以在Claude Desktop中使用这些自然语言命令:
🔍 网络侦察
"Can you scan the top 1000 ports on scanme.nmap.org?"
"Do a quick nmap scan on 127.0.0.1"
"Perform a stealth scan on 192.168.1.1"
"Scan ports 22,80,443 on example.com with version detection"🌐 DNS和域分析
"Look up DNS A records for google.com"
"Get all MX records for github.com"
"Do a WHOIS lookup for microsoft.com"
"Find the nameservers for cloudflare.com"🔎 子域发现
"Find subdomains for example.com using sublist3r"
"Enumerate subdomains for target.com with bruteforce enabled"
"Discover subdomains for company.com using all search engines"🛡️ Web应用程序测试
"Run a nikto scan on http://testphp.vulnweb.com"
"Use dirb to find directories on http://example.com"
"Perform directory brute forcing on https://target.com using gobuster"
"Scan for common web vulnerabilities on https://demo.site.com"🎯 高级扫描场景
"Do a comprehensive security assessment of 192.168.1.100"
"Perform reconnaissance on example.com including subdomains and port scan"
"Check if port 22 is open on a list of IP addresses: 10.0.0.1, 10.0.0.2"🛠️ 可用工具
| 工具 | 目的 | 示例用法 |
|---|---|---|
nmap_scan | 端口扫描和网络发现 | “扫描192.168.1.1上的端口” |
dns_lookup | DNS记录查询 | “获取domain.com的A记录” |
whois_lookup | 域名注册信息 | “google.com的WHOIS查询” |
sublist3r_enum | 子域枚举 | “查找target.com的子域” |
nikto_scan | 网络漏洞扫描 | “Nikto继续扫描https://site.com" |
dirb_scan | 目录暴力破解 | “在website.com上查找目录” |
gobuster_scan | 快速目录/DNS暴力破解 | “目标站点上的Gobuster扫描” |
🔧 高级配置
自动批准工具(跳过确认)
将工具添加到 autoApprove 跳过确认对话框的列表:
{
"mcpServers": {
"pentest-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "--network=host", "pentest-mcp:latest"],
"autoApprove": [
"dns_lookup",
"whois_lookup",
"nmap_scan"
]
}
}
}自定义单词列表
挂载自定义单词表以进行目录暴力破解:
{
"mcpServers": {
"pentest-mcp": {
"command": "docker",
"args": [
"run", "--rm", "-i", "--network=host",
"-v", "/path/to/wordlists:/wordlists:ro",
"pentest-mcp:latest"
]
}
}
}环境变量
设置自定义环境变量:
{
"mcpServers": {
"pentest-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "--network=host", "pentest-mcp:latest"],
"env": {
"SCAN_TIMEOUT": "30",
"MAX_THREADS": "20"
}
}
}
}🔍 故障排除
MCP服务器未出现
- 检查配置文件位置:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json
- 验证JSON语法: 使用JSON验证器检查您的配置
- 完全重新启动克劳德桌面 (不仅仅是刷新)
- 检查Docker: 确保Docker正在运行并且映像存在:
docker images pentest-mcp工具不工作
- 手动测试Docker容器:
docker run --rm -it pentest-mcp:latest bash- 检查工具可用性:
./simple-test.sh- 验证网络访问: 确保
--network=host用于扫描外部目标
权限问题
- macOS: 授予Docker访问网络资源的权限
- 窗户: 如果需要,以管理员身份运行Docker Desktop
- Linux: 将用户添加到docker组:
sudo usermod -aG docker $USER
⚠️ 安全和法律考虑
🚨 重要警告
- 需要授权:仅在您拥有或有明确书面许可进行测试的系统上使用这些工具
- 遵守法律:确保遵守当地法律法规
- 责任揭秘:对发现的任何漏洞遵循负责任的披露做法
- 速率限制:尊重扫描速率,避免压倒目标系统
🔒 安全功能
- 集装箱隔离:工具在隔离的Docker容器中运行
- 无持久存储:容器每次使用后都会被销毁
- 网络隔离:用于测试的可选网络隔离
- 审计日志:记录所有工具执行情况
🏗️ 建筑
服务器采用模块化架构,便于扩展:
pentest/
├── __init__.py # Package initialization
├── tools.py # Tool definitions and schemas
├── handlers.py # Tool call routing and handling
├── network.py # Network tools (nmap, DNS, WHOIS)
├── web.py # Web security tools (nikto, dirb, gobuster)
└── recon.py # Reconnaissance tools (sublist3r)添加新工具
- 定义工具 在……里面
pentest/tools.py - 实现处理程序 在……里面
pentest/handlers.py - 创建工具类 在适当的模块中
- 更新工具列表 在……里面
get_all_tools()
有关要遵循的示例和模式,请参阅现有工具。
🤝 贡献
欢迎投稿!拜托:
- 遵循现有的代码模式
- 添加全面的错误处理
- 包括安全考虑
- 使用Docker和本地安装进行测试
- 更新文档
📄 许可证
此项目仅用于教育和授权的安全测试目的。用户有责任确保遵守适用法律,并在测试任何系统之前获得适当的授权。
______________________________________________________________________
