Heretek-RE/re-llm-decompile

GitHub: Heretek-RE/re-llm-decompile

一个 MCP 服务器,通过 OpenAI 兼容接口调用 LLM4Decompile 或 Ollama 等模型,将反汇编代码转换为类 C 伪代码并支持函数解释与变量重命名。

Stars: 0 | Forks: 0

# re-llm-decompile 这是一个 MCP server,通过兼容 OpenAI 的 `/v1/chat/completions` API 暴露了一个 **AI 反编译器**。支持以下工具: - **[LLM4Decompile](https://github.com/albertan017/LLM4Decompile)**(包括 `End` 或 `Ref` 变体,或最新的 SK²Decompile),通过 vLLM 提供 - **[Ollama](https://ollama.com/)** 运行任意代码模型(CodeLlama, DeepSeek-Coder, Qwen2.5-Coder 等) - 任何其他兼容 OpenAI 的 endpoint 该服务器本身**不会**读取文件。预期由调用者(Claude Code)通过 `re-rizin.disassemble_function` 获取反汇编代码并将其传入。该服务器的工作是获取反汇编代码以及可选的原始字节,并生成类 C 伪代码。 ## 工具 | 工具 | 功能 | |---|---| | `check_endpoint` | 请求 `/v1/models`,返回可用模型列表 | | `decompile_function` | 将反汇编代码发送给 LLM,返回类 C 伪代码 | | `explain_function` | 让 LLM 解释反汇编代码(不进行重写) | | `rename_variables` | 让 LLM 为编译器生成的符号提供更好的命名建议 | | `summarize_binary` | 根据字符串 + 导入 + 入口点反汇编生成整个二进制文件的摘要 | ## 配置 | 环境变量 | 默认值 | 用途 | |---|---|---| | `LLM_DECOMPILE_ENDPOINT` | `http://localhost:11434/v1` | 兼容 OpenAI 的 base URL | | `LLM_DECOMPILE_MODEL` | `llm4decompile` | 要请求的模型名称 | | `LLM_DECOMPILE_API_KEY` | (空) | API key(用于 OpenAI 时填写 `sk-...`;用于 Ollama 时留空) | ## 安装 该服务器是 RE-AI 插件的一部分。插件的 `install.sh` / `install.bat` 会将其作为标准流程的一部分进行安装。 如需独立安装: ``` pip install -e ./servers/re-llm-decompile ``` ## 运行 ``` re-llm-decompile # stdio transport (default for MCP) python -m re_llm_decompile # equivalent ``` ## 使用模式(在 Claude Code 中) ``` 1. "Decompile main in /bin/ls" 2. Claude calls re-rizin.analyze_function → function list 3. Claude calls re-rizin.disassemble_function(name="main") → asm 4. Claude calls re-llm-decompile.decompile_function(asm=..., arch="x86_64") 5. Claude returns the C-like pseudocode to the user ``` ## 选择模型 - **LLM4Decompile 22B (Ref):** 对于 Linux x86_64 二进制文件质量最好,需要约 44GB VRAM(或 AWQ/GPTQ 量化版本)。 - **LLM4Decompile 6.7B (Ref):** 很好的折中方案,约需 14GB VRAM。 - **Ollama + Qwen2.5-Coder 7B:** 不错的通用代码模型。对于纯二进制反编译,质量低于 LLM4Decompile,但能很好地解释反汇编代码。 - **Claude / GPT(通过此服务器):** 不推荐 — prompt 已针对开源反编译模型进行了调优。如果你想使用 Claude,请直接通过 Claude Code 调用,而不是通过此服务器。 ## 弃用说明 v1 版的 `re-ai` 仓库没有此服务器 — 它试图在自己的 agent 循环中使用 pefile+capstone+llm prompts 进行反编译。那正是 Claude Code 所擅长的事情。此服务器的存在是为了给 Claude Code 提供一个纯粹的反编译控制接口。
标签:AI大模型, AI风险缓解, LLM评估, MCP服务, Ollama, Petitpotam, URL提取, vLLM, 云资产清单, 代码分析, 凭证管理, 反编译, 逆向工具, 逆向工程