feat(ghidra): apply validated analyzer overrides before analysis
Apply caller-selected analyzer opt-outs before Ghidra analysis, reject unknown or ineffective names, and commit raw/header imports to the same analyzer profile. Use supported x86 raw compiler specs and cover the real analyzer/readback and raw workflows. Adopts the original implementation from #1800 with validated corrections. Refs #1783, #1836. Co-authored-by: akushonkamen <74654766+akushonkamen@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
co-authored by
akushonkamen
Kaoru0822
parent
12ee785e5e
commit
9878bb7296
@@ -108,6 +108,8 @@ export interface GhidraHeadlessLauncherOptions {
|
||||
};
|
||||
/** Explicit import language committed by the analysis profile. */
|
||||
readonly languageOverride?: GhidraLanguageOverride;
|
||||
/** Auto-analyzers disabled before default auto-analysis, as configured. */
|
||||
readonly disabledAnalyzers?: readonly string[];
|
||||
/** Caller seeds committed by the analysis profile, applied before analysis. */
|
||||
readonly analysisSeeds?: GhidraSeedCommitment;
|
||||
readonly analysisExtensions?: readonly GhidraExtension[];
|
||||
@@ -213,6 +215,9 @@ export class GhidraHeadlessLauncher implements GhidraLauncher {
|
||||
? {}
|
||||
: { languageOverride: this.options.languageOverride }),
|
||||
...(seedPath === undefined ? {} : { seedPath }),
|
||||
...(this.options.disabledAnalyzers === undefined
|
||||
? {}
|
||||
: { disabledAnalyzers: this.options.disabledAnalyzers }),
|
||||
});
|
||||
const scriptCommand = ghidraHeadlessCommand({
|
||||
environment: this.options.environment,
|
||||
@@ -425,6 +430,8 @@ export interface GhidraHeadlessArgumentOptions {
|
||||
readonly baseAddr: string;
|
||||
};
|
||||
readonly languageOverride?: GhidraLanguageOverride;
|
||||
/** Auto-analyzers disabled by the pre-analysis options script. */
|
||||
readonly disabledAnalyzers?: readonly string[];
|
||||
/** Canonical seed snapshot passed to the pre-analysis seed script. */
|
||||
readonly seedPath?: string;
|
||||
}
|
||||
@@ -555,6 +562,16 @@ export const ghidraHeadlessArguments = (
|
||||
scriptPath.join(bridgeDirectory, GHIDRA_SEED_SCRIPT),
|
||||
options.seedPath,
|
||||
]),
|
||||
// Analyzer options must apply before default auto-analysis and before the
|
||||
// post-analysis repair and bridge scripts start serving.
|
||||
...(options.disabledAnalyzers === undefined ||
|
||||
options.disabledAnalyzers.length === 0
|
||||
? []
|
||||
: [
|
||||
"-preScript",
|
||||
scriptPath.join(bridgeDirectory, "ReaGhidraAnalysisOptions.java"),
|
||||
options.disabledAnalyzers.join(","),
|
||||
]),
|
||||
...((options.platform ?? process.platform) === "win32"
|
||||
? []
|
||||
: [
|
||||
|
||||
Reference in New Issue
Block a user