ph4ntom-rev/antigravity-ida-bridge

GitHub: ph4ntom-rev/antigravity-ida-bridge

将 IDA Pro 变身为拥有 90+ REST 端点的 API 服务器,让各类 AI 代理能够远程控制 IDA 进行自动化逆向分析。

Stars: 0 | Forks: 0

# Antigravity IDA Bridge 🌉 [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg?style=flat-square)](https://python.org) [![IDA Pro 9.x](https://img.shields.io/badge/IDA_Pro-9.x-blueviolet?style=flat-square)](https://hex-rays.com) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](LICENSE) [![Endpoints](https://img.shields.io/badge/endpoints-90+-orange?style=flat-square)](#api-coverage) [![MCP](https://img.shields.io/badge/MCP-Compatible-00ff41?style=flat-square)](#2-mcp-server) [![Backends](https://img.shields.io/badge/AI_backends-5-ff6b6b?style=flat-square)](#3-standalone-agent) ## 这是什么? 一个用于 **IDA Pro** 的插件,将其转变为一个拥有 **90 多个 REST 端点**的 API 服务器。任何 AI 代理 —— 无论是基于 IDE 的、云端的、本地的,还是 MCP —— 都可以控制 IDA Pro、反编译代码、追踪交叉引用、重命名函数,甚至**动态生成并执行 IDAPython 脚本**。 ``` ┌─────────────────────────────────────────┐ │ IDA Pro 9.x │ │ antigravity_server.py (90+ endpoints) │ │ http://127.0.0.1:13370 │ └──────────────────┬──────────────────────┘ │ REST / JSON ┌───────────┬───────────┼───────────┬───────────┐ ▼ ▼ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │Antigravity│ │ MCP │ │Standalone│ │ Direct │ │ Swarm │ │ IDE │ │ Server │ │ Agent │ │ API │ │ Worker │ │ │ │ │ │ │ │ │ │ │ │ bridge.py│ │ 45 tools │ │ 5 LLMs │ │ curl / │ │ Bulk │ │ + skill │ │ Claude │ │ Ollama │ │ Python │ │ scan │ │ │ │ Cursor │ │ Gemini │ │ │ │ │ └──────────┘ └──────────┘ └────────┘ └────────┘ └────────┘ ``` ## 4 种连接方式 ### 1. AI IDE 代理 (Antigravity IDE / Cursor / Windsurf) 你的 IDE 已经有了一个 AI 代理。赋予它**在 IDA 中操作的能力** —— 它会读取 `agent_config.json`,调用 `bridge.py`,并获取返回的 JSON。 ``` You: "find all network functions in this binary" IDE Agent reads: agent_config.json (knows all commands + script execution) IDE Agent runs: python bridge.py strings --filter socket → JSON IDE Agent runs: python bridge.py decompile 0x140005A00 → JSON IDE Agent runs: python bridge.py exec "print(idautils...)" → JSON IDE Agent: "Found 3 network functions, here's what they do..." ``` **设置:** 将 `AGENT_SKILL.md` 和 `agent_config.json` 放在你的工作区中。代理会自动读取它们。 ### 2. MCP Server (Claude Desktop / Cursor / Cline) 45 个原生 MCP 工具。除了指向服务器之外,零配置。 ``` { "mcpServers": { "ida-bridge": { "command": "python", "args": ["path/to/integrations/mcp_server.py"] } } } ``` ### 3. 独立代理(不需要 IDE) 内置 AI 代理,拥有 5 个可互换的后端: ``` python agent.py # Auto-detect best backend python agent.py --backend ollama # 🏠 Local (free, private) python agent.py --backend gemini # ☁️ Google Gemini python agent.py --backend openai # ☁️ OpenAI GPT-4o python agent.py --backend anthropic # ☁️ Anthropic Claude python agent.py --backend deepseek # ☁️ DeepSeek ``` ### 4. 直接 REST API(任何 HTTP 客户端) ``` curl http://127.0.0.1:13370/api/info curl http://127.0.0.1:13370/api/function/0x140001000/pseudocode curl -X POST http://127.0.0.1:13370/api/exec -d '{"script":"print(here())"}' ``` ## 动态脚本执行 最强大的功能:**AI 代理可以生成 Python 脚本并在 IDA Pro 中实时执行它们**。 这不仅限于 90 个预建的端点。代理可以编写*任何* IDAPython 代码: ``` # Agent 动态生成此 script 并将其发送至 /api/exec: import idautils, idc result['suspicious'] = [] for ea in idautils.Functions(): name = idc.get_func_name(ea) for ref in idautils.CodeRefsFrom(ea, 0): api = idc.get_func_name(ref) if api in ['CreateRemoteThread', 'VirtualAllocEx', 'WriteProcessMemory']: result['suspicious'].append({ 'function': name, 'address': hex(ea), 'calls': api }) ``` 可用的 IDA SDK 模块:`idc`, `idaapi`, `idautils`, `ida_hexrays`, `ida_funcs`, `ida_bytes`, `ida_struct`, `ida_dbg`, `ida_typeinf`, `ida_segment`, `ida_xref`, `ida_auto` 等 10 多个模块。 代理可以在 `agent_config.json` 中看到带有示例的完整列表。 ## 快速开始 ### 1. 安装插件 将 `ida_plugin/antigravity_server.py` 复制到 IDA 的 `plugins/` 文件夹中。 ### 2. 安装依赖 ``` pip install requests # Core (required) pip install ollama # Local LLM backend pip install google-genai # Gemini backend pip install openai # OpenAI / DeepSeek backend pip install anthropic # Claude backend pip install fastmcp # MCP Server ``` ### 3. 使用 ``` # Terminal CLI python bridge.py ping python bridge.py info python bridge.py decompile 0x140001000 python bridge.py strings --filter password python bridge.py launch binary.exe python bridge.py exec "print(idc.get_func_name(here()))" # Interactive agent python agent.py --backend ollama ``` ## 关键文件 | 文件 | 面向对象 | 用途 | |:-----|:---------|:--------| | `agent_config.json` | **任何 AI 代理** | 机器可读的配置 —— 包含所有命令、所有模式及脚本示例 | | `AGENT_SKILL.md` | **IDE 代理** | 面向 IDE AI 代理的人类可读说明 | | `bridge.py` | **IDE 代理** | 单文件 CLI —— 包含所有命令,输出整洁的 JSON | | `ida_plugin/antigravity_server.py` | **IDA Pro** | HTTP 服务器插件(90 多个端点) | | `integrations/mcp_server.py` | **MCP 客户端** | 45 个适用于 Claude/Cursor/Cline 的 MCP 工具 | | `agent.py` | **终端用户** | 具有 5 个 AI 后端的独立代理 | | `api_schema.json` | **代理** | 完整的 API 规范(系统提示词) | ## API 覆盖范围
📖 完整端点列表 (90+) ### 读取端点 (GET) | 类别 | 端点 | |:---------|:----------| | **二进制信息** | `/api/info`, `/api/ping`, `/api/schema` | | **函数** | `/api/functions`, `/api/functions-page`, `/api/function//details` | | **反编译** | `/api/function//pseudocode`, `/api/function//ctree`, `/api/function//microcode` | | **变量** | `/api/function//lvar-map`, `/api/function//args`, `/api/function//stack-vars` | | **交叉引用** | `/api/function//xrefs-to`, `/api/function//xrefs-from`, `/api/data-xrefs/`, `/api/code-xrefs/` | | **导航** | `/api/function//callers`, `/api/function//callees`, `/api/function//call-graph`, `/api/function//strings-used` | | **控制流** | `/api/function//basic-blocks` | | **字符串与搜索** | `/api/strings`, `/api/search-func/`, `/api/search-bytes/`, `/api/search-text/` | | **导入/导出** | `/api/imports`, `/api/exports` | | **类型与结构体** | `/api/structs`, `/api/struct/`, `/api/enums`, `/api/enum/`, `/api/types`, `/api/type/`, `/api/type-libraries` | | **内存** | `/api/bytes//`, `/api/vtable/`, `/api/segments`, `/api/global-vars` | | **调试器** | `/api/dbg/regs`, `/api/dbg/breakpoints`, `/api/dbg/threads`, `/api/dbg/stack`, `/api/dbg/memory//` | | **UI** | `/api/cursor`, `/api/selection`, `/api/bookmarks`, `/api/patches`, `/api/gaps` | ### 写入端点 (POST) | 类别 | 端点 | |:---------|:----------| | **命名** | `rename`, `lvar-rename`, `set-name`, `comment`, `lvar-comment` | | **类型** | `set-type`, `lvar-set-type`, `type/create`, `type/delete`, `type-library/load` | | **结构体** | `struct/create`, `struct/add-member`, `delete-struct`, `apply-struct` | | **枚举** | `enum/create`, `enum/add-member`, `delete-enum` | | **段** | `segment/create`, `segment/delete`, `segment/set-attrs` | | **二进制修改** | `patch-bytes`, `make-code`, `make-data`, `make-func`, `delete-func`, `undefine` | | **调试器** | `dbg/start`, `dbg/attach`, `dbg/detach`, `dbg/breakpoint`, `dbg/step-into`, `dbg/step-over`, `dbg/continue`, `dbg/pause`, `dbg/write-memory` | | **脚本** | `exec` — **执行由 AI 生成的任何 IDAPython 脚本** | | **实用工具** | `batch`, `save`, `undo`, `redo`, `navigate`, `reanalyze` |
## 安全性 - **Bearer Token 认证** —— 每次会话自动生成,存储在临时文件中 - **仅限 Localhost** —— 绑定到 `127.0.0.1`,不对外部网络暴露 - **路径加固** —— 防止目录遍历和 UNC 路径攻击 - **原子回滚** —— `undo` 端点可撤销 AI 造成的错误操作 ## 许可证 MIT
标签:AI风险缓解, API服务器, CTF工具, DAST, DLL 劫持, IDA Pro, IDAPython, IDA插件, MCP, Python, REST API, TLS抓取, URL提取, 二进制分析, 云安全监控, 云安全运维, 云资产清单, 人工智能, 反编译, 后端开发, 大语言模型, 恶意软件分析, 执行流追踪, 数字取证, 无后门, 漏洞搜索, 用户模式Hook绕过, 自动化分析, 自动化脚本, 跨平台分析, 跨站脚本, 软件安全, 逆向工具, 逆向工程, 集群 Worker, 静态分析