Skip to main content
Glama

IDA Pro MCP Server

by fdrechsler

IDA Pro MCP 服务器

模型上下文协议 (MCP) 服务器使 AI 助手能够与 IDA Pro 交互以进行逆向工程和二进制分析任务。

概述

该项目在AI助手和IDA Pro之间架起了一座桥梁。IDA Pro是一款流行的反汇编和调试器,用于逆向工程软件。它由三个主要组件组成:

  1. IDA Pro 远程控制插件ida_remote_server.py ):一个 IDA Pro 插件,可创建 HTTP 服务器来远程控制 IDA Pro 功能。

  2. IDA 远程客户端idaremoteclient.ts ):用于与 IDA Pro 远程控制服务器交互的 TypeScript 客户端。

  3. MCP 服务器index.ts ):向 AI 助手公开 IDA Pro 功能的模型上下文协议服务器。

特征

  • 通过 AI 助手在 IDA Pro 中执行 Python 脚本

  • 检索有关二进制文件的信息:

    • 字符串

    • 导入

    • 出口

    • 功能

  • 高级二进制分析功能:

    • 在指令中搜索立即值

    • 在二进制文件中搜索文本字符串

    • 搜索特定的字节序列

    • 获取地址范围的反汇编

  • 通过标准化界面自动化IDA Pro操作

  • 组件之间的安全通信

先决条件

  • IDA Pro 8.3 或更高版本

  • Node.js 18 或更高版本

  • TypeScript

示例用法ida_remote_server.py

curl -X POST -H "Content-Type: application/json" -d '{"script":"print(\"Script initialization...\")"}' http://127.0.0.1:9045/api/execute {"success": true, "output": "Script initialization...\n"}

MCP 服务器使用示例

Roo输出

安装

1.安装IDA Pro远程控制插件

  1. ida_remote_server.py复制到您的 IDA Pro 插件目录:

    • Windows: %PROGRAMFILES%\IDA Pro\plugins

    • macOS: /Applications/IDA Pro.app/Contents/MacOS/plugins

    • Linux: /opt/idapro/plugins

  2. 启动 IDA Pro 并打开一个二进制文件。

  3. 该插件将自动在127.0.0.1:9045上启动 HTTP 服务器。

2. 安装 MCP 服务器

  1. 克隆此存储库:

    git clone <repository-url> cd ida-server
  2. 安装依赖项:

    npm install
  3. 构建项目:

    npm run build
  4. 在您的 AI 助手的 MCP 设置文件中配置 MCP 服务器:

    { "mcpServers": { "ida-pro": { "command": "node", "args": ["path/to/ida-server/dist/index.js"], "env": {} } } }

用法

一旦安装并配置完成,MCP 服务器将为 AI 助手提供以下工具:

运行ida命令

执行 IDA Pro Python 脚本。

参数:

  • scriptPath (必需):要执行的脚本文件的绝对路径

  • outputPath (可选):保存脚本输出的绝对路径

例子:

# Example IDA Pro script (save as /path/to/script.py) import idautils # Count functions function_count = len(list(idautils.Functions())) print(f"Binary has {function_count} functions") # Get the first 5 function names functions = list(idautils.Functions())[:5] for func_ea in functions: print(f"Function: {ida_name.get_ea_name(func_ea)} at {hex(func_ea)}") # Return data return_value = function_count

然后,AI 助手可以使用此脚本:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>run_ida_command</tool_name> <arguments> { "scriptPath": "/path/to/script.py" } </arguments> </use_mcp_tool>

搜索立即值

在二进制指令中搜索立即值。

参数:

  • value (必需):要搜索的值(数字或字符串)

  • radix (可选):数字转换的基数(默认值:16)

  • startAddress (可选):搜索的起始地址

  • endAddress (可选):搜索的结束地址

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>search_immediate_value</tool_name> <arguments> { "value": "42", "radix": 10 } </arguments> </use_mcp_tool>

搜索文本

在二进制文件中搜索文本字符串。

参数:

  • text (必填):要搜索的文本

  • caseSensitive (可选):搜索是否区分大小写(默认值:false)

  • startAddress (可选):搜索的起始地址

  • endAddress (可选):搜索的结束地址

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>search_text</tool_name> <arguments> { "text": "password", "caseSensitive": false } </arguments> </use_mcp_tool>

搜索字节序列

在二进制中搜索特定的字节序列。

参数:

  • bytes (必需):要搜索的字节序列(例如,“90 90 90”表示三个 NOP)

  • startAddress (可选):搜索的起始地址

  • endAddress (可选):搜索的结束地址

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>search_byte_sequence</tool_name> <arguments> { "bytes": "90 90 90" } </arguments> </use_mcp_tool>

获取反汇编

获取某个地址范围的反汇编。

参数:

  • startAddress (必需):反汇编的起始地址

  • endAddress (可选):反汇编的结束地址

  • count (可选):要反汇编的指令数量

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>get_disassembly</tool_name> <arguments> { "startAddress": "0x401000", "count": 10 } </arguments> </use_mcp_tool>

获取函数

从二进制文件中获取函数列表。

参数:

  • 无需

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>get_functions</tool_name> <arguments> {} </arguments> </use_mcp_tool>

获取导出

获取二进制文件的导出列表。

参数:

  • 无需

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>get_exports</tool_name> <arguments> {} </arguments> </use_mcp_tool>

获取字符串

从二进制文件中获取字符串列表。

参数:

  • 无需

例子:

<use_mcp_tool> <server_name>ida-pro</server_name> <tool_name>get_strings</tool_name> <arguments> {} </arguments> </use_mcp_tool>

IDA Pro 远程控制 API

IDA Pro 远程控制插件公开以下 HTTP 端点:

  • GET /api/info :获取插件信息

  • GET /api/strings :从二进制文件中获取字符串

  • GET /api/exports :从二进制文件中获取导出

  • GET /api/imports :从二进制文件中获取导入

  • GET /api/functions :获取函数列表

  • GET /api/search/immediate :在指令中搜索立即值

  • GET /api/search/text :在二进制文件中搜索文本

  • GET /api/search/bytes :在二进制文件中搜索字节序列

  • GET /api/disassembly :获取地址范围的反汇编

  • POST /api/execute :执行 Python 脚本(JSON/Form)

  • POST /api/executebypath :从文件路径执行 Python 脚本

  • POST /api/executebody :从原始主体执行 Python 脚本

安全注意事项

出于安全考虑,IDA Pro 远程控制插件默认仅监听127.0.0.1 (localhost)。这将阻止远程访问您的 IDA Pro 实例。

如果需要允许远程访问,可以修改ida_remote_server.py中的DEFAULT_HOST变量,但要注意安全隐患。

发展

从源代码构建

npm run build

运行测试

npm test

执照

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

作者

弗洛里安·德雷克斯勒 (@fdrechsler) fd@fdrechsler.com

Related MCP Servers

  • A
    security
    -
    license
    A
    quality
    A Model Context Protocol server for IDA interaction and automation. This server provides tools to read IDA database via Large Language Models.
    Last updated -
    19
    479
    MIT License
    • Apple
  • A
    security
    -
    license
    A
    quality
    MCP Server for automated reverse engineering with IDA Pro.
    Last updated -
    43
    3,847
    MIT License
    • Linux
    • Apple
  • -
    security
    -
    license
    -
    quality
    A Model Context Protocol server that allows AI assistants to invoke and interact with Integrator automation workflows through an API connection.
    Last updated -
    10
    MIT License
  • A
    security
    -
    license
    A
    quality
    A Model Context Protocol server that enables AI assistants to interact with Coda documents, allowing operations like listing, creating, reading, updating, and duplicating pages.
    Last updated -
    10
    99
    28
    MIT License
    • Apple
    • Linux

View all related MCP servers

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/fdrechsler/mcp-server-idapro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server