feat(ghidra): configurable import language and analysis seeds (#1667)
* feat(ghidra): configurable import language and analysis seeds REA_GHIDRA_LANGUAGE_ID and REA_GHIDRA_COMPILER_SPEC_ID set the import language when the header cannot identify the compiler (for example, Borland C++ PE images). REA_GHIDRA_SEED_FILE seeds functions, code and labels before auto-analysis, for code reached only through computed jumps or data. Both are validated before launch, recorded in the analysis profile and verified in the bridge handshake. * fix(ghidra): parse language XML and preserve seed ordering * test(ghidra): use explicit platform paths for seed launch checks * fix(javascript): retain cleanup failure reason in error causes --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
* Explicit Ghidra import language for targets whose header cannot identify the
|
||||
* producing compiler, such as Borland-built PE images.
|
||||
*/
|
||||
export interface GhidraLanguageOverride {
|
||||
/** Ghidra language ID: `processor:endian:size:variant`. */
|
||||
readonly languageId: string;
|
||||
/** Ghidra compiler-spec ID; absent selects the language's default spec. */
|
||||
readonly compilerSpecId?: string;
|
||||
}
|
||||
|
||||
// Ghidra language IDs are four colon-separated fields; variants may contain
|
||||
// spaces ("x86:LE:16:Real Mode") but never leading or trailing whitespace.
|
||||
export const ghidraLanguageIdSchema = z
|
||||
.string()
|
||||
.regex(
|
||||
/^[A-Za-z0-9_.+-]+:(?:LE|BE):[1-9]\d*:[A-Za-z0-9_.+-](?:[A-Za-z0-9_.+ -]*[A-Za-z0-9_.+-])?$/u,
|
||||
"must be a Ghidra language ID such as x86:LE:32:default",
|
||||
);
|
||||
|
||||
export const ghidraCompilerSpecIdSchema = z
|
||||
.string()
|
||||
.regex(
|
||||
/^[A-Za-z0-9_.+-]+$/u,
|
||||
"must be a Ghidra compiler-spec ID such as default or borlandcpp",
|
||||
);
|
||||
Reference in New Issue
Block a user