dsh-plugin-rea 0.0.0-stage → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ 本插件遵循语义化版本。版本号变化说明「配置组合」这层的变化,与 REA 自身的版本无关。
4
+
5
+ ## 1.0.3 — 2026-10-12
6
+
7
+ 仓库展示与发布范围调整,无行为变更。
8
+
9
+ - 新增 `assets/screenshot-1.png`、`assets/screenshot-2.png` 与 `screenshots.json`(市场详情页展示用,
10
+ 由 `assets/make-screenshots.ps1` 可复现生成)。
11
+ - 维护记录改为**仅本机保留**(不再随仓库或 tarball 发布)。
12
+
13
+ ## 1.0.2 — 2026-10-12
14
+
15
+ 文档补强,无行为变更。
16
+
17
+ - 新增「能做什么、不能做什么」:明确**无法完整还原源代码**——上游原生分析返回的是伪代码与汇编、
18
+ APK 返回反编译的方法、JEB 返回伪代码,均非原始源码,且不保证文本等价或可直接编译;
19
+ 变量名/类型/注释/宏、优化与去符号、混淆加壳等因素都会降低可读性。
20
+ - 更新章节措辞按实际安装来源区分:从插件市场安装的在**市场里更新**,本地 `file:` 目录方式则覆盖后重装。
21
+
22
+ ## 1.0.1 — 2026-10-12
23
+
24
+ 文档与措辞修正,无行为变更。
25
+
26
+ - 「作用」改为依据上游 REA 自己的说明撰写(含上游列出的可分析目标),明确逆向能力由上游提供、
27
+ 本插件只做配置组合与引擎环境变量隔离。
28
+ - 新增「更新」章节,区分两件独立且都需手动完成的事:**本插件不会自动更新**(有新版时在插件
29
+ 管理器重装),上游 REA 用 `npm i -g rea-agents@latest` 更新。
30
+
31
+ ## 1.0.0 — 2026-10-12
32
+
33
+ 首个版本。
34
+
35
+ - 新增纯配置型 Cordis bundle:插入一条 `@deepseek-ai/dsh-mcp-client` 记录,注册 `rea mcp`(stdio)。
36
+ - 工具命名沿用官方约定 `mcp__rea__<tool>`;`failOnStartupError: false`,REA 缺失时不阻塞 harness 启动。
37
+ - 新增 `check-updates.ps1`:检查 REA(npm) / Node engines / Ghidra 版本与 doctor 子项 / 插件登记状态。
38
+ - 实测矩阵:REA 6.4.0、DSH 桌面运行时 0.2.0-rc.2、Ghidra 12.1.4、Node 24.21.0、Windows 11 x64。
39
+
40
+ <!--
41
+ 维护提示(发布新版本时):
42
+ 1. 改 package.json 的 version,并在此文件顶部加一节;
43
+ 2. 若改动涉及路径/字段,同步更新 README 的「配置」与「上游更新怎么办」;
44
+ 3. 若发 Release tarball,资产名保持不带版本号(dsh-plugin-rea.tgz),
45
+ 否则市场里 latest/download 形式的链接会在下次发版后 404。
46
+ -->
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 czcdr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,207 @@
1
- # Temporary Holding Version
1
+ # dsh-plugin-rea
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![awesome · DSH plugin](https://awesome-dsh-plugin.com/badge.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
4
+
5
+ 把 **[REA — Reverse Engineer Anything](https://github.com/morluto/rea)** 接入 **DeepSeek Harness (dsh)**:
6
+ 一个**纯配置型 Cordis bundle**,复用官方 MCP 客户端插件 `@deepseek-ai/dsh-mcp-client`,
7
+ 把本机已安装的 `rea mcp`(stdio)注册成原生工具。装载后模型直接拥有 `mcp__rea__*` 工具。
8
+
9
+ > **与上游的关系(重要)**
10
+ > 本仓库是**第三方适配封装,不是 REA 项目的组成部分**,也不包含 REA 的任何源码,
11
+ > 更不由 REA 作者维护。它只做一件事:向 dsh 的配置组合里插入一条指向你本机 `rea` 安装的 MCP 服务器记录。
12
+ > - 上游项目:**REA — Reverse Engineer Anything** — <https://github.com/morluto/rea>(MIT)
13
+ > - 上游文档:<https://github.com/morluto/rea#what-you-can-analyze> · [中文](https://github.com/morluto/rea/blob/main/README_zh.md#可以分析什么) · 站点 <https://rea.tools/>
14
+ > - 上游 npm 包:`rea-agents`
15
+ > - 本插件仓库:**<https://github.com/czcdr/dsh-plugin-rea>**
16
+ > - 问题反馈:REA 本身的问题请提到上游;本插件的问题提到 [本仓库 Issues](https://github.com/czcdr/dsh-plugin-rea/issues)。
17
+
18
+ ---
19
+
20
+ ![dsh-plugin-rea:会话经官方 MCP 客户端行调用本机 rea mcp,再把 Evidence 带回会话](assets/screenshot-1.png)
21
+
22
+ ## English
23
+
24
+ **What it does.** This plugin performs **no reverse engineering itself**. It connects the upstream REA
25
+ MCP server to DeepSeek Harness, so the tools REA ships become callable in a session as
26
+ `mcp__rea__*`.
27
+
28
+ In upstream's own words, REA is *"one MCP for reverse engineering across binaries, applications, and
29
+ runtime behavior"* — *"see a feature you like. Understand how it works, down to the binary level."* It
30
+ *connects your agent to tools for inspecting native binaries, JavaScript and Electron apps, .NET
31
+ assemblies, and websites*; analysis runs locally, and results include the evidence and limitations
32
+ behind each conclusion. Native analysis can use an existing Hopper, Ghidra, or IDA installation, and
33
+ static JavaScript analysis needs no native engine.
34
+
35
+ Upstream's own coverage list (`README.md#what-you-can-analyze`): native binaries — pseudocode,
36
+ assembly, strings, symbols, calls and references; JavaScript/Electron apps — modules, imports, source
37
+ maps, routes, IPC; websites — page structure, scripts, network observations, screenshots; .NET
38
+ assemblies; Android APKs; Android devices over adb; JEB projects; Android resources; firmware;
39
+ packages and assets; process behavior; plus offline ELF layout, EVM bytecode, recorded Linux crashes
40
+ and saved network captures.
41
+
42
+ **What this plugin adds.** Exactly two things: it registers that MCP server into DSH's tool layer
43
+ under the `mcp__rea__*` names, and it scopes the engine environment variables (`GHIDRA_INSTALL_DIR`,
44
+ `JAVA_HOME`) to that MCP child process instead of the whole harness.
45
+
46
+ **What it can and cannot do.** The analysis is upstream's; this section only restates upstream's own
47
+ contract so expectations are right.
48
+
49
+ - **It cannot recover complete source code.** For native binaries upstream returns *pseudocode and
50
+ assembly*, for Android APKs *decompiled methods*, for JEB units *pseudocode*, and for
51
+ JavaScript/Electron *modules and their relations*. Upstream's tool contract states the pseudocode
52
+ "is decompiler output, not original source and not text-equivalent" to another provider's output.
53
+ - Not recoverable in practice: original identifier names, types, comments, macros and template
54
+ expansion, build scripts and assets. Optimisation (inlining, reordering), symbol stripping,
55
+ obfuscation, packing and VM protection only make the output worse.
56
+ - Every result carries **confidence and limitations** (`observed` / `derived` / `inferred`, plus an
57
+ explicit limitations list). Read them as evidence, never as recovered source.
58
+ - Good for: understanding behaviour, locating an implementation, interoperability and compatible
59
+ re-implementation, security review, migration reference. To obtain actual source code, use the
60
+ legitimate route — the upstream repository, vendor authorisation, or the vendor's own SDK.
61
+
62
+ **Verified against** (author's machine, 2026-10-12):
63
+
64
+ | Component | Version |
65
+ |---|---|
66
+ | REA (`rea-agents`) | **6.4.0** |
67
+ | DeepSeek Harness (dsh desktop runtime) | **0.2.0-rc.2** |
68
+ | `@deepseek-ai/dsh-mcp-client` (row provider) | bundled by the harness; npm latest `0.0.1-rc.1` |
69
+ | Ghidra | 12.1.4 (REA currently accepts 12.1.x) |
70
+ | Node.js | 24.21.0 (REA engines: `^22.19.0 \|\| ^24.11.0 \|\| >=26.0.0`) |
71
+ | Host | Windows 11 x64 |
72
+
73
+ **Prerequisites.** Node.js (a version REA accepts), the REA CLI installed globally
74
+ (`npm i -g rea-agents`), and for native analysis a Ghidra 12.1.x extraction directory (Hopper / IDA
75
+ are alternatives, under their own licences). Static JavaScript/Electron and .NET analysis need no
76
+ native engine.
77
+
78
+ **Install.** Add this repository as a bundle (the repo declares `dsh.bundle.patch`, so it is
79
+ installable directly):
80
+
81
+ ```
82
+ dsh plugin --profile <profile> add github:czcdr/dsh-plugin-rea
83
+ ```
84
+
85
+ A prebuilt tarball is attached to [Releases](https://github.com/czcdr/dsh-plugin-rea/releases)
86
+ (version-free asset name, so the link keeps resolving). Or install a local checkout with
87
+ `file:<path-to-this-repo>`.
88
+
89
+ **Configure — two machine-specific values.** Edit `cordis.patch.yml` before or after installing:
90
+
91
+ 1. `args[0]` — full path of the REA CLI entry: run `npm root -g`, then append
92
+ `\rea-agents\scripts\rea.mjs` (`/rea-agents/scripts/rea.mjs` on POSIX).
93
+ 2. `env.GHIDRA_INSTALL_DIR` — your Ghidra extraction directory. Omit it only if you do not use Ghidra.
94
+
95
+ `command: node` resolves through `PATH`; replace it with a full path if `node` is not on the PATH the
96
+ harness sees. `env.JAVA_HOME` is optional (only needed when `java` is not on `PATH`).
97
+
98
+ **Verify.** Ask for a `mcp__rea__*` call — `binary_session` reports the engine checks
99
+ (`configuration` / `installation` / `headless` / `native_decompiler` / `java`), all of which should be
100
+ `ok: true`. Then `open_binary` a PE, `binary_overview`, and `procedure_pseudo_code`.
101
+
102
+ **Scope and caveats.** REA exposes 170+ tools at 6.4.0, so every session's tool list grows; the row
103
+ sets `failOnStartupError: false` so a missing REA never blocks harness startup. Some REA tools launch
104
+ processes, write files and access the network — DSH's permission policy applies. Analyse only
105
+ artifacts you are authorized to inspect.
106
+
107
+ **Updating — two independent things, both manual.**
108
+
109
+ - **This plugin** never updates itself. Installed from a plugin market? Update it **in that market**.
110
+ Installed from a local `file:` checkout (as in the author's setup)? Overwrite the directory and
111
+ install it again through the plugin manager. Updating REA below does **not** update this plugin, and
112
+ updating this plugin does not touch REA.
113
+ - **Upstream REA**: update it with `npm i -g rea-agents@latest`. Its `bin` entry
114
+ (`scripts/rea.mjs`) is stable across releases, so this needs no change here.
115
+ - **Ghidra** is version-gated by REA (12.1.x today): update REA first, then check that it accepts a
116
+ newer Ghidra.
117
+ - **DeepSeek Harness**: a harness upgrade may change the MCP client's config schema — inspect the row
118
+ with `Config.listConfigs name=@deepseek-ai/dsh-mcp-client` and adjust the field names.
119
+
120
+ `check-updates.ps1` (Windows PowerShell) reports the state of all four at once.
121
+
122
+ **License.** MIT (this adapter). REA is MIT and owned by its authors; Ghidra is Apache-2.0 and owned
123
+ by the NSA. No upstream code is redistributed here.
124
+
125
+ ---
126
+
127
+ ## 中文
128
+
129
+ **作用。** 本插件**自身不做任何逆向分析**。它把上游 REA 的 MCP 服务接入 DeepSeek Harness,
130
+ 让 REA 提供的那套工具在会话里变成可直接调用的 `mcp__rea__*`。
131
+
132
+ 按上游自述,REA 是「**通过一个 MCP 服务,逆向分析二进制文件、应用程序和运行时行为**」——
133
+ 「看到喜欢的功能,弄清它的工作原理,深入到二进制层面」。它「将智能体连接到分析工具,用于检查
134
+ 原生二进制文件、JavaScript 和 Electron 应用、.NET 程序集以及网站」;分析在本机运行,结果包含
135
+ 支撑各项结论的证据和相关限制。原生分析可以使用已有的 Hopper、Ghidra 或 IDA,静态 JavaScript 分析
136
+ 不需要原生引擎。
137
+
138
+ 上游列出的可分析目标(原文见 [README_zh.md#可以分析什么](https://github.com/morluto/rea/blob/main/README_zh.md#可以分析什么)):
139
+ 原生二进制文件——伪代码、汇编、字符串、符号、调用和引用;JavaScript / Electron——模块、导入、
140
+ source map、路由与 IPC;网站——页面结构、脚本、网络观察结果与截图;.NET 程序集;Android APK;
141
+ Android 设备(adb);JEB 项目;Android 资源;固件;软件包与资源;进程行为;以及离线 ELF 布局、
142
+ EVM 字节码、已记录的 Linux 崩溃与已保存的网络捕获。
143
+
144
+ **本插件在此之上只增加两件事**:把该 MCP 服务注册进 DSH 的工具层(工具名 `mcp__rea__*`),
145
+ 以及把引擎环境变量(`GHIDRA_INSTALL_DIR`、`JAVA_HOME`)限制在这个 MCP 子进程内,而不是整个 harness。
146
+
147
+ **能做什么、不能做什么(重要)。** 分析能力由上游提供;这里只复述上游自己的契约,避免预期错位。
148
+
149
+ - **无法完整还原源代码。** 上游对原生二进制返回的是**伪代码与汇编**,对 Android APK 返回
150
+ **反编译的方法**,对 JEB 单元返回**伪代码**,对 JavaScript/Electron 返回**模块及其关系**。
151
+ 上游的工具契约明确写着:伪代码是反编译器输出,**不是原始源码**,且与其他提供方的输出
152
+ **不保证文本等价**。
153
+ - 实践中不可恢复的内容:原始标识符命名、类型、注释、宏与模板展开、构建脚本与资源;
154
+ 优化(内联、指令重排)、去符号(strip)、混淆、加壳与 VM 保护只会让可读性更差。
155
+ - 每条结论都自带**置信度与限制**(`observed` / `derived` / `inferred`,另有 limitations 列表):
156
+ 请把它们当作证据使用,而不要当作"已还原的源码"。
157
+ - 适合做:理解行为、定位实现、互操作与兼容实现、安全审计、迁移参考。
158
+ **要拿到真正的源码,请走正规渠道**——上游代码仓库、厂商授权,或厂商自己的 SDK。
159
+
160
+ **已验证版本**(作者机器,2026-10-12):REA `6.4.0`、DeepSeek Harness 桌面运行时 `0.2.0-rc.2`、
161
+ Ghidra `12.1.4`、Node `24.21.0`、Windows 11 x64。行提供方 `@deepseek-ai/dsh-mcp-client` 由
162
+ harness 自带(npm 最新 `0.0.1-rc.1`)。
163
+
164
+ **前置条件。** 满足 REA 要求的 Node;全局安装 REA(`npm i -g rea-agents`);原生分析需要
165
+ Ghidra 12.1.x 的解压目录(Hopper / IDA 为替代方案,各自需授权)。静态 JavaScript/Electron 与
166
+ .NET 分析不需要原生引擎。
167
+
168
+ **安装。**
169
+
170
+ ```
171
+ dsh plugin --profile <profile> add github:czcdr/dsh-plugin-rea
172
+ ```
173
+
174
+ [Releases](https://github.com/czcdr/dsh-plugin-rea/releases) 附带预构建 tarball(资产名不带版本号,
175
+ 链接不会失效)。也可用本地目录安装:`file:<本仓库路径>`。
176
+
177
+ **配置(两个随机器不同的值)**:改 `cordis.patch.yml`
178
+
179
+ 1. `args[0]` —— REA 入口文件的绝对路径:先跑 `npm root -g`,再拼上
180
+ `\rea-agents\scripts\rea.mjs`(POSIX 用 `/`)。
181
+ 2. `env.GHIDRA_INSTALL_DIR` —— 你的 Ghidra 解压目录;不用 Ghidra 时可删掉这一行。
182
+
183
+ `command: node` 走 PATH;若 harness 的 PATH 里没有 `node`,改成绝对路径。`env.JAVA_HOME`
184
+ 可选,仅当 `java` 不在 PATH 上时需要。
185
+
186
+ **验证。** 调用任一 `mcp__rea__*` 工具:`binary_session` 会给出引擎检查项
187
+ (configuration / installation / headless / native_decompiler / java),应全部 `ok: true`;
188
+ 随后 `open_binary` 打开一个 PE → `binary_overview` → `procedure_pseudo_code`。
189
+
190
+ **范围与注意。** REA 在 6.4.0 暴露 170+ 个工具,注入后每个会话的工具列表都会变大;行内设置
191
+ `failOnStartupError: false`,因此 REA 缺失也不会阻塞 harness 启动。部分 REA 工具会启动进程、
192
+ 写文件、访问网络,按 DSH 的权限策略执行。请仅分析你已获得授权的目标。
193
+
194
+ **更新:两件事,且都要手动。**
195
+
196
+ - **本插件**不会自动更新。**从插件市场安装的,就在市场里更新**;本地 `file:` 目录方式安装的,
197
+ 覆盖目录后在插件管理器里重装。下面更新 REA **不会**更新本插件,反过来也一样。
198
+ - **上游 REA**:用 `npm i -g rea-agents@latest` 更新。它的 `bin` 入口(`scripts/rea.mjs`)
199
+ 跨版本稳定,所以本插件无需改动。
200
+ - **Ghidra**:受 REA 版本门槛限制(当前 12.1.x),先升 REA,再确认它接受新版 Ghidra。
201
+ - **DeepSeek Harness**:升级可能改变 MCP 客户端配置结构,用
202
+ `Config.listConfigs name=@deepseek-ai/dsh-mcp-client` 看该行 schema 并调整字段名。
203
+
204
+ `check-updates.ps1`(Windows PowerShell)会把上述四项一次跑完。
205
+
206
+ **许可。** 本适配器为 MIT;REA 为 MIT,版权归其作者;Ghidra 为 Apache-2.0,版权归 NSA。
207
+ 本仓库不再分发上游代码。
@@ -0,0 +1,139 @@
1
+ <#
2
+ .SYNOPSIS
3
+ 检查 dsh-plugin-rea 的整条链路是否需要跟进上游更新。
4
+
5
+ .DESCRIPTION
6
+ 覆盖 4 类上游:REA(npm) / Node 运行时 / Ghidra 引擎 / DSH 插件登记。
7
+ 只读:不安装、不修改任何配置,只报告现状与建议动作。
8
+
9
+ .EXAMPLE
10
+ powershell -NoProfile -File .\check-updates.ps1
11
+ .EXAMPLE
12
+ powershell -NoProfile -File .\check-updates.ps1 -Registry https://registry.npmjs.org
13
+ .NOTES
14
+ Windows PowerShell 5.1 按 ANSI 读取 .ps1,本文件必须保存为 UTF-8 with BOM。
15
+ #>
16
+ [CmdletBinding()]
17
+ param(
18
+ [string]$Registry = 'https://registry.npmmirror.com',
19
+ [string]$ReaPackageDir,
20
+ [string]$ProfileDir
21
+ )
22
+
23
+ # 默认值:自动定位 REA 全局包与 dsh profile(均可用参数覆盖)
24
+ if (-not $ReaPackageDir) {
25
+ $npmRoot = $null
26
+ try { $npmRoot = (& npm root -g 2>$null | Select-Object -First 1).Trim() } catch { }
27
+ $ReaPackageDir = if ($npmRoot) { Join-Path $npmRoot 'rea-agents' } else { Join-Path $env:APPDATA 'npm\node_modules\rea-agents' }
28
+ }
29
+ if (-not $ProfileDir) {
30
+ if ($env:DSH_PROFILE_DIR) { $ProfileDir = $env:DSH_PROFILE_DIR }
31
+ else {
32
+ $profiles = @(Get-ChildItem "$env:USERPROFILE\.dsh\profiles" -Directory -ErrorAction SilentlyContinue)
33
+ $ProfileDir = if ($profiles.Count -gt 0) { $profiles[0].FullName } else { "$env:USERPROFILE\.dsh\profiles\desktop" }
34
+ }
35
+ }
36
+
37
+ $ErrorActionPreference = 'Continue'
38
+ function Head($t) { Write-Host "`n=== $t ===" -ForegroundColor Cyan }
39
+ function Ok($t) { Write-Host " [OK] $t" -ForegroundColor Green }
40
+ function Warn($t) { Write-Host " [注意] $t" -ForegroundColor Yellow }
41
+ function Bad($t) { Write-Host " [动作] $t" -ForegroundColor Red }
42
+ function Info($t) { Write-Host " $t" -ForegroundColor Gray }
43
+
44
+ $actions = [System.Collections.Generic.List[string]]::new()
45
+
46
+ # ---------------------------------------------------------------- REA (npm)
47
+ Head 'REA 本体(npm 包 rea-agents)'
48
+ $installed = $null; $engines = $null; $binPath = $null
49
+ $pkgFile = Join-Path $ReaPackageDir 'package.json'
50
+ if (Test-Path $pkgFile) {
51
+ $pkg = Get-Content $pkgFile -Raw | ConvertFrom-Json
52
+ $installed = $pkg.version; $engines = $pkg.engines.node
53
+ $binPath = ($pkg.bin.PSObject.Properties | Select-Object -First 1).Value
54
+ Ok "本地已安装: $installed"
55
+ Info "入口(bin): $binPath ← 插件引用的就是它,跨版本稳定"
56
+ Info "Node 要求: $engines"
57
+ } else { Bad "找不到 $pkgFile —— REA 全局包丢了?重装: npm i -g rea-agents" }
58
+
59
+ $latest = $null
60
+ foreach ($r in @($Registry, 'https://registry.npmjs.org')) {
61
+ try { $latest = (Invoke-RestMethod "$r/rea-agents/latest" -TimeoutSec 20).version; Info "最新版本($r): $latest"; break }
62
+ catch { Warn "查询失败 $r : $($_.Exception.Message)" }
63
+ }
64
+ if ($installed -and $latest) {
65
+ if ([version]$latest -gt [version]$installed) {
66
+ Warn "有新版本:$installed → $latest"
67
+ $actions.Add("升级上游 REA: npm i -g rea-agents@$latest (只更新 REA 本身;本插件不会自动更新,有新版需在插件管理器里重装)")
68
+ } else { Ok '已是最新版本' }
69
+ }
70
+
71
+ # ------------------------------------------------------------- Node 运行时
72
+ Head 'Node 运行时'
73
+ $nodeV = (& node -v) -replace '^v', ''
74
+ Info "当前 node: $nodeV"
75
+ if ($engines) {
76
+ if ($engines -match '\^24\.(\d+)\.' -and [version]$nodeV -ge [version]('24.' + $Matches[1] + '.0')) { Ok '满足当前 engines 要求' }
77
+ elseif ($engines -match '\^22\.(\d+)\.' -and [version]$nodeV -ge [version]('22.' + $Matches[1] + '.0')) { Ok '满足当前 engines 要求' }
78
+ else { Warn "请对照 engines 范围自行确认: $engines" }
79
+ Info "上游若抬高 Node 下限,插件里的 command('node') 需换成满足要求的 node 可执行文件"
80
+ }
81
+
82
+ # ------------------------------------------------------------ Ghidra 引擎
83
+ Head 'Ghidra 引擎'
84
+ $gd = [Environment]::GetEnvironmentVariable('GHIDRA_INSTALL_DIR', 'User')
85
+ if (-not $gd) { $gd = $env:GHIDRA_INSTALL_DIR }
86
+ if ($gd -and (Test-Path $gd)) {
87
+ Ok "GHIDRA_INSTALL_DIR = $gd"
88
+ $props = Join-Path $gd 'Ghidra\application.properties'
89
+ if (Test-Path $props) {
90
+ $v = (Select-String -Path $props -Pattern '^application\.version=' | Select-Object -First 1).Line -replace '^application\.version=', ''
91
+ Ok "已安装版本: $v"
92
+ if ($v -notmatch '^12\.1\.') { Bad "REA 当前要求 Ghidra 12.1.x,而你装的是 $v —— 升级 REA 后才有望支持更高版本" }
93
+ } else { Bad "缺少 Ghidra\application.properties —— 目录不完整" }
94
+ } else { Bad "GHIDRA_INSTALL_DIR 未设置或目录不存在(当前值: $gd)" }
95
+
96
+ try {
97
+ $rel = Invoke-RestMethod 'https://api.github.com/repos/NationalSecurityAgency/ghidra/releases/latest' -TimeoutSec 25 -Headers @{ 'User-Agent' = 'rea-check' }
98
+ Info "Ghidra 官方最新: $($rel.tag_name) ($($rel.published_at))"
99
+ if ($rel.tag_name -notmatch 'Ghidra_12\.1') { Warn '官方已有更新;请先确认 REA 是否放开版本门槛,再升级 Ghidra' }
100
+ } catch { Warn "GitHub API 查询失败(可跳过): $($_.Exception.Message)" }
101
+
102
+ # --------------------------------------------------------- REA 引擎自检
103
+ Head 'REA 引擎自检(rea doctor)'
104
+ $env:GHIDRA_INSTALL_DIR = $gd
105
+ try {
106
+ $raw = & rea doctor --format json 2>$null
107
+ $doc = ($raw -join "`n") | ConvertFrom-Json
108
+ $g = $doc.providerInspections | Where-Object { $_.id -eq 'ghidra' }
109
+ if ($g) {
110
+ if ($g.available) { Ok "ghidra provider 可用,版本 $($g.providerVersion)" } else { Bad 'ghidra provider 不可用 —— 运行 rea doctor 看 remediation' }
111
+ $fails = @($g.checks | Where-Object { -not $_.ok })
112
+ if ($fails.Count -eq 0) { Ok '全部子项通过(configuration/installation/headless/native_decompiler/java)' }
113
+ else { $fails | ForEach-Object { Bad "$($_.name): $($_.detail)" } }
114
+ }
115
+ if ($doc.identity.cli_package_version) { Info "doctor 识别到的 CLI 版本: $($doc.identity.cli_package_version),MCP 工具数: $($doc.identity.catalog.counts.mcp_tools)" }
116
+ } catch { Warn "rea doctor 解析失败,请手动运行: rea doctor" }
117
+
118
+ # ---------------------------------------------------- DSH 插件登记状态
119
+ Head 'DSH 插件登记'
120
+ $profPkg = Join-Path $ProfileDir 'package.json'
121
+ if (Test-Path $profPkg) {
122
+ $p = Get-Content $profPkg -Raw | ConvertFrom-Json
123
+ $dep = $p.dependencies.'dsh-plugin-rea'
124
+ $bundled = @($p.dsh.profile.bundles) -contains 'dsh-plugin-rea'
125
+ if ($dep) { Ok "依赖已登记: dsh-plugin-rea = $dep" } else { Bad '依赖未登记 —— 用 plugin_manager 重新安装本插件' }
126
+ if ($bundled) { Ok '已列入 dsh.profile.bundles(装载层已生效)' } else { Bad '未列入 bundles —— 插件不会加载' }
127
+ Info '本插件不会自动更新:从插件市场安装的在市场里更新;本地 file: 目录方式则覆盖目录后在插件管理器里重装'
128
+ if ($dep -like 'file:*') {
129
+ $p2 = $dep -replace '^file:', ''
130
+ if (Test-Path $p2) { Ok "插件目录存在: $p2" } else { Bad "插件目录不存在: $p2 —— 移走了目录就会加载失败" }
131
+ }
132
+ } else { Warn "找不到 profile: $profPkg" }
133
+
134
+ # ------------------------------------------------------------------ 汇总
135
+ Head '结论'
136
+ if ($actions.Count -eq 0) { Ok '无需动作:整条链路与上游保持一致' }
137
+ else { $actions | ForEach-Object { Bad $_ } }
138
+ Write-Host ''
139
+ Write-Host '提示:DSH 侧更新(应用升级可能改变 MCP 客户端配置结构)后,请重跑本脚本并调用一次 mcp__rea__binary_session 验证。' -ForegroundColor Gray
@@ -0,0 +1,38 @@
1
+ # dsh-plugin-rea — REA (Reverse Engineer Anything) as native DSH tools
2
+ #
3
+ # Configuration-only bundle: no Host/Client entry files. It inserts one row of
4
+ # the official MCP client plugin and points it at the installed `rea mcp`
5
+ # stdio server; the model then sees mcp__rea__<tool>.
6
+ #
7
+ # ---------------------------------------------------------------------------
8
+ # TWO VALUES ARE MACHINE-SPECIFIC — edit them for your machine:
9
+ #
10
+ # 1. args[0] full path to the rea CLI entry file.
11
+ # Run: npm root -g
12
+ # then append: \rea-agents\scripts\rea.mjs
13
+ # (POSIX: <npm root -g>/rea-agents/scripts/rea.mjs)
14
+ #
15
+ # 2. env.GHIDRA_INSTALL_DIR
16
+ # the directory where Ghidra was extracted,
17
+ # e.g. D:\ghidra\ghidra_12.1.4_PUBLIC
18
+ # Leave it out only if you do not use Ghidra.
19
+ #
20
+ # `command: node` is resolved through PATH; point it at a full path (for
21
+ # example D:\nodejs\node.exe) if node is not on the PATH the harness sees.
22
+ # env.JAVA_HOME is optional — keep it when `java` is not on PATH.
23
+ # ---------------------------------------------------------------------------
24
+
25
+ - insert:
26
+ - id: mcp-rea
27
+ name: '@deepseek-ai/dsh-mcp-client'
28
+ config:
29
+ serverName: rea
30
+ transport: stdio
31
+ command: 'node'
32
+ args:
33
+ - 'D:\dev\npm-global\node_modules\rea-agents\scripts\rea.mjs'
34
+ - mcp
35
+ env:
36
+ GHIDRA_INSTALL_DIR: 'D:\ghidra\ghidra_12.1.4_PUBLIC'
37
+ JAVA_HOME: 'F:\game\xbox'
38
+ failOnStartupError: false
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "dsh-plugin-rea",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.3",
4
+ "description": "Third-party adapter that registers the upstream REA (Reverse Engineer Anything) MCP server into DeepSeek Harness as mcp__rea__* tools. REA itself is 'one MCP for reverse engineering across binaries, applications, and runtime behavior' (github.com/morluto/rea, MIT) — native binaries, JavaScript/Electron apps, .NET assemblies, websites, Android APKs, firmware and more; this plugin only composes the configuration row and scopes its engine env vars. · 第三方适配插件:把上游 REA(逆向一切)的 MCP 服务注册进 DeepSeek Harness,得到 mcp__rea__* 工具。逆向能力由上游提供(github.com/morluto/rea,MIT);本插件只做配置组合与引擎环境变量隔离。",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "czcdr",
8
+ "homepage": "https://github.com/czcdr/dsh-plugin-rea",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/czcdr/dsh-plugin-rea.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/czcdr/dsh-plugin-rea/issues"
15
+ },
16
+ "keywords": [
17
+ "deepseek",
18
+ "deepseek-harness",
19
+ "dsh",
20
+ "dsh-plugin",
21
+ "cordis",
22
+ "cordis-plugin",
23
+ "bundle",
24
+ "mcp",
25
+ "rea",
26
+ "reverse-engineering",
27
+ "ghidra",
28
+ "binary-analysis"
29
+ ],
30
+ "files": [
31
+ "cordis.patch.yml",
32
+ "README.md",
33
+ "LICENSE",
34
+ "CHANGELOG.md",
35
+ "check-updates.ps1"
36
+ ],
37
+ "dsh": {
38
+ "bundle": {
39
+ "patch": "./cordis.patch.yml"
40
+ }
41
+ },
42
+ "scripts": {
43
+ "check-updates": "powershell -NoProfile -File ./check-updates.ps1"
44
+ }
45
+ }