GM

gh05tcrew/metasploitmcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

753 stars 214 forks 质量 74 趋势 22Apache-2.0

Metasploit 的 MCP 服务器

概览

一个用于Metasploit Framework集成的模型上下文协议(MCP)服务器。 https://github.com/user-attachments/assets/39b19fb5-8397-4ccd-b896-d1797ec185e1 该MCP服务器为大型语言模型如Claude与Metasploit Framework渗透测试平台之间提供了桥梁。它允许AI助手通过标准化工具动态访问和控制Metasploit功能,实现与复杂安全测试工作流程的自然语言接口。 - :搜索并列出可用的Metasploit漏洞利用模块- :搜索并列出可选的平台和架构过滤功能的Metasploit有效载荷模块 - : 配置并执行针对目标的漏洞利用,并提供先行检查的选项 - : 运行任何带有自定义选项的Metasploit辅助模块 - : 对现有会话执行利用后模块 - : 使用 Metasploit RPC 生成载荷文件(本地保存文件) - : 显示当前Metasploit会话,附有详细信息 - :...

概述(AI 翻译)

一个用于Metasploit Framework集成的模型上下文协议(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 生成载荷文件(本地保存文件)

会话管理

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Metasploit MCP Server

A Model Context Protocol (MCP) server for Metasploit Framework integration.

https://github.com/user-attachments/assets/39b19fb5-8397-4ccd-b896-d1797ec185e1

Description

This MCP server provides a bridge between large language models like Claude and the Metasploit Framework penetration testing platform. It allows AI assistants to dynamically access and control Metasploit functionality through standardized tools, enabling a natural language interface to complex security testing workflows.

Features

Module Information

  • list_exploits: Search and list available Metasploit exploit modules
  • list_payloads: Search and list available Metasploit payload modules with optional platform and architecture filtering

Exploitation Workflow

  • run_exploit: Configure and execute an exploit against a target with options to run checks first
  • run_auxiliary_module: Run any Metasploit auxiliary module with custom options
  • run_post_module: Execute post-exploitation modules against existing sessions

Payload Generation

  • generate_payload: Generate payload files using Metasploit RPC (saves files locally)

Session Management

  • list_active_sessions: Show current Metasploit sessions with detailed information
  • send_session_command: Run a command in an active shell or Meterpreter session
  • terminate_session: Forcefully end an active session

Handler Management

  • list_listeners: Show all active handlers and background jobs
  • start_listener: Create a new multi/handler to receive connections
  • stop_job: Terminate any running job or handler

Prerequisites

  • Metasploit Framework installed and msfrpcd running
  • Python 3.10 or higher
  • Required Python packages (see requirements.txt)

Installation

  1. Clone this repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Configure environment variables (optional):
    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
    

Usage

Start the Metasploit RPC service:

msfrpcd -P yourpassword -S -a 127.0.0.1 -p 55553

Transport Options

The server supports two transport methods:

  • HTTP/SSE (Server-Sent Events): Default mode for interoperability with most MCP clients
  • STDIO (Standard Input/Output): Used with Claude Desktop and similar direct pipe connections

You can explicitly select the transport mode using the --transport flag:

# Run with HTTP/SSE transport (default)
python MetasploitMCP.py --transport http

# Run with STDIO transport
python MetasploitMCP.py --transport stdio

Additional options for HTTP mode:

python MetasploitMCP.py --transport http --host 0.0.0.0 --port 8085

Claude Desktop Integration

For Claude Desktop integration, configure claude_desktop_config.json:

{
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "metasploit": { "command": "uv", "args": [ "--directory", "C:\\path\\to\\MetasploitMCP", "run", "MetasploitMCP.py", "--transport", "stdio" ], "env": { "MSF_PASSWORD": "yourpassword" } } } }