Cheat sheets

Reverse Engineering with rea

rea 6.7.0 with Ghidra 12.1.4: inspect binaries, read Evidence records and compare bundles.

  • Tasks and commands
  • Annotated code
  • Diagrams
  • Defaults and numbers
  • Troubleshooting
  • Questions and tips

Interactive machineSource

Where rea stops and Ghidra starts#

one questionone sessionbind Ghidrainspectclientrea CLIone question per callclientrea MCP server207 tools, 6 promptsprocessBinarySessionone active targetprocessrea-artifact-graphno Ghidra neededprocessGhidraProvideranalyzeHeadless and asocketone questionone sessionbind Ghidrainspectclientrea CLIone question per callclientrea MCP server207 tools, 6 promptsprocessBinarySessionone active targetprocessrea-artifact-graphno Ghidra neededprocessGhidraProvideranalyzeHeadless and asocket

One inspection, step by step#

1Callerrun rea inspect-artifactfixtures/ledger-arm64-O1 --format json. NoGhidra starts.2rea-artifact-graphhash the file with SHA-256 and detect the formatfrom the magic bytes.3Manifestone node and one occurrence, withintegrity_policy set to fail.4Answerthe Evidence record returns in under a second,without Java.

One binary, start to finish#

rea doctor --provider ghidrais the provider healthy
rea inspect-artifact <path>artifact graph of the file, no Ghidra
rea analyze <path> --provider ghidrasegments, procedure and string counts
rea function <path> <name> --provider ghidrathe dossier of one procedure
rea decompile <path> <name> --provider ghidrapseudocode of one procedure

Work with Evidence bundles#

TaskCode
List the records of a bundle without payloadsrea inspect-evidence-bundle '{"path":"<bundle>", "detail": "summary"}'
Write a canonical copy with sorted keysrea evidence-export <bundle> <out>
Validate every record id and manifest of a bundlerea evidence-import <bundle>
Compare two bundles by record membershiprea compare <left> <right>
Map a virtual address to a file offsetrea address-to-file-offset <path> <address> --provider ghidra

Ask rea one question#

TaskCode
Check Ghidra and the environmentrea doctor --provider ghidra --format json --filter-output healthy,environment_healthy,scope,scope_checks
List the capabilitiesrea capabilities --format json
Inspect an artifactrea inspect-artifact fixtures/ledger-arm64-O1 --format json
Inspect a Mach-O layout on macOSrea inspect-macho

Commands and environment variables#

CommandWhat it does
rea functionCalls analyze_function for one dossier per procedure
rea decompileCalls procedure_pseudo_code for pseudocode
rea analyzeCalls binary_overview for the whole binary
GHIDRA_INSTALL_DIRGhidra install directory, else the Homebrew path

Questions and answers#

Does inspect-artifact need Ghidra?
No. It returns in under a second, without Java.
Which command gives pseudocode for one function?
rea decompile, which calls procedure_pseudo_code.
What is the first call on a new file?
Run rea inspect-artifact. It needs no engine.

Tips#

  • Ask rea for an Evidence record, and read Ghidra's own listing when you doubt it.
  • Use the CLI for one question and the MCP server for a session of many.
  • Expect 7 to 9 s for the first Ghidra question on a file, and milliseconds after it.

Pins and limits#

SettingDefaultNote
rea6.7.0rea-agents package version
Ghidra12.1.4PUBLIC build
JDKOpenJDK 21.0.12.1JAVA_HOME or the Homebrew path
One-shot Ghidra call7 to 9 sImport into a fresh project
integrity_policyfailParameter of inspect-artifact

Troubleshooting#

SymptomCauseFix
rea doctor fails a checkrea 6.7.0, Ghidra 12.1.4 or JDK 21 is missingInstall the pinned version and run rea doctor again
First Ghidra call takes 7 to 9 sGhidra imports the file into a fresh projectKeep one MCP session open
inspect-binary-layout returns capability_unavailableIt uses the pwntools profile, Linux x64 onlyRun it on Linux x64, or use rea inspect-macho on macOS