Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(windows): bring the real Windows Ghidra verifiers up to date (#1863)

pablodiazjorgeea40f717b263
diff --git a/scripts/verify-packaged-ghidra-windows.mjs b/scripts/verify-packaged-ghidra-windows.mjs
index 6221c122c..4dad1b835 100644
--- a/scripts/verify-packaged-ghidra-windows.mjs
+++ b/scripts/verify-packaged-ghidra-windows.mjs
@@ -394,15 +394,15 @@ try {
return evidence.normalized_result;
},
);
- const expected = (
+ const { GHIDRA_MUTATING_OPERATIONS, GHIDRA_SESSION_CAPABILITIES } =
await import(
pathToFileURL(join(packageRoot, "dist/ghidra/GhidraSessionValues.js"))
- )
- ).GHIDRA_SESSION_CAPABILITIES.filter(
+ );
+ const expected = GHIDRA_SESSION_CAPABILITIES.filter(
(name) =>
name !== "ping" &&
name !== "shutdown" &&
- name !== "annotate_native_function",
+ !GHIDRA_MUTATING_OPERATIONS.has(name),
);
assert.ok(
expected.every((name) => report.mcpOperations.includes(name)),
@@ -440,7 +440,10 @@ try {
token,
"Analysis changed caller token authority.",
);
- assert.deepEqual((await readdir(callerDirectory)).sort(), scriptCollisions);
+ assert.deepEqual(
+ (await readdir(callerDirectory)).sort(),
+ [...scriptCollisions].sort(),
+ );
for (const name of scriptCollisions)
assert.deepEqual(await readdir(join(callerDirectory, name)), []);
report.callerScriptCollisionsPreserved = true;
diff --git a/scripts/verify-real-ghidra-windows.mjs b/scripts/verify-real-ghidra-windows.mjs
index d2bbb511b..5adf96009 100644
--- a/scripts/verify-real-ghidra-windows.mjs
+++ b/scripts/verify-real-ghidra-windows.mjs
@@ -21,14 +21,17 @@ import { SUPPORTED_GHIDRA_VERSION } from "../dist/ghidra/GhidraInstallationPolic
import { GhidraHeadlessLauncher } from "../dist/ghidra/GhidraLauncher.js";
import { GHIDRA_PROVIDER_IDENTITY } from "../dist/ghidra/GhidraProviderCapabilities.js";
import { windowsP0Capabilities } from "../dist/ghidra/GhidraProviderCapabilities.js";
-import { GHIDRA_SESSION_CAPABILITIES } from "../dist/ghidra/GhidraSessionValues.js";
+import {
+ GHIDRA_MUTATING_OPERATIONS,
+ GHIDRA_SESSION_CAPABILITIES,
+} from "../dist/ghidra/GhidraSessionValues.js";
import { parseBinaryTarget } from "../dist/application/BinaryTargetResolver.js";
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
import { verifyGhidraCompactReferences } from "./lib/real-ghidra-compact-references.mjs";
const verifierRun = createVerifierRun();
const SESSION_CAPABILITIES = GHIDRA_SESSION_CAPABILITIES.filter(
- (name) => name !== "annotate_native_function",
+ (name) => !GHIDRA_MUTATING_OPERATIONS.has(name),
);
if (process.platform !== "win32" || process.arch !== "x64")
@@ -236,10 +239,8 @@ try {
const expected = [
...GHIDRA_INVENTORY_OPERATIONS,
- ...GHIDRA_FUNCTION_OPERATIONS.filter(
- (name) => name !== "annotate_native_function",
- ),
- ];
+ ...GHIDRA_FUNCTION_OPERATIONS,
+ ].filter((name) => !GHIDRA_MUTATING_OPERATIONS.has(name));
if (
observed.size !== expected.length ||
expected.some((operation) => !observed.has(operation))