GhidraMCP逆向工程服务器

GhidraMCP是一个模型上下文协议服务器,允许LLMs自主逆向工程应用程序,提供Ghidra核心功能工具。

  • by albertlab0
  • Java
  • 本地部署
  • 更新于
在 GitHub 查看 albertlab0/GhidraMCP

使用说明

ghidraMCP

ghidraMCP是一个模型上下文协议服务器,允许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. 确保在中启用了GhidraMCP插件 File -> Configure -> Developer
  7. 可选的:在Ghidra中配置端口 Edit -> Tool Options -> GhidraMCP HTTP Server

视频安装指南:

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

MCP客户端

理论上,任何MCP客户端都应该使用ghidraMCP。下面给出了三个例子。

示例1:克劳德桌面

要将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:Cline

使用GhidraMCP 克莱恩,这也需要手动运行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. 服务器URL: http://127.0.0.1:8081/sse

示例3:5ire

另一个在后端支持多种型号的MCP客户端是 5ire.要设置GhidraMCP,请打开5ire并转到 Tools -> New 并设置以下配置:

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

从源头构建

  1. 将以下文件从Ghidra目录复制到此项目的 lib/ 目录:
  • Ghidra/Features/Base/lib/Base.jar
  • Ghidra/Features/Decompiler/lib/Decompiler.jar
  • Ghidra/Framework/Docking/lib/Docking.jar
  • Ghidra/Framework/Generic/lib/Generic.jar
  • Ghidra/Framework/Project/lib/Project.jar
  • Ghidra/Framework/SoftwareModeling/lib/SoftwareModeling.jar
  • Ghidra/Framework/Utility/lib/Utility.jar
  • Ghidra/Framework/Gui/lib/Gui.jar
  1. 通过运行以下命令使用Maven构建:

mvn clean package assembly:single

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

  • lib/GhidraMCP.jar
  • extensions.properties
  • 模块.清单