ghidraMCP

by LaurieWired
Verified
Apache 2.0
4,102
  • Apple

local-only server

The server can only run on the client’s local machine because it depends on local resources.

ghidraMCP

ghidraMCP 是一个模型上下文协议 (MLM) 服务器,允许 LLM 自主地对应用程序进行逆向工程。它向 MCP 客户端公开了 Ghidra 核心功能中的众多工具。

https://github.com/user-attachments/assets/36080514-f227-44bd-af84-78e29ee1d7f9

特征

MCP 服务器 + Ghidra 插件

  • 在 Ghidra 中反编译和分析二进制文件
  • 自动重命名方法和数据
  • 列出方法、类、导入和导出

安装

先决条件

吉德拉

首先,从此仓库下载最新版本。其中包含 Ghidra 插件和 Python MCP 客户端。然后,你可以直接将插件导入 Ghidra。

  1. 运行 Ghidra
  2. 选择File -> Install Extensions
  3. 点击+按钮
  4. 从下载的版本中选择GhidraMCP-1-2.zip (或您选择的版本)
  5. 重启 Ghidra
  6. 确保在File -> Configure -> Developer中启用了 GhidraMCPPlugin
  7. 可选:使用Edit -> Tool Options -> GhidraMCP HTTP Server在 Ghidra 中配置端口

视频安装指南:

https://github.com/user-attachments/assets/75f0c176-6da1-48dc-ad96-c182eb4648c3

MCP 客户端

理论上,任何 MCP 客户端都可以与 ghidraMCP 兼容。下面给出了两个示例。

示例 1:Claude Desktop

要将 Claude Desktop 设置为 Ghidra MCP 客户端,请转到Claude -> Settings -> Developer -> Edit Config -> claude_desktop_config.json并添加以下内容:

{ "mcpServers": { "ghidra": { "command": "python", "args": [ "/ABSOLUTE_PATH_TO/bridge_mcp_ghidra.py", "--ghidra-server", "http://127.0.0.1:8080/" ] } } }

或者,直接编辑此文件:

/Users/YOUR_USER/Library/Application Support/Claude/claude_desktop_config.json

服务器 IP 和端口可配置,应设置为指向目标 Ghidra 实例。如果未设置,则两者均默认为 localhost:8080。

示例 2:克莱恩

要将 GhidraMCP 与Cline一起使用,还需要手动运行 MCP 服务器。首先运行以下命令:

python bridge_mcp_ghidra.py --transport sse --mcp-host 127.0.0.1 --mcp-port 8081 --ghidra-server http://127.0.0.1:8080/

唯一必需的参数是传输。如果所有其他参数均未指定,则默认为上述参数。MCP 服务器启动后,打开 Cline 并选择顶部的MCP Servers

然后选择Remote Servers并添加以下内容,确保 URL 与 MCP 主机和端口匹配:

  1. 服务器名称:GhidraMCP
  2. 服务器网址: http://127.0.0.1:8081/sse 8081/sse

例 3:5ire

另一个支持后端多种模型的 MCP 客户端是5ire 。要设置 GhidraMCP,请打开 5ire,然后前往Tools -> New ,并设置以下配置:

  1. 工具密钥:ghidra
  2. 名称:GhidraMCP
  3. 命令: python /ABSOLUTE_PATH_TO/bridge_mcp_ghidra.py

从源代码构建

通过运行以下命令使用 Maven 进行构建:

mvn clean package assembly:single

生成的 zip 文件包含构建的 Ghidra 插件及其资源。这些文件是 Ghidra 识别新扩展所必需的。

  • lib/GhidraMCP.jar
  • 扩展属性
  • 模块清单
-
security - not tested
A
license - permissive license
-
quality - not tested

MCP 服务器允许 LLM 通过公开 Ghidra 功能自主地对应用程序进行逆向工程,从而实现方法和数据的反编译、分析和自动重命名。

  1. Features
    1. Installation
      1. Prerequisites
      2. Ghidra
      3. MCP Clients
      4. Example 1: Claude Desktop
      5. Example 2: Cline
      6. Example 3: 5ire
    2. Building from Source
      ID: 0k3c7mhg5q