Files

65 lines
3.6 KiB
Markdown

# Local REA and Ghidra
User requirement: use REA for future original-binary investigations, including
subagent work. Retain Evidence, addresses and byte cross-checks; document provider
limitations explicitly. Supplementary disassembly and runtime probes remain useful
when a REA result is incomplete. Ordinary source maintenance needs no REA call.
REA is an analysis dependency, absent from the packaged game's runtime. The
installed MCP tools connected successfully and opened a generated EXE copy with
the authoritative hash. Native decompilation initially lacked an engine. The
project-local CLI setup now works without changing the client's MCP registration.
- REA6.8.0: existing public `scripts/rea.mjs` launcher in the user's npm cache.
- Existing Node24.22.1: configured through ignored `.tools/rea.env`; the login
shell's Node20 cannot load this CLI's zstd imports.
- Ghidra12.1.4: `.tools/ghidra_12.1.4_PUBLIC`, from the
[official pinned release](https://github.com/NationalSecurityAgency/ghidra/releases/tag/Ghidra_12.1.4_build).
Download ZIP SHA256 `ddac49f903da9d5bac833e5cc79395098b9c33cfd3279be5f31bd00387d2d4db`
verified before extraction. Its pinned README requires a full JDK21.
- Full OpenJDK21.0.12.1+1-1~24.04.4: matching Ubuntu JDK/JRE headless packages
downloaded with apt and extracted under `.tools/java`; no system installation.
JAVA_HOME is `.tools/java/usr/lib/jvm/java-21-openjdk-amd64`. The pre-existing
system Java21 was runtime-only. Adoptium metadata endpoint returned403; no
archive from that endpoint was installed.
scripts/rea.sh reads local launcher settings from ignored `.tools/rea.env`, sets
local GHIDRA_INSTALL_DIR/JAVA_HOME and invokes the public launcher. For another
machine set NEUTRON_REA_NODE and NEUTRON_REA_LAUNCHER there, or provide `rea` on
PATH. This environment does not alter the already-running MCP server; native MCP
tools need those environment paths when that server next starts. CLI use is
already verified. No registration/setup rewrite was performed.
```bash
mkdir -p artifacts/rea-copy
cp ../Original/Neutron.exe artifacts/rea-copy/Neutron.exe
scripts/rea.sh decompile "$PWD/artifacts/rea-copy/Neutron.exe" 0x475ca0 \
--provider ghidra --snapshot "$PWD/artifacts/rea-copy/snapshot.json" \
--format json --full-output > artifacts/rea-copy/gate.json
```
Use generated copies and keep complete Evidence with binary/profile identities.
For several functions, one local stdio session avoids re-importing the EXE for
each query:
```bash
python3 tools/binary/rea_decompile_batch.py artifacts/rea-copy/Neutron.exe \
artifacts/rea-batch-NEW 0x40e050 0x437940 0x479bc0
```
The output directory must be new. The helper saves each complete reply, exports
successful Evidence and closes/snapshots its owned session. A per-function error
is retained separately; inspect it before claiming complete coverage. REA's
Ghidra bridge needs a local Unix socket, which the default Codex sandbox blocked;
the approved local execution allowance worked. This was a host IPC restriction,
not an analysis-timeout or engine-install failure. Target executable code is not
run by these static operations. Retained primitive queries are not a complete
Ghidra database or proof every function is recognized.
Five selected routines were decompiled and cross-checked against existing byte
evidence. Fire421FB0 was not recognized as a procedure even with the correct
file-offset selector; keep that limitation explicit. Actual Evidence IDs and
gameplay interpretation are in checkpoint/control-phase-implementation.md.
Logs, readiness errors, complete replies, export bundles and snapshots are under
artifacts/uncontrolled-phases/rea/. Temporary native sessions were closed.