agent-security-hardening
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
IDA Pro 逆向分析辅助技能。当用户提到逆向、反编译、分析二进制/PE/ELF/APK/DLL/SO、破解、找密码、漏洞分析、病毒分析、firmware 固件分析,或需要分析 exe/dll/so/elf/macho/sys 等文件时,务必使用此技能。 Ensure to use this skill when the user wants to analyze any binary file, regardless of whether they explicitly mention "IDA" or "reverse engineering". This includes requests like "看看这个exe", "分析这个dll", "帮我破解", "找一下密码", "这个软件怎么注册", etc. Use the bundled scripts (scripts/start.ps1, scripts/open.ps1) for deterministic server management and file opening — do NOT write ad-hoc PowerShell commands for these operations.
idalib_open 不能通过 OpenCode MCP 直接调用
idalib_open 的 output schema 校验有 BUGStructured content does not match the tool's output schemascripts/open.ps1 脚本通过 HTTP API 直调,绕过 MCP 校验层idapro_* 工具可直接使用C:\Windows\System32\ 文件无权限打开
open.ps1 自动检测并复制到 Temp\opencode\ 目录后再打开启动服务器命令阻塞对话
idalib-mcp 启动后会持续输出 INFO 日志到控制台scripts/start.ps1(-WindowStyle Hidden 后台静默启动)MCP 服务器名不能用横线
ida-pro-mcp 作为服务器名,可能引起工具注册问题idapro,工具前缀 idapro_*Remote HTTP vs Local Stdio
type:"local"(stdio)模式:idalib_open 同样有 schema 校验问题type:"remote"(HTTP)模式:可以先用脚本直开文件,再用 MCP 工具PR #389 修复了部分 schema 问题
main 分支版本idalib 超时留下孤儿 worker 进程锁文件
open.ps1 超时后,idalib 的 python worker 子进程变成孤儿进程,咬着 .id0/.id1/.nam 不放start.ps1 改用 taskkill /F /T 杀进程树,不再留孤儿open.ps1 加了自动降级,检测到旧库被锁自动复制到 Temp 并加 GUID 前缀带自动分析打开看起来像卡死
idalib_open(run_auto_analysis=true) 可能长时间不回包,但后端实际上仍在继续打开和分析open.ps1 新增 -TimeoutSeconds,并改为后台请求 + 前台轮询 + 定时进度输出OK:文件名:session_id,超时则返回 ERR:open_timeout_xxs| 步骤 | 做什么 | 用什么 |
|---|---|---|
| 1 | 确保 HTTP 服务器在运行 | scripts/start.ps1(无参数) |
| 2 | 打开目标二进制文件 | scripts/open.ps1 -Path "xxx.exe" |
| 3 | 使用所有 72 个 MCP 工具 | 直接调用 idapro_* 工具 |
| 4 | 分析完毕 | 工具自动可用 |
路径:scripts/start.ps1
taskkill /F /T 杀旧进程树(连 worker 子进程一起清理)→ 后台启动 idalib-mcp → 等待就绪(最多 15 秒)OK:72,失败输出 ERR:timeout调用方式:
powershell -File "<WORKSPACE>\\Tool\\skills\ida-reverse\scripts\start.ps1"
路径:scripts/open.ps1
idalib_open,绕过 MCP schema 校验.id0/.id1/.nam/.til/.i64)-TimeoutSeconds,超时后返回 ERR:open_timeout_xxs,不会无限卡住INFO:opening:已用时/超时秒数,便于判断仍在分析中OK:文件名:session_id,降级时加 (temp copy) 标记调用方式:
powershell -File "<WORKSPACE>\\Tool\\skills\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 才返回成功,属于“分析很久”而不是“脚本死锁”-TimeoutSeconds 600idapro_survey_binary(detail_level="minimal") — 快速概况:函数数、字符串、段、入口点、导入分类(加密/网络/文件IO)idapro_list_funcs(queries) — 列出函数(分页、按名称过滤)idapro_list_globals(queries) — 列出全局变量idapro_entity_query(kind, filter) — 统一查询:functions/globals/imports/strings/namesidapro_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) — 为引用地址的代码生成签名idapro_open_file(file_path) — 在 GUI IDA 实例中打开文件?ext=dbg 启用idapro_idalib_open(input_path) — ⚠️ 有 schema 校验 BUG,改用 open.ps1 脚本idapro_idalib_list() — 列出所有 sessionidapro_idalib_current() — 当前上下文绑定的 sessionidapro_idalib_switch(session_id) — 切换到其他 sessionidapro_idalib_close(session_id) — 关闭 sessionidapro_idalib_save(path) — 保存数据库idapro_idalib_health(session_id) — 检查 worker 健康状态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 等)确保 HTTP 服务在后台运行。
powershell -File "scripts/start.ps1"
输出 OK:72 表示就绪。
powershell -File "scripts/open.ps1" -Path "C:\目标.exe" -TimeoutSeconds 600
输出 OK:文件名:session_id 表示成功(后带 (temp copy) 表示自动降级到临时副本)。
若分析时间较长,会周期性输出 INFO:opening:...;若达到超时则输出 ERR:open_timeout_xxs。
idapro_survey_binary(detail_level="minimal")
关注:
idapro_analyze_function(addr="关键函数名")
或:
idapro_decompile(addr="函数名")
idapro_disasm(addr="函数名", max_instructions=50)
idapro_xrefs_to(addrs="关键地址/字符串")
idapro_callgraph(roots=["关键函数"], max_depth=3)
idapro_trace_data_flow(addr="关键地址", direction="backward", max_depth=5)
idapro_set_comments(items=[{"addr": "0x140001000", "comment": "你的理解"}])
idapro_rename(batch={"func": [{"addr": "函数地址", "name": "有意义的名字"}]})
分析完成后,生成 report.md 记录发现和步骤。
idapro_int_convertxrefs_to 看谁引用了它open.ps1open.ps1 会自动降级到 Temp 副本(输出含 (temp copy) 标记)-TimeoutSeconds 600,不要把长时间 INFO:opening:... 误判成脚本卡死AFaffaan-m/ECC315k4,381 new stars in the last 7 days
Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.
DIDietrichGebert/ponytail203k4,904 new stars in the last 7 days
GAgarrytan/gstack143k598 new stars in the last 7 days
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
RUruvnet/RuView106k739 new stars in the last 7 days