使用说明
🔒 专业渗透测试MCP服务器
A. 模型上下文协议(MCP) 服务器通过运行全面Kali Linux工具的安全Docker容器提供企业级渗透测试功能。专为专业安全评估和授权渗透测试而设计。
🎯 概述
这款专业的MCP服务器将40多种行业标准渗透测试工具集成到Claude Desktop中,为授权环境提供人工智能辅助安全评估。所有工具都在一个隔离的Docker容器中运行,具有适当的输入净化、安全措施和自动化结果管理。
⚡ 专业功能
🛠️ 综合工具库
网络侦察与扫描
| 工具 | 目的 | 专业功能 |
|---|---|---|
| 扫描器 | 网络发现和端口扫描 | 6+种扫描类型(隐形、版本、主动、完整、UDP、vuln脚本) |
| masscan | 高速端口扫描器 | 具有可配置扫描速率的大规模网络发现 |
| dnsenum | DNS枚举 | 全面的子域、名称服务器和区域传输测试 |
| 积聚 | OWASP子域枚举 | 被动和主动侦察模式 |
| 路由跟踪 | 网络路径分析 | 路由和拓扑识别 |
| Whois | 域名注册查询 | WHOIS信息收集 |
Web应用程序测试
| 工具 | 目的 | 专业功能 |
|---|---|---|
| 无 | Web漏洞扫描程序 | OWASP Top 10,SSL/TLS支持,全面的配置错误检测 |
| sqlmap | SQL注入测试 | 多DBMS支持、身份验证、可定制的风险/级别 |
| wpscan | WordPress安全扫描程序 | 插件、主题、带有漏洞数据库的用户枚举 |
| ffuf | 快速Web模糊器 | 目录、文件、参数、vhost发现和过滤 |
| 核 | CVE和配置错误扫描程序 | 基于模板的漏洞检测 |
| wafw00f | WAF检测 | Web应用程序防火墙指纹识别 |
| whatweb | 技术指纹 | CMS、框架、具有攻击级别的服务器检测 |
| 高斯特 | 快速枚举 | 目录、DNS、VHost发现和自定义单词表 |
| dirb | Web内容暴力强制 | 支持多个单词表 |
漏洞利用与脆弱性研究
| 工具 | 目的 | 专业功能 |
|---|---|---|
| searchsploit | 漏洞数据库搜索 | 具有精确匹配的本地漏洞数据库搜索 |
| Metasploit | 漏洞利用框架 | 模块搜索和漏洞利用识别 |
密码破解和身份验证测试
| 工具 | 目的 | 专业功能 |
|---|---|---|
| 九头蛇 | 网络登录强制 | SSH、FTP、HTTP、RDP、SMB支持,具有速率限制 |
| 约翰 | 密码哈希破解 | 支持自定义单词表的多格式哈希 |
| 哈希猫 | GPU加速破解 | 高级攻击模式(字典、组合子、掩码、混合) |
| 哈希德 | 哈希类型识别 | 自动哈希格式检测 |
开采后和枚举
| 工具 | 目的 | 专业功能 |
|---|---|---|
| enum4linux | SMB/Smba枚举 | 用户、共享、组、策略枚举 |
| smbmap | SMB共享审核 | 带身份验证的权限审核 |
SSL/TLS安全测试
| 工具 | 目的 | 专业功能 |
|---|---|---|
| sslscan | SSL/TLS测试 | 密码套件和协议分析 |
| testssl.sh | 高级SSL漏洞扫描程序 | 心脏出血、POODLE、BEAST、犯罪检测 |
无线安全测试
| 工具 | 目的 | 专业功能 |
|---|---|---|
| 空调 | 无线安全套件 | 从捕获文件中破解WPA/WPA2密码 |
🔐 企业安全功能
- 🐳 隔离容器环境 -使用Kali Linux实现完全隔离
- 🛡️ 高级输入消毒 -多层指令注入预防
- 👤 非根执行 -基于能力安全的最小特权原则
- 🔍 输入验证 -使用正则表达式模式验证IP/域/端口格式
- ⏱️ 超时保护 -所有操作的可配置超时
- 📝 综合录井 -具有结构化日志记录的完整审计跟踪
- 💾 自动结果存储 -使用有组织的文件管理对结果进行时间戳
- 📊 结果管理 -列出、读取和组织扫描输出
🚀 快速开始
先决条件
- Docker 桌面版 已安装并正在运行
- 克劳德桌面版 应用程序(最新版本)
- Git 用于存储库克隆
- 管理员权限 用于Docker操作
安装
-
克隆存储库
git clone https://github.com/AnGrY-Althaf/pentest-mcp-server.git cd pentest-mcp-server -
构建专业的Docker镜像
docker build -t pentest-mcp-pro .注意:由于工具安装全面,初始构建可能需要15-30分钟
-
配置Claude桌面
编辑您的Claude Desktop配置文件:
- 视窗:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
添加此配置:
{ "mcpServers": { "pentest_professional": { "command": "docker", "args": [ "run", "--rm", "-i", "--cap-add=NET_RAW", "--cap-add=NET_ADMIN", "--cap-add=NET_BIND_SERVICE", "pentest-mcp-pro", "python3", "pentest_server.py" ] } } } - 视窗:
-
重新启动克劳德桌面
完全退出并重新启动Claude Desktop以加载新的专业服务器。
-
验证安装
在Claude Desktop中,您应该看到与40多种可用工具连接的专业pentest服务器。
📖 专业使用示例
网络侦察
"Perform a comprehensive nmap scan on 192.168.1.0/24 with version detection"
"Run a stealth SYN scan on 10.0.0.1 ports 1-1000"
"Execute aggressive nmap scan with OS detection on target.local"
"Use masscan to quickly scan 192.168.1.0/24 for common ports at rate 5000"
"Enumerate subdomains for example.com using amass in passive mode"
"Perform comprehensive DNS enumeration on target-domain.com"
Web应用程序测试
"Scan https://webapp.local with nikto including SSL checks"
"Test https://target.com/login.php for SQL injection with sqlmap at level 3 risk 2"
"Enumerate WordPress plugins and themes on https://blog.example.com"
"Run nuclei CVE scans against https://application.local"
"Use ffuf to discover hidden directories on https://target.com with big wordlist"
"Detect WAF on https://protected-site.com using wafw00f"
"Identify web technologies on https://target.com with aggressive whatweb scan"
漏洞利用与脆弱性研究
"Search for Apache 2.4.49 vulnerabilities in searchsploit"
"Find Metasploit modules for MS17-010 EternalBlue"
"Search exploits for ProFTPD 1.3.5 with exact matching"
密码和身份验证测试
"Use hydra to brute-force SSH on 192.168.1.10 with username admin"
"Crack NTLM hashes from hashes.txt using john with rockyou wordlist"
"Identify hash type for 5f4dcc3b5aa765d61d8327deb882cf99"
"Run hashcat on MD5 hashes in hash-file.txt with dictionary attack"
实施漏洞利用
"Enumerate SMB shares on 192.168.1.20 using enum4linux"
"Test SMB share access on 192.168.1.20 with username guest"
"Map SMB permissions on 10.0.0.5 with credentials user:password"
SSL/TLS安全
"Test SSL/TLS configuration on https://secure.example.com:443"
"Check for SSL vulnerabilities on mail.example.com using testssl.sh"
"Analyze cipher suites on https://api.example.com with sslscan"
结果管理
"List the last 20 scan results"
"Show me the contents of the most recent nmap scan"
"Read the nikto scan results from [filename]"
🔧 专业工具参考
网络侦察
nmap_scan(target, scan_type, ports)
- 目标:IP地址、域或CIDR范围
- scan_type:
basic-TCP连接扫描(默认)stealth-带有操作系统检测的SYN隐形扫描version-使用默认脚本进行服务版本检测aggressive-操作系统检测、版本检测、脚本扫描、跟踪路由full-所有端口均经过全面检测udp-UDP端口扫描vuln-漏洞检测脚本
- 端口:端口规格(例如“804438080”或“1-1000”)
masscan_scan(target, ports, rate)
- 目标:IP地址或CIDR范围
- 端口:端口范围(默认值:“1-65535”)
- 比率:每秒数据包数(默认值:“1000”,建议使用10000进行快速扫描)
dnsenum_scan(domain)
- 领域:全面DNS枚举的目标域
amass_enum(domain, mode)
- 领域:目标域
- 模式:
passive(仅限OSINT)或active(包括DNS查询)
Web应用程序测试
sqlmap_scan(url, data, cookie, level, risk)
- 网址:带参数的目标URL
- 数据:用于测试的POST数据
- 曲奇:会话Cookie
- 水平:检测级别1-5(默认值:1)
- 风险:测试风险等级1-3(默认值:1)
wpscan_scan(url, enumerate)
- 网址:WordPress网站URL
- 列举:选项-
vp(易受攻击的插件),vt(脆弱主题),u(用户)
nuclei_scan(target, templates)
- 目标:目标URL或域
- 模板:模板类别(cves、配置错误、漏洞等)
ffuf_scan(url, wordlist, mode)
- 网址:目标URL(包括目录模式的/FUZZ)
- 词汇表:
common,big,或自定义路径 - 模式:
dir(目录)或vhost(虚拟主机)
密码破解
hydra_bruteforce(target, service, username, password_list)
- 目标:目标IP或主机名
- 服务:ssh、ftp、http表单、rdp、smb等。
- 用户名:要测试的用户名
- 密码列表:
rockyou或自定义单词表
hashcat_crack(hash_file, hash_type, attack_mode)
- hash_file:包含哈希值的文件路径
- hash_type:哈希模式(0=MD5,100=SHA1,1000=NTLM,3200=bcrypt等)
- attack_mode:0=字典,1=组合器,3=掩码,6=混合
结果管理
list_results(limit)
- 限制:要显示的最近结果数(默认值:10)
read_result(filename)
- 文件名:要读取的结果文件的名称
🏗️ 专业建筑
Claude Desktop → MCP Protocol → Docker Container → Kali Linux Tools
↓
Input Sanitization & Validation
↓
Secure Tool Execution (pentester user)
↓
Result Storage & Management
↓
Formatted Output & Error Handling
安全层
- 输入层:多字符净化、正则表达式验证
- 执行层:非shell子进程执行,超时保护
- 权限层:基于能力的安全性,非root用户
- 存储层:具有适当权限的隔离工作区
- 网络层:受控网络能力
🛡️ 安全和法律考虑
✅ 仅限授权使用
关键的:此工具专为以下目的而设计:
- 授权渗透测试业务 经书面许可
- 专业安全评估 在受控环境中
- Bug赏金计划 在规定范围内
- 网络安全教育与培训 论所有制
- 红队演习 经适当授权
- 安全性研究 关于授权目标
❌ 严禁使用
- ❌ 未经授权扫描第三方系统
- ❌ 未经明确书面许可攻击系统
- ❌ 恶意使用发现的漏洞
- ❌ 违反计算机欺诈和滥用法律(CFAA、计算机滥用法等)
- ❌ 未经授权扫描面向互联网的系统
- ❌ 阻断服务攻击
- ❌ 数据泄露或系统受损
📋 专业最佳实践
-
订婚前
- 测试前获得书面授权
- 明确界定范围和边界
- 制定交战规则
- 文件保管链
-
订婚期间
- 保持在规定范围内
- 记录所有活动
- 与利益相关者保持沟通
- 立即报告关键发现
-
岗位敬业度
- 提供全面的报告
- 遵循负责任的披露做法
- 安全删除敏感数据
- 根据合同义务归档结果
🔒 技术安全实施
输入消毒
# Multi-layer protection
- Shell metacharacter filtering: ; & | ` $ ( ) < > \ " '
- IP/domain regex validation
- Port range validation (1-65535)
- CIDR notation support
- URL format verification
集装箱安全
- Based on official Kali Linux
- Non-root user (pentester UID 1000)
- Capability-based permissions (CAP_NET_RAW, CAP_NET_ADMIN)
- No persistent storage mounting
- Regular security updates
- Minimal attack surface
命令执行
- subprocess.run() with shell=False
- Explicit argument arrays
- Configurable timeout protection
- Comprehensive error handling
- Result capture and sanitization
🧪 开发与测试
本地测试
# Test MCP server directly
docker run --rm -i pentest-mcp-pro python3 pentest_server.py
# Interactive container for debugging
docker run --rm -it pentest-mcp-pro /bin/bash
# Test individual tools
docker run --rm pentest-mcp-pro nmap --version
docker run --rm pentest-mcp-pro masscan --version
docker run --rm pentest-mcp-pro sqlmap --version
# Check tool availability
docker run --rm pentest-mcp-pro python3 -c "import subprocess; [print(f'{t}: {subprocess.run([\"which\", t], capture_output=True).returncode == 0}') for t in ['nmap', 'masscan', 'sqlmap']]"
性能优化
# Multi-stage builds for smaller image size
# Cached wordlists for faster scanning
# Parallel tool installation in Dockerfile
# Pre-decompressed rockyou.txt wordlist
# Optimized Python dependencies
添加自定义工具
-
在Dockerfile中安装
RUN apt-get update && apt-get install -y --no-install-recommends \ new-security-tool \ && rm -rf /var/lib/apt/lists/* -
如果需要,添加功能
RUN setcap cap_net_raw+eip /usr/bin/new-tool || true -
创建包装函数
@mcp.tool() async def new_tool_scan(target: str = "") -> str: """Single-line professional description.""" # Implement security pattern target = sanitize_input(target) if not validate_ip_or_domain(target): return "❌ Error: Invalid target format" # Execute and handle results -
更新文档和工具清单
📁 项目结构
pentest-mcp-server/
├── Dockerfile # Professional container configuration
├── requirements.txt # Python dependencies
├── pentest_server.py # Main MCP server (1000+ lines)
├── README.md # Professional documentation (this file)
├── CLAUDE.md # Implementation guidelines
├── LICENSE # MIT License
└── results/ # Auto-generated scan results (in container)
├── nmap_*.txt
├── nikto_*.txt
├── sqlmap_*.txt
└── ...
📊 工具统计
- 40+专业工具 已安装并配置
- 9工具类别 覆盖整个pentest生命周期
- 网络侦察:6个工具
- Web应用程序测试:9个工具
- 剥削:2个框架
- 密码破解:4个工具
- 实施漏洞利用:2个工具
- SSL/TLS测试:2个工具
- 无线:1套房
- 公用事业:5+附加工具
- 结果管理:内置
🤝 贡献
欢迎专业人士投稿!请遵循:
- 分叉存储库
- 创建特征分支(
git checkout -b feature/advanced-tool) - 遵循新工具的安全指南
- 添加全面的测试和文档
- 更新工具统计数据和文档
- 提交详细的拉取请求
贡献指南
- 保持安全第一的方法
- 添加全面的错误处理
- 包括使用示例
- 更新专业文档
- 遵循Python最佳实践(PEP 8)
- 在适用的情况下添加类型提示
📜 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
⚠️ 免责声明
重要法律通知
该软件旨在用于 仅用于授权的安全测试和教育目的用户全权负责确保其使用符合:
- 所有适用的地方、州、联邦和国际法律
- 美国计算机欺诈和滥用法案(CFAA)
- 英国《计算机滥用法》
- 其他司法管辖区的类似立法
- 服务条款和可接受使用政策
- 合同义务和授权协议
未经授权使用此软件:
- 未经明确书面授权扫描、探测或攻击系统
- 未经许可访问系统或数据
- 中断服务或运营
- 违反隐私或安全措施
…是严格禁止的,可能会导致民事和刑事处罚。
作者和贡献者:
- 按“原样”提供此软件,不提供保修
- 对误用或损坏不承担责任
- 不要认可或鼓励未经授权的活动
- 建议使用前咨询法律顾问
使用本软件即表示您承认并同意这些条款。
🆘 支持与社区
- 问题: GitHub问题
- 文档:查看CLAUDE.md了解实施细节
- 安全问题:采用负责任的披露做法
- 专业支持:企业咨询联系人
🏆 致谢
内置:
- 卡利 Linux -进攻性安全
- 模型上下文协议 -人类学
- 码头工人 -集装箱化平台
- FastMCP -Python MCP框架
- 所有令人惊叹的开源安全工具开发人员
🏷️ 关键词
penetration-testing cybersecurity mcp-server kali-linux docker nmap metasploit sqlmap professional-security ethical-hacking security-tools claude-desktop vulnerability-scanning network-security web-security password-cracking post-exploitation
⭐ 如果您发现此存储库对专业安全评估有用,请将其标记为星号!
🔒 在测试你不拥有的系统之前,一定要获得授权。