Skip to content

feat(ghidra): admit explicit DOS COM analysis - #702

Merged
N0zoM1z0 merged 2 commits into
mainfrom
feat/ghidra-dos-com-analysis
Oct 6, 2026
Merged

N0zoM1z0 merged 2 commits into
mainfrom
feat/ghidra-dos-com-analysis

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Admit headerless DOS COM only when the caller explicitly selects its interpretation: open_binary({path, format: "dos-com"}) or CLI --target-format dos-com. Omission preserves header detection; the hint intentionally selects a complete-file interpretation independently of its filename. Validate the 64 KiB segment / 256-byte PSP format extent and reject contradictory target kinds.
  • Import with BinaryLoader at 1000:0100, the x86 real-mode language and default compiler spec. A packaged pre-analysis script seeds the entry and CS/DS/ES/SS context. Failed preparation prevents bridge startup.
  • Extend independent load-image verification to complete COM bytes, source mappings, entry, register context and absence of fixups; return imposed context separately from unverified PSP, stack and runtime state. Include measured entry context in MZ/other observations and bind the new observation representation in the analysis profile to invalidate incompatible cached snapshots.
  • Preserve DOS identity through Evidence, snapshots, artifact graphs and CLI/MCP boundaries. Hopper explicitly rejects this format. Package the new Java adapter asset and document the workflow/verification lane.

Verification

  • 114 focused tests across COM format/boundary validation, MZ/COM independent comparisons and negative controls, launcher arguments, provider projection, CLI/catalog contracts and SDK MCP transport.
  • npm run check:fast; npm run docs:check.
  • Actual node scripts/verify-real-ghidra-com.mjs: Linux x64 / Ghidra 12.1.4, generated public fixture, CLI/MCP parity for load-image/whole-file bytes/source offsets, imposed entry context, unmapped PSP/partial read, function discovery/decompilation, unchanged original and no surviving owned descendants. Run b2d266c0-bcfb-4efc-874b-a1e57e1285aa.
  • Actual MZ load-image CLI regression on the source-built MZ fixture, with all checks passing and no surviving owned descendants. Run ec12a784-ea4f-4b57-a424-0acb251e0ba1.
  • Two private local COM analysis images (original and separately identified decoded derivative) also verified with actual Ghidra. No game data, paths, digests, projects or outputs are committed.
  • npm package manifest confirms the Java preparation asset is included and private reference/work directories are excluded. The COM lane also passed against an extracted npm tarball with the locked local dependencies, including actual CLI/MCP/decompilation and clean process lineage. Packaged run e975cc01-adb5-43af-8936-ea580bd05fa5.
  • Real Hopper, macOS and Windows verification was not performed. Windows P0 remains unchanged and excludes DOS.

Examples

rea inspect-native-load-image /absolute/path/to/legacy.com --target-format dos-com --provider ghidra --json
rea function /absolute/path/to/legacy.com 0x10100 --target-format dos-com --provider ghidra --json
{"name":"open_binary","arguments":{"path":"/absolute/path/to/legacy.com","format":"dos-com","provider_id":"ghidra"}}
{"name":"inspect_native_load_image","arguments":{}}

COM is an explicit interpretation, not magic-based format identification. Verified import and decompilation do not establish DOS/PC-98 execution or source reconstruction.

Carry caller-selected COM interpretation through CLI, MCP and target
identity, seed real-mode entry/context before Ghidra analysis, and verify
complete loaded bytes, source mappings and measured register context.
Keep original binaries unchanged and PSP/runtime coverage explicit.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
@N0zoM1z0
N0zoM1z0 merged commit 5bcb664 into main Oct 6, 2026
19 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/ghidra-dos-com-analysis branch October 6, 2026 08:26
morluto added a commit that referenced this pull request Oct 6, 2026
…705)

* fix(javascript): preserve array index positions

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): respect object property overwrite order

Signed-off-by: RudyCelekli <[email protected]>

* test(javascript): cover uncertain spread discriminants

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): keep nonfinite values outside JSON lattice

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): keep non-CIL method implementations unknown

Signed-off-by: RudyCelekli <[email protected]>

* test(package): separate CIL reconstruction from native imports

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): invalidate values on nontrivial binding writes

Signed-off-by: RudyCelekli <[email protected]>

* fix(artifacts): align native DMG mount and detach lifecycle

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): retain all literal worker import arguments

Signed-off-by: RudyCelekli <[email protected]>

* fix(native): preserve final demangled symbol whitespace

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): preserve C identifier underscores in native matching

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): respect metadata key and overwrite semantics

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): keep optional parameter input unknown

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): report observed method metadata changes

Signed-off-by: RudyCelekli <[email protected]>

* docs(dotnet): synchronize generated conformance skill digest

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): reject malformed indexed source-map offsets

Signed-off-by: RudyCelekli <[email protected]>

* fix(native): preserve numeric-looking Mach-O identifiers

Signed-off-by: RudyCelekli <[email protected]>

* docs: regenerate catalogs for integrated fix batch

* docs: regenerate catalogs after merging main (#702)

---------

Signed-off-by: RudyCelekli <[email protected]>
Co-authored-by: RudyCelekli <[email protected]>
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
* feat(ghidra): admit explicit DOS COM analysis

Carry caller-selected COM interpretation through CLI, MCP and target
identity, seed real-mode entry/context before Ghidra analysis, and verify
complete loaded bytes, source mappings and measured register context.
Keep original binaries unchanged and PSP/runtime coverage explicit.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)

* fix(verification): validate COM package selection before allocating fixtures
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…orluto#705)

* fix(javascript): preserve array index positions

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): respect object property overwrite order

Signed-off-by: RudyCelekli <[email protected]>

* test(javascript): cover uncertain spread discriminants

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): keep nonfinite values outside JSON lattice

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): keep non-CIL method implementations unknown

Signed-off-by: RudyCelekli <[email protected]>

* test(package): separate CIL reconstruction from native imports

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): invalidate values on nontrivial binding writes

Signed-off-by: RudyCelekli <[email protected]>

* fix(artifacts): align native DMG mount and detach lifecycle

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): retain all literal worker import arguments

Signed-off-by: RudyCelekli <[email protected]>

* fix(native): preserve final demangled symbol whitespace

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): preserve C identifier underscores in native matching

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): respect metadata key and overwrite semantics

Signed-off-by: RudyCelekli <[email protected]>

* fix(javascript): keep optional parameter input unknown

Signed-off-by: RudyCelekli <[email protected]>

* fix(dotnet): report observed method metadata changes

Signed-off-by: RudyCelekli <[email protected]>

* docs(dotnet): synchronize generated conformance skill digest

Signed-off-by: RudyCelekli <[email protected]>

* fix(browser): reject malformed indexed source-map offsets

Signed-off-by: RudyCelekli <[email protected]>

* fix(native): preserve numeric-looking Mach-O identifiers

Signed-off-by: RudyCelekli <[email protected]>

* docs: regenerate catalogs for integrated fix batch

* docs: regenerate catalogs after merging main (morluto#702)

---------

Signed-off-by: RudyCelekli <[email protected]>
Co-authored-by: RudyCelekli <[email protected]>
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the provider: ghidra Analysis provider / engine: ghidra label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants