ida-reverse – skill Dữ liệu & Khoa học cho agent AI
Dịch ngược binary bằng IDA Pro: giải mã (decompile), dịch assembly, theo dõi luồng dữ liệu, tham chiếu chéo và tự động hóa IDA MCP để phân tích tĩnh sâu các mục tiêu PE/ELF/Mach-O.
Cài skill ida-reverse bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/ida-reverse-873e9.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /ida-reverse – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/ida-reverse-873e9.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $ida-reverse – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/ida-reverse-873e9.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /ida-reverse – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/ida-reverse-873e9.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /ida-reverse – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Bundled upstream support
Supporting files are included at skill-relative paths. See [UPSTREAM-NOTICE.md](UPSTREAM-NOTICE.md) for their pinned sources, licenses, hashes, and import changes.
Supporting material availability
These paths remain unavailable in this catalog copy:
<support-root>/scripts/start.ps1<support-root>/scripts/install-autostart.ps1
Do not invoke a step that requires one of these files. Obtain the original material and review its dependencies, license, and effects before use. Independent inline steps and the bundled helpers can proceed within the user’s authorized scope.
IDA Pro 逆向分析技能
When to Use
- Deep static analysis of a compiled target where IDA is available.
- Tracking data flow or cross-references through large binaries.
Catalog safety boundary
Use only licensed IDA and authorized samples. This tree does not bundle start.ps1, watchdog.ps1, bootstrap or autostart installer; all related claims below are upstream descriptions, not current-host guarantees. Inspect configured tool schemas and never bypass a permission/policy rejection by switching to direct HTTP. Opening an untrusted binary can execute analysis plugins; use an isolated environment. py_eval, debugger, patch, save and rename capabilities can execute code or mutate files and need the appropriate authorization. Avoid --unsafe/global registration/autostart by default; pin and review external dependencies before installation. Do not upload proprietary binaries or symbols to external services without authorization.
已知问题与反思(必读)
踩过的坑
1. idb_open(旧名 idalib_open)不要直接靠部分 AI 客户端 MCP 调用
- 部分代码 AI 客户端 的 MCP 客户端对 open 类工具的 output schema 校验有 BUG
- 报错:
Structured content does not match the tool's output schema - 解决办法:使用
scripts/open.ps1脚本通过 HTTP API 直调,绕过 MCP 校验层 - 当前 ida-pro-mcp 2.x 工具名为
idb_open/idb_list/idb_save(不再是idalib_*) - 文件打开后返回
session_id(database),后续工具调用需带该 session
2. C:\Windows\System32\ 文件无权限打开
- idalib 无法直接读取 System32 目录下的文件
- 解决办法:
open.ps1自动检测并复制到临时目录目录后再打开
3. 启动服务器命令阻塞对话
idalib-mcp启动后会持续输出 INFO 日志到控制台- 解决办法:使用
scripts/start.ps1(-WindowStyle Hidden后台静默启动) - 脚本会等待服务就绪后自动退出,不阻塞对话
4. MCP 服务器名不能用横线
- 之前用
ida-pro-mcp作为服务器名,可能引起工具注册问题 - 当前配置:服务器名
idapro,工具前缀idapro_*
5. Remote HTTP vs Local Stdio
type:"local"(stdio)模式:idalib_open同样有 schema 校验问题type:"remote"(HTTP)模式:可以先用脚本直开文件,再用 MCP 工具- 当前方案:Remote HTTP 模式
6. PR #389 修复了部分 schema 问题
- 作者 mrexodia 在 issue #388 后通过 PR #389 合并了修复
- 修复了 HTTP 模式下的 structuredContent schema,但 部分代码 AI 客户端 侧校验仍有问题
- 已安装最新
main分支版本
7. idalib 超时留下孤儿 worker 进程锁文件
- 第一次
open.ps1超时后,idalib 的 python worker 子进程可能变成孤儿,咬着.id0/.id1/.nam不放 - 后续任何工具或手动拖入 IDA GUI 都会报"权限不足"
- 禁止
taskkill /F /T杀进程树——/T会把 GUIida.exe子进程一起干掉 - 解决办法:
start.ps1只在端口无人监听、或tools/list快速返回但缺py_eval(旧 supervisor)时替换 managed supervisor;RPC 超时且 13337 仍在听视为忙,不杀 - 兜底:
open.ps1检测到旧库被锁自动复制到 Temp 并加 GUID 前缀
8. 带自动分析打开看起来像卡死
idalib_open(run_auto_analysis=true)可能长时间不回包,但后端实际上仍在继续打开和分析- 之前用户侧看到的是“PowerShell 一直无输出”,容易误判成脚本卡死
- 当前解决办法:
open.ps1新增-TimeoutSeconds,并改为后台请求 + 前台轮询 + 定时进度输出 - 轮询到会话已就绪时会提前返回
OK:文件名:session_id,超时则返回ERR:open_timeout_xxs
9. HTTP MCP 会在登录后静默退出
- Cursor/Claude 的
type: http不会代为拉起进程;旧计划任务只在登录时跑一次 pythonw无控制台,崩溃时 Application 日志也是空的- 解决办法:
start.ps1默认健康则复用;watchdog.ps1每分钟巡检;日志在%LOCALAPPDATA%\reverse-skill\ida-mcp\ - 安装:
scripts/install-autostart.ps1。Cursor 若启动时端口还没起来,仍需在 MCP 面板手动刷新一次
工作流程原则
| 步骤 | 做什么 | 用什么 |
|------|--------|--------|
| 1 | 确保 HTTP 服务器在运行 | scripts/start.ps1(无参数) |
| 2 | 打开目标二进制文件 | scripts/open.ps1 -Path "xxx.exe" |
| 3 | 使用 MCP 分析工具 | 直接调用 idapro_* / HTTP tools(约 65 个,视版本而定) |
| 4 | 分析完毕 | 工具自动可用 |
脚本资源
start.ps1 — 启动 MCP HTTP 服务器
路径:scripts/start.ps1
- 自动解析
IDADIR(环境变量 / 便携版桌面路径 / 常见安装路径) - 优先用 IDA 自带
Python314\python.exe -m ida_pro_mcp.idalib_supervisor - 默认先探测
http://127.0.0.1:13337/mcp,健康则输出OK:<n>:reuse并退出 - 13337 在听但
tools/list超时 →WARN:busy/OK:busy:reuse,不杀(supervisor 单线程,开库时无法回包) - 仅在端口无人监听、或快速返回且缺
py_eval时替换 managed supervisor;永不杀ida.exe,不用taskkill /T - GUI 占用 13337 时输出
WARN:gui_busy并退出,不另起 supervisor - 成功输出
OK:<工具数>(当前约 66),失败输出ERR:timeout - supervisor 日志:
%LOCALAPPDATA%\reverse-skill\ida-mcp\supervisor.log - 服务器在后台运行,不阻塞对话
调用方式:
powershell -File "<skill-root>\ida-reverse\scripts\start.ps1"watchdog.ps1 / install-autostart.ps1 — 保活
watchdog.ps1:探测 13337,健康则OK:<n>:reuse,挂了才调用start.ps1install-autostart.ps1:注册计划任务reverse-skill-ida-mcp(登录 + 每分钟)- 日志:
%LOCALAPPDATA%\reverse-skill\ida-mcp\watchdog.log
open.ps1 — 打开二进制文件
路径:scripts/open.ps1
- 通过 HTTP API 直调
idb_open,绕过 MCP schema 校验 - 自动检测 System32 路径并复制到临时目录
- 检测已有 sidecar 后优先临时副本;不删除
.i64/.idb数据库 - 旧库被锁时自动降级:复制到 Temp 加 GUID 前缀后打开,不报错
- 将打开请求放到后台执行,避免长时间同步等待导致脚本无响应
- 支持
-TimeoutSeconds,超时后返回ERR:open_timeout_xxs,不会无限卡住 - 每隔 10 秒输出一次
INFO:opening:已用时/超时秒数,便于判断仍在分析中 - 成功输出
OK:文件名:session_id,降级时加(temp copy)标记 - 失败时自动重试走 Temp 副本
调用方式:
powershell -File "<skill-root>\ida-reverse\scripts\open.ps1" -Path "C:\path\to\file.exe"可选参数:
# 指定 SessionId
powershell -File "scripts\open.ps1" -Path "file.exe" -SessionId "my_session"
# 跳过自动分析(大文件推荐)
powershell -File "scripts\open.ps1" -Path "large.exe" -NoAutoAnalysis
# 设置超时,避免带自动分析时长时间无返回
powershell -File "scripts\open.ps1" -Path "file.exe" -TimeoutSeconds 600输出约定:
# 分析进行中(每 10 秒输出一次)
INFO:opening:11/600s
# 成功打开
OK:sample.exe:abcd1234
# 成功打开,但因锁文件降级到 Temp 副本
OK:1234abcd-sample.exe:abcd1234 (temp copy)
# 达到超时上限
ERR:open_timeout_600s实测说明:
Snipaste.exe带自动分析实测约324s才返回成功,属于“分析很久”而不是“脚本死锁”- 因此遇到 GUI 程序或较复杂样本时,建议优先显式设置
-TimeoutSeconds 600
核心工具列表
概况分析(第一步)
idapro_survey_binary(detail_level="minimal")— 快速概况:函数数、字符串、段、入口点、导入分类(加密/网络/文件IO)idapro_list_funcs(queries)— 列出函数(分页、按名称过滤)idapro_list_globals(queries)— 列出全局变量idapro_entity_query(kind, filter)— 统一查询:functions/globals/imports/strings/names
反编译与反汇编
idapro_decompile(addr)— 反编译为伪代码idapro_disasm(addr, max_instructions=N)— 反汇编idapro_analyze_function(addr, include_asm=false)— 综合分析(伪代码+字符串+常量+调用者+被调用者+块)idapro_func_profile(queries)— 函数概要指标
交叉引用与数据流
idapro_xrefs_to(addrs)— 查谁引用目标地址idapro_xref_query(addr, direction)— 高级 xref 查询(方向/类型过滤)idapro_callees(addrs)— 子函数列表idapro_callgraph(roots, max_depth)— 调用图idapro_trace_data_flow(addr, direction, max_depth)— 数据流追踪(forward/backward)
搜索
idapro_find_regex(pattern, limit)— 正则搜字符串idapro_search_text(pattern)— 在反汇编列表中搜文本idapro_find_bytes(patterns, limit)— 字节模式搜索(支持 ?? 通配符)idapro_find(type, targets)— 高级搜索(立即数/字符串/引用)
内存与数据
idapro_get_bytes(addrs)— 读原始字节idapro_get_string(addrs)— 读字符串idapro_get_int(queries)— 读整数值idapro_get_global_value(queries)— 读全局变量值idapro_read_struct(queries)— 读结构体字段值idapro_search_structs(filter)— 搜索结构体
修改操作
idapro_set_comments(items)— 添加注释(反汇编+反编译双向同步)idapro_append_comments(items)— 追加注释idapro_rename(batch)— 批量重命名(函数/全局/局部/栈变量)idapro_patch_asm(items)— Patch 汇编指令idapro_patch(patches)— Patch 字节idapro_define_func(items)— 定义函数idapro_undefine(items)— 取消定义idapro_define_code(items)— 将字节转为代码
类型系统
idapro_declare_type(decls)— 声明 C 结构体/枚举/联合体idapro_set_type(edits)— 应用类型到函数/全局/局部idapro_infer_types(addrs)— 推断类型idapro_type_query(queries)— 查询已声明类型idapro_type_inspect(queries)— 查看类型详情
栈帧
idapro_stack_frame(addrs)— 查看栈帧变量idapro_declare_stack(items)— 声明栈变量idapro_delete_stack(items)— 删除栈变量
签名
idapro_make_signature(addrs)— 为地址生成唯一字节签名idapro_make_signature_for_function(addrs)— 为函数生成签名idapro_find_xref_signatures(addrs)— 为引用地址的代码生成签名
调试器(需要 ?ext=dbg)
idapro_open_file(file_path)— 在 GUI IDA 实例中打开文件- 调试器工具默认隐藏,可通过 URL 参数
?ext=dbg启用
会话管理(ida-pro-mcp 2.x)
idapro_idb_open/ HTTPidb_open— ⚠️ 建议用open.ps1打开idapro_idb_list/ HTTPidb_list— 列出所有 sessionidapro_idb_save/ HTTPidb_save— 保存数据库- 多数分析工具需要
database=<session_id>参数(open.ps1 输出的 session)
其他
idapro_int_convert(inputs)— 进制转换(必须用这个,不要自己算进制!)idapro_export_funcs(addrs, format)— 导出函数(json/c_header/prototypes)idapro_py_eval(code)— 在 IDA 上下文执行 Pythonidapro_server_health()— 服务器健康检查idapro_server_warmup()— 预热子系统(字符串缓存、Hex-Rays 等)
逆向分析完整工作流
Step 1: 启动服务器
路径 A — Headless idalib(需要有效 license)
powershell -File "scripts/start.ps1"输出 OK:<工具数>(当前约 65)表示就绪。
路径 B — GUI + 插件(idalib license 失败或需要交互分析时)
powershell -File "scripts/start-gui.ps1" -Path "C:\目标.exe"或双击便携版 Launch-IDA-Pro.cmd,在 IDA 中打开样本。
确认 Output 窗口出现 `
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- stock-analysis – Lập phân tích cơ bản đa yếu tố, chặt chẽ và so sánh theo ngành cho một công ty niêm yết…
- idea-os – Quy trình năm giai đoạn (phân loại → làm rõ → nghiên cứu → PRD → kế hoạch) biến ý tưởng…
- strategic-alignment – Truyền đạt chiến lược từ ban lãnh đạo đến từng cá nhân đóng góp. Phát hiện và sửa sai…
- infinite-gratitude – Lập kế hoạch và tổng hợp nghiên cứu đa góc nhìn; chỉ dùng agent song song khi được cho…
- infinity – Áp dụng giao thức ranh giới đầu vào nghiêm ngặt (phát hiện, phân loại, lọc, xác minh) để…
- syllabus – Tạo danh sách tài liệu đọc bổ sung được chọn lọc từ bất kỳ đề cương môn học nào bằng tìm…
- invokely-statistics – Dùng Invokely MCP để tìm số liệu thống kê chính thức, lấy giá trị và chuỗi số liệu, so…
- it-manager-pro – Cố vấn quản lý CNTT tinh hoa, chuyên về chiến lược dựa trên dữ liệu, truyền thông điều…