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

* 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
This commit is contained in:
N0zoM1z0
2026-10-06 16:26:40 +08:00
committed by GitHub
parent d565ecdc25
commit 5bcb6645b5
45 changed files with 1104 additions and 75 deletions
+31 -8
View File
@@ -27,6 +27,8 @@ export const resolveGhidraAnalysisProfile = (
);
const provider = { ...identity, version: installation.providerVersion };
const dosMz = target.format === "dos-mz";
const dosCom = target.format === "dos-com";
const dos = dosMz || dosCom;
return Promise.resolve(
ok({
profile: createAnalysisProfile(provider, {
@@ -37,26 +39,47 @@ export const resolveGhidraAnalysisProfile = (
...(target.availableArchitectures ?? []),
].sort(),
import_mode: "ephemeral-read-only",
load_image_observations: "source-mappings-entry-context-v2",
function_body_evidence: "complete-inclusive-ranges-v1",
...(dosMz
? { load_image_evidence: "independent-mz-mapping-relocations-v1" }
...(dos
? {
load_image_evidence: dosCom
? "independent-com-mapping-context-v1"
: "independent-mz-mapping-relocations-v1",
}
: {}),
jump_table_evidence: "typed-case-default-blocks-v1",
decompiler_jump_loads: true,
loader: dosMz ? "MzLoader" : "auto-from-header",
language_id: dosMz ? "x86:LE:16:Real Mode" : "auto-from-header",
compiler_spec_id: dosMz ? "default" : "auto-default",
...(dosMz
loader: dosMz
? "MzLoader"
: dosCom
? "BinaryLoader"
: "auto-from-header",
language_id: dos ? "x86:LE:16:Real Mode" : "auto-from-header",
compiler_spec_id: dos ? "default" : "auto-default",
...(dos
? {
load_segment: "0x1000",
address_coordinates: "linear-byte-offset",
}
: {}),
...(dosCom
? {
entry_offset: "0x100",
register_context: {
CS: "0x1000",
DS: "0x1000",
ES: "0x1000",
SS: "0x1000",
},
entry_seed: "external-entry-and-function-before-analysis-v1",
}
: {}),
analyzer_preset: "ghidra-default",
}),
compatibility: {
languageId: dosMz ? "x86:LE:16:Real Mode" : "auto",
compilerSpecId: dosMz ? "default" : "auto",
languageId: dos ? "x86:LE:16:Real Mode" : "auto",
compilerSpecId: dos ? "default" : "auto",
},
}),
);