windows-exe-decompiler-mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODEX_INSTALLATION.md +69 -0
- package/COPILOT_INSTALLATION.md +77 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/bin/windows-exe-decompiler-mcp-server.js +3 -0
- package/dist/analysis-provenance.d.ts +184 -0
- package/dist/analysis-provenance.js +74 -0
- package/dist/analysis-task-runner.d.ts +31 -0
- package/dist/analysis-task-runner.js +160 -0
- package/dist/artifact-inventory.d.ts +23 -0
- package/dist/artifact-inventory.js +175 -0
- package/dist/cache-manager.d.ts +128 -0
- package/dist/cache-manager.js +454 -0
- package/dist/confidence-semantics.d.ts +66 -0
- package/dist/confidence-semantics.js +122 -0
- package/dist/config.d.ts +335 -0
- package/dist/config.js +193 -0
- package/dist/database.d.ts +227 -0
- package/dist/database.js +601 -0
- package/dist/decompiler-worker.d.ts +441 -0
- package/dist/decompiler-worker.js +1962 -0
- package/dist/dynamic-trace.d.ts +95 -0
- package/dist/dynamic-trace.js +629 -0
- package/dist/env-validator.d.ts +15 -0
- package/dist/env-validator.js +249 -0
- package/dist/error-handler.d.ts +28 -0
- package/dist/error-handler.example.d.ts +22 -0
- package/dist/error-handler.example.js +141 -0
- package/dist/error-handler.js +139 -0
- package/dist/ghidra-analysis-status.d.ts +49 -0
- package/dist/ghidra-analysis-status.js +178 -0
- package/dist/ghidra-config.d.ts +134 -0
- package/dist/ghidra-config.js +464 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +200 -0
- package/dist/job-queue.d.ts +169 -0
- package/dist/job-queue.js +407 -0
- package/dist/logger.d.ts +106 -0
- package/dist/logger.js +176 -0
- package/dist/policy-guard.d.ts +115 -0
- package/dist/policy-guard.js +243 -0
- package/dist/process-output.d.ts +15 -0
- package/dist/process-output.js +90 -0
- package/dist/prompts/function-explanation-review.d.ts +5 -0
- package/dist/prompts/function-explanation-review.js +64 -0
- package/dist/prompts/semantic-name-review.d.ts +5 -0
- package/dist/prompts/semantic-name-review.js +63 -0
- package/dist/runtime-correlation.d.ts +34 -0
- package/dist/runtime-correlation.js +279 -0
- package/dist/runtime-paths.d.ts +3 -0
- package/dist/runtime-paths.js +11 -0
- package/dist/selection-diff.d.ts +667 -0
- package/dist/selection-diff.js +53 -0
- package/dist/semantic-name-suggestion-artifacts.d.ts +116 -0
- package/dist/semantic-name-suggestion-artifacts.js +314 -0
- package/dist/server.d.ts +129 -0
- package/dist/server.js +578 -0
- package/dist/tools/artifact-read.d.ts +235 -0
- package/dist/tools/artifact-read.js +317 -0
- package/dist/tools/artifacts-diff.d.ts +728 -0
- package/dist/tools/artifacts-diff.js +304 -0
- package/dist/tools/artifacts-list.d.ts +515 -0
- package/dist/tools/artifacts-list.js +389 -0
- package/dist/tools/attack-map.d.ts +290 -0
- package/dist/tools/attack-map.js +519 -0
- package/dist/tools/cache-observability.d.ts +4 -0
- package/dist/tools/cache-observability.js +36 -0
- package/dist/tools/code-function-cfg.d.ts +50 -0
- package/dist/tools/code-function-cfg.js +102 -0
- package/dist/tools/code-function-decompile.d.ts +55 -0
- package/dist/tools/code-function-decompile.js +103 -0
- package/dist/tools/code-function-disassemble.d.ts +43 -0
- package/dist/tools/code-function-disassemble.js +185 -0
- package/dist/tools/code-function-explain-apply.d.ts +255 -0
- package/dist/tools/code-function-explain-apply.js +225 -0
- package/dist/tools/code-function-explain-prepare.d.ts +535 -0
- package/dist/tools/code-function-explain-prepare.js +276 -0
- package/dist/tools/code-function-explain-review.d.ts +397 -0
- package/dist/tools/code-function-explain-review.js +589 -0
- package/dist/tools/code-function-rename-apply.d.ts +248 -0
- package/dist/tools/code-function-rename-apply.js +220 -0
- package/dist/tools/code-function-rename-prepare.d.ts +506 -0
- package/dist/tools/code-function-rename-prepare.js +279 -0
- package/dist/tools/code-function-rename-review.d.ts +574 -0
- package/dist/tools/code-function-rename-review.js +761 -0
- package/dist/tools/code-functions-list.d.ts +37 -0
- package/dist/tools/code-functions-list.js +91 -0
- package/dist/tools/code-functions-rank.d.ts +34 -0
- package/dist/tools/code-functions-rank.js +90 -0
- package/dist/tools/code-functions-reconstruct.d.ts +2725 -0
- package/dist/tools/code-functions-reconstruct.js +2807 -0
- package/dist/tools/code-functions-search.d.ts +39 -0
- package/dist/tools/code-functions-search.js +90 -0
- package/dist/tools/code-reconstruct-export.d.ts +1212 -0
- package/dist/tools/code-reconstruct-export.js +4002 -0
- package/dist/tools/code-reconstruct-plan.d.ts +274 -0
- package/dist/tools/code-reconstruct-plan.js +342 -0
- package/dist/tools/dotnet-metadata-extract.d.ts +541 -0
- package/dist/tools/dotnet-metadata-extract.js +355 -0
- package/dist/tools/dotnet-reconstruct-export.d.ts +567 -0
- package/dist/tools/dotnet-reconstruct-export.js +1151 -0
- package/dist/tools/dotnet-types-list.d.ts +325 -0
- package/dist/tools/dotnet-types-list.js +201 -0
- package/dist/tools/dynamic-dependencies.d.ts +115 -0
- package/dist/tools/dynamic-dependencies.js +213 -0
- package/dist/tools/dynamic-memory-import.d.ts +10 -0
- package/dist/tools/dynamic-memory-import.js +567 -0
- package/dist/tools/dynamic-trace-import.d.ts +10 -0
- package/dist/tools/dynamic-trace-import.js +235 -0
- package/dist/tools/entrypoint-fallback-disasm.d.ts +30 -0
- package/dist/tools/entrypoint-fallback-disasm.js +89 -0
- package/dist/tools/ghidra-analyze.d.ts +88 -0
- package/dist/tools/ghidra-analyze.js +208 -0
- package/dist/tools/ghidra-health.d.ts +37 -0
- package/dist/tools/ghidra-health.js +212 -0
- package/dist/tools/ioc-export.d.ts +209 -0
- package/dist/tools/ioc-export.js +542 -0
- package/dist/tools/packer-detect.d.ts +165 -0
- package/dist/tools/packer-detect.js +284 -0
- package/dist/tools/pe-exports-extract.d.ts +175 -0
- package/dist/tools/pe-exports-extract.js +253 -0
- package/dist/tools/pe-fingerprint.d.ts +234 -0
- package/dist/tools/pe-fingerprint.js +269 -0
- package/dist/tools/pe-imports-extract.d.ts +105 -0
- package/dist/tools/pe-imports-extract.js +245 -0
- package/dist/tools/report-generate.d.ts +157 -0
- package/dist/tools/report-generate.js +457 -0
- package/dist/tools/report-summarize.d.ts +2131 -0
- package/dist/tools/report-summarize.js +596 -0
- package/dist/tools/runtime-detect.d.ts +135 -0
- package/dist/tools/runtime-detect.js +247 -0
- package/dist/tools/sample-ingest.d.ts +94 -0
- package/dist/tools/sample-ingest.js +327 -0
- package/dist/tools/sample-profile-get.d.ts +183 -0
- package/dist/tools/sample-profile-get.js +121 -0
- package/dist/tools/sandbox-execute.d.ts +441 -0
- package/dist/tools/sandbox-execute.js +392 -0
- package/dist/tools/strings-extract.d.ts +375 -0
- package/dist/tools/strings-extract.js +314 -0
- package/dist/tools/strings-floss-decode.d.ts +143 -0
- package/dist/tools/strings-floss-decode.js +259 -0
- package/dist/tools/system-health.d.ts +434 -0
- package/dist/tools/system-health.js +446 -0
- package/dist/tools/task-cancel.d.ts +21 -0
- package/dist/tools/task-cancel.js +70 -0
- package/dist/tools/task-status.d.ts +27 -0
- package/dist/tools/task-status.js +106 -0
- package/dist/tools/task-sweep.d.ts +22 -0
- package/dist/tools/task-sweep.js +77 -0
- package/dist/tools/tool-help.d.ts +340 -0
- package/dist/tools/tool-help.js +261 -0
- package/dist/tools/yara-scan.d.ts +554 -0
- package/dist/tools/yara-scan.js +313 -0
- package/dist/types.d.ts +266 -0
- package/dist/types.js +41 -0
- package/dist/worker-pool.d.ts +204 -0
- package/dist/worker-pool.js +650 -0
- package/dist/workflows/deep-static.d.ts +104 -0
- package/dist/workflows/deep-static.js +276 -0
- package/dist/workflows/function-explanation-review.d.ts +655 -0
- package/dist/workflows/function-explanation-review.js +440 -0
- package/dist/workflows/reconstruct.d.ts +2053 -0
- package/dist/workflows/reconstruct.js +666 -0
- package/dist/workflows/semantic-name-review.d.ts +2418 -0
- package/dist/workflows/semantic-name-review.js +521 -0
- package/dist/workflows/triage.d.ts +659 -0
- package/dist/workflows/triage.js +1374 -0
- package/dist/workspace-manager.d.ts +150 -0
- package/dist/workspace-manager.js +411 -0
- package/ghidra_scripts/DecompileFunction.java +487 -0
- package/ghidra_scripts/DecompileFunction.py +150 -0
- package/ghidra_scripts/ExtractCFG.java +256 -0
- package/ghidra_scripts/ExtractCFG.py +233 -0
- package/ghidra_scripts/ExtractFunctions.java +442 -0
- package/ghidra_scripts/ExtractFunctions.py +101 -0
- package/ghidra_scripts/README.md +125 -0
- package/ghidra_scripts/SearchFunctionReferences.java +380 -0
- package/helpers/DotNetMetadataProbe/DotNetMetadataProbe.csproj +9 -0
- package/helpers/DotNetMetadataProbe/Program.cs +566 -0
- package/install-to-codex.ps1 +178 -0
- package/install-to-copilot.ps1 +303 -0
- package/package.json +101 -0
- package/requirements.txt +9 -0
- package/workers/requirements-dynamic.txt +11 -0
- package/workers/requirements.txt +8 -0
- package/workers/speakeasy_compat.py +175 -0
- package/workers/static_worker.py +5183 -0
- package/workers/yara_rules/default.yar +33 -0
- package/workers/yara_rules/malware_families.yar +93 -0
- package/workers/yara_rules/packers.yar +80 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompiler Worker - Ghidra Headless integration
|
|
3
|
+
*
|
|
4
|
+
* Implements requirements 8.1-8.6:
|
|
5
|
+
* - Creates isolated Ghidra project spaces
|
|
6
|
+
* - Executes Ghidra Headless analysis
|
|
7
|
+
* - Extracts function lists
|
|
8
|
+
* - Stores results in database
|
|
9
|
+
* - Handles timeouts and failures
|
|
10
|
+
*/
|
|
11
|
+
import { type GhidraCapabilityStatus } from './ghidra-analysis-status.js';
|
|
12
|
+
import type { DatabaseManager } from './database.js';
|
|
13
|
+
import type { WorkspaceManager } from './workspace-manager.js';
|
|
14
|
+
import type { JobResult } from './types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Options for Ghidra analysis
|
|
17
|
+
* Requirements: 8.1
|
|
18
|
+
*/
|
|
19
|
+
export interface GhidraOptions {
|
|
20
|
+
analysisId?: string;
|
|
21
|
+
projectKey?: string;
|
|
22
|
+
analysisOptions?: Record<string, unknown>;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
maxCpu?: string;
|
|
25
|
+
abortSignal?: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of Ghidra analysis
|
|
29
|
+
* Requirements: 8.2, 8.3, 8.4
|
|
30
|
+
*/
|
|
31
|
+
export interface AnalysisResult {
|
|
32
|
+
analysisId: string;
|
|
33
|
+
backend: 'ghidra';
|
|
34
|
+
functionCount: number;
|
|
35
|
+
projectPath: string;
|
|
36
|
+
status: 'done' | 'partial_success';
|
|
37
|
+
warnings?: string[];
|
|
38
|
+
readiness?: {
|
|
39
|
+
function_index: GhidraCapabilityStatus;
|
|
40
|
+
decompile: GhidraCapabilityStatus;
|
|
41
|
+
cfg: GhidraCapabilityStatus;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Function information extracted from Ghidra
|
|
46
|
+
* Requirements: 8.3
|
|
47
|
+
*/
|
|
48
|
+
export interface GhidraFunction {
|
|
49
|
+
address: string;
|
|
50
|
+
name: string;
|
|
51
|
+
size: number;
|
|
52
|
+
is_thunk: boolean;
|
|
53
|
+
is_external: boolean;
|
|
54
|
+
calling_convention: string;
|
|
55
|
+
signature: string;
|
|
56
|
+
callers: Array<{
|
|
57
|
+
address: string;
|
|
58
|
+
name: string;
|
|
59
|
+
}>;
|
|
60
|
+
caller_count: number;
|
|
61
|
+
callees: Array<{
|
|
62
|
+
address: string;
|
|
63
|
+
name: string;
|
|
64
|
+
}>;
|
|
65
|
+
callee_count: number;
|
|
66
|
+
caller_relationships?: FunctionRelationship[];
|
|
67
|
+
callee_relationships?: FunctionRelationship[];
|
|
68
|
+
is_entry_point: boolean;
|
|
69
|
+
is_exported: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Ghidra analysis output format
|
|
73
|
+
*/
|
|
74
|
+
export interface GhidraAnalysisOutput {
|
|
75
|
+
program_name: string;
|
|
76
|
+
program_path: string;
|
|
77
|
+
function_count: number;
|
|
78
|
+
functions: GhidraFunction[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Function information for listing
|
|
82
|
+
* Requirements: 9.1
|
|
83
|
+
*/
|
|
84
|
+
export interface FunctionInfo {
|
|
85
|
+
name: string;
|
|
86
|
+
address: string;
|
|
87
|
+
size: number;
|
|
88
|
+
callers: number;
|
|
89
|
+
callees: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Ranked function with score and reasons
|
|
93
|
+
* Requirements: 9.2, 9.8
|
|
94
|
+
*/
|
|
95
|
+
export interface RankedFunction {
|
|
96
|
+
address: string;
|
|
97
|
+
name: string;
|
|
98
|
+
score: number;
|
|
99
|
+
reasons: string[];
|
|
100
|
+
xref_summary?: FunctionXrefSummary[];
|
|
101
|
+
}
|
|
102
|
+
export interface FunctionXrefSummary {
|
|
103
|
+
api: string;
|
|
104
|
+
provenance: 'static_named_call' | 'dynamic_resolution_api' | 'dynamic_resolution_helper' | 'global_string_hint' | 'unknown';
|
|
105
|
+
confidence: number;
|
|
106
|
+
evidence: string[];
|
|
107
|
+
}
|
|
108
|
+
export interface FunctionRelationship {
|
|
109
|
+
address: string;
|
|
110
|
+
name: string;
|
|
111
|
+
relation_types: string[];
|
|
112
|
+
reference_types: string[];
|
|
113
|
+
reference_addresses: string[];
|
|
114
|
+
target_addresses?: string[];
|
|
115
|
+
resolved_by?: string;
|
|
116
|
+
is_exact?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface FunctionSearchStringMatch {
|
|
119
|
+
value: string;
|
|
120
|
+
data_address?: string;
|
|
121
|
+
referenced_from?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface FunctionSearchMatch {
|
|
124
|
+
function: string;
|
|
125
|
+
address: string;
|
|
126
|
+
caller_count: number;
|
|
127
|
+
callee_count: number;
|
|
128
|
+
api_matches?: string[];
|
|
129
|
+
string_matches?: FunctionSearchStringMatch[];
|
|
130
|
+
match_types: Array<'api_call' | 'string_reference' | 'api_call_index'>;
|
|
131
|
+
}
|
|
132
|
+
export interface FunctionSearchResult {
|
|
133
|
+
query: {
|
|
134
|
+
api?: string;
|
|
135
|
+
string?: string;
|
|
136
|
+
limit: number;
|
|
137
|
+
};
|
|
138
|
+
matches: FunctionSearchMatch[];
|
|
139
|
+
count: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Cross-reference information
|
|
143
|
+
* Requirements: 10.4
|
|
144
|
+
*/
|
|
145
|
+
export interface CrossReference {
|
|
146
|
+
from_address: string;
|
|
147
|
+
type: string;
|
|
148
|
+
is_call: boolean;
|
|
149
|
+
is_data: boolean;
|
|
150
|
+
from_function?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Decompiled function result
|
|
154
|
+
* Requirements: 10.1, 10.2, 10.3, 10.4
|
|
155
|
+
*/
|
|
156
|
+
export interface DecompiledFunction {
|
|
157
|
+
function: string;
|
|
158
|
+
address: string;
|
|
159
|
+
pseudocode: string;
|
|
160
|
+
callers: Array<{
|
|
161
|
+
address: string;
|
|
162
|
+
name: string;
|
|
163
|
+
}>;
|
|
164
|
+
callees: Array<{
|
|
165
|
+
address: string;
|
|
166
|
+
name: string;
|
|
167
|
+
}>;
|
|
168
|
+
caller_relationships?: FunctionRelationship[];
|
|
169
|
+
callee_relationships?: FunctionRelationship[];
|
|
170
|
+
xrefs?: CrossReference[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* CFG Node
|
|
174
|
+
* Requirements: 11.2, 11.3
|
|
175
|
+
*/
|
|
176
|
+
export interface CFGNode {
|
|
177
|
+
id: string;
|
|
178
|
+
address: string;
|
|
179
|
+
instructions: string[];
|
|
180
|
+
type: 'entry' | 'exit' | 'basic' | 'call' | 'return';
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* CFG Edge
|
|
184
|
+
* Requirements: 11.4
|
|
185
|
+
*/
|
|
186
|
+
export interface CFGEdge {
|
|
187
|
+
from: string;
|
|
188
|
+
to: string;
|
|
189
|
+
type: 'fallthrough' | 'jump' | 'call' | 'return';
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Control Flow Graph
|
|
193
|
+
* Requirements: 11.1, 11.5
|
|
194
|
+
*/
|
|
195
|
+
export interface ControlFlowGraph {
|
|
196
|
+
function: string;
|
|
197
|
+
address: string;
|
|
198
|
+
nodes: CFGNode[];
|
|
199
|
+
edges: CFGEdge[];
|
|
200
|
+
}
|
|
201
|
+
export interface GhidraProcessDiagnostics {
|
|
202
|
+
raw_cmd: string;
|
|
203
|
+
command: string;
|
|
204
|
+
args: string[];
|
|
205
|
+
cwd: string;
|
|
206
|
+
exit_code: number | null;
|
|
207
|
+
signal: NodeJS.Signals | null;
|
|
208
|
+
timed_out: boolean;
|
|
209
|
+
cancelled: boolean;
|
|
210
|
+
stdout: string;
|
|
211
|
+
stderr: string;
|
|
212
|
+
stdout_encoding: string;
|
|
213
|
+
stderr_encoding: string;
|
|
214
|
+
spawn_error?: string;
|
|
215
|
+
}
|
|
216
|
+
export interface NormalizedGhidraError {
|
|
217
|
+
code: 'timeout' | 'cancelled' | 'project_lock' | 'spawn_einval' | 'spawn_failure' | 'pyghidra_unavailable' | 'script_runtime_require_undefined' | 'missing_json_output' | 'ghidra_process_failure' | 'unknown';
|
|
218
|
+
category: 'transient' | 'environment' | 'configuration' | 'script_output' | 'process' | 'user';
|
|
219
|
+
summary: string;
|
|
220
|
+
remediation_hints: string[];
|
|
221
|
+
evidence: string[];
|
|
222
|
+
stage?: string;
|
|
223
|
+
}
|
|
224
|
+
export declare class GhidraProcessError extends Error {
|
|
225
|
+
readonly errorCode: 'E_TIMEOUT' | 'E_SPAWN' | 'E_GHIDRA_PROCESS' | 'E_CANCELLED';
|
|
226
|
+
readonly diagnostics: GhidraProcessDiagnostics;
|
|
227
|
+
constructor(message: string, diagnostics: GhidraProcessDiagnostics, errorCode: 'E_TIMEOUT' | 'E_SPAWN' | 'E_GHIDRA_PROCESS' | 'E_CANCELLED');
|
|
228
|
+
}
|
|
229
|
+
export declare class GhidraOutputParseError extends Error {
|
|
230
|
+
readonly diagnostics: GhidraProcessDiagnostics;
|
|
231
|
+
constructor(message: string, diagnostics: GhidraProcessDiagnostics);
|
|
232
|
+
}
|
|
233
|
+
export declare function getGhidraDiagnostics(error: unknown): GhidraProcessDiagnostics | undefined;
|
|
234
|
+
export declare function normalizeGhidraError(error: unknown, stage?: string): NormalizedGhidraError | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Decompiler Worker class
|
|
237
|
+
* Manages Ghidra Headless execution and result processing
|
|
238
|
+
*/
|
|
239
|
+
export declare class DecompilerWorker {
|
|
240
|
+
private database;
|
|
241
|
+
private workspaceManager;
|
|
242
|
+
constructor(database: DatabaseManager, workspaceManager: WorkspaceManager);
|
|
243
|
+
private delay;
|
|
244
|
+
private isProjectLockFailure;
|
|
245
|
+
private runWithProjectLockRetry;
|
|
246
|
+
/**
|
|
247
|
+
* Resolve sample file path in workspace/original.
|
|
248
|
+
* Prefer legacy "sample.exe" name, then fall back to first regular file.
|
|
249
|
+
*/
|
|
250
|
+
private resolveSamplePath;
|
|
251
|
+
/**
|
|
252
|
+
* Spawn Ghidra process with Windows batch-script compatibility.
|
|
253
|
+
* On Windows, spawning .bat/.cmd directly can throw EINVAL; route through
|
|
254
|
+
* buildProcessInvocation() so batch scripts run via explicit cmd.exe quoting.
|
|
255
|
+
*/
|
|
256
|
+
private spawnGhidraProcess;
|
|
257
|
+
private buildProcessDiagnostics;
|
|
258
|
+
private runGhidraCommand;
|
|
259
|
+
private buildAnalyzeBaseArgs;
|
|
260
|
+
private buildAnalysisArgs;
|
|
261
|
+
private buildExtractFunctionsArgs;
|
|
262
|
+
private executeMainAnalysis;
|
|
263
|
+
private executeFunctionExtractionScript;
|
|
264
|
+
private tryExtractFunctionsWithFallback;
|
|
265
|
+
private selectProbeTarget;
|
|
266
|
+
private buildCapabilityReadyStatus;
|
|
267
|
+
private buildCapabilityFailureStatus;
|
|
268
|
+
private probeCapability;
|
|
269
|
+
private resolveAnalysisProject;
|
|
270
|
+
private resolveGhidraAnalysisForCapability;
|
|
271
|
+
/**
|
|
272
|
+
* Analyze a sample with Ghidra Headless
|
|
273
|
+
*
|
|
274
|
+
* Requirements: 8.1, 8.2, 8.3, 8.4, 8.5, 8.6
|
|
275
|
+
*
|
|
276
|
+
* @param sampleId - Sample identifier
|
|
277
|
+
* @param options - Ghidra analysis options
|
|
278
|
+
* @returns Analysis result with function count and project path
|
|
279
|
+
*/
|
|
280
|
+
analyze(sampleId: string, options?: GhidraOptions): Promise<AnalysisResult>;
|
|
281
|
+
/**
|
|
282
|
+
* List functions from the functions table
|
|
283
|
+
*
|
|
284
|
+
* Requirements: 9.1
|
|
285
|
+
*
|
|
286
|
+
* @param sampleId - Sample identifier
|
|
287
|
+
* @param limit - Optional limit on number of functions to return
|
|
288
|
+
* @returns Array of function information
|
|
289
|
+
*/
|
|
290
|
+
listFunctions(sampleId: string, limit?: number): Promise<FunctionInfo[]>;
|
|
291
|
+
/**
|
|
292
|
+
* Rank functions by interest score
|
|
293
|
+
*
|
|
294
|
+
* Requirements: 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8
|
|
295
|
+
*
|
|
296
|
+
* Scoring rules:
|
|
297
|
+
* - Large functions (> 1000 bytes): +10 points (Requirement 9.3)
|
|
298
|
+
* - High caller count (> 10): +5 * log(callers) points (Requirement 9.4)
|
|
299
|
+
* - Calls sensitive APIs: +15 points (Requirement 9.5)
|
|
300
|
+
* - Entry point or exported: +20 points (Requirement 9.6)
|
|
301
|
+
*
|
|
302
|
+
* @param sampleId - Sample identifier
|
|
303
|
+
* @param topK - Number of top functions to return (default: 20)
|
|
304
|
+
* @returns Array of ranked functions with scores and reasons
|
|
305
|
+
*/
|
|
306
|
+
rankFunctions(sampleId: string, topK?: number): Promise<RankedFunction[]>;
|
|
307
|
+
searchFunctions(sampleId: string, options: {
|
|
308
|
+
apiQuery?: string;
|
|
309
|
+
stringQuery?: string;
|
|
310
|
+
limit?: number;
|
|
311
|
+
timeout?: number;
|
|
312
|
+
}): Promise<FunctionSearchResult>;
|
|
313
|
+
/**
|
|
314
|
+
* Decompile a specific function
|
|
315
|
+
*
|
|
316
|
+
* Requirements: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6
|
|
317
|
+
*
|
|
318
|
+
* @param sampleId - Sample identifier
|
|
319
|
+
* @param addressOrSymbol - Function address (hex string) or symbol name
|
|
320
|
+
* @param includeXrefs - Whether to include cross-references (default: false)
|
|
321
|
+
* @param timeout - Timeout in milliseconds (default: 30000)
|
|
322
|
+
* @returns Decompiled function with pseudocode, callers, callees, and optional xrefs
|
|
323
|
+
*/
|
|
324
|
+
decompileFunction(sampleId: string, addressOrSymbol: string, includeXrefs?: boolean, timeout?: number): Promise<DecompiledFunction>;
|
|
325
|
+
private buildOutputSnippet;
|
|
326
|
+
private buildSyntheticDiagnostics;
|
|
327
|
+
private buildNoJsonOutputMessage;
|
|
328
|
+
private normalizeNamedAddressList;
|
|
329
|
+
private normalizeStringArray;
|
|
330
|
+
private normalizeFunctionRelationships;
|
|
331
|
+
private normalizeCrossReferences;
|
|
332
|
+
private normalizeGhidraFunction;
|
|
333
|
+
private normalizeDecompiledFunction;
|
|
334
|
+
/**
|
|
335
|
+
* Parse Ghidra output JSON
|
|
336
|
+
*
|
|
337
|
+
* Requirements: 8.3
|
|
338
|
+
*
|
|
339
|
+
* @param output - Ghidra stdout output
|
|
340
|
+
* @returns Parsed analysis output
|
|
341
|
+
*/
|
|
342
|
+
private parseGhidraOutput;
|
|
343
|
+
/**
|
|
344
|
+
* Execute DecompileFunction.py script
|
|
345
|
+
*
|
|
346
|
+
* Requirements: 10.1, 10.2, 10.6 (timeout handling)
|
|
347
|
+
*
|
|
348
|
+
* @param projectPath - Ghidra project directory path
|
|
349
|
+
* @param projectKey - Unique project key
|
|
350
|
+
* @param samplePath - Path to sample file
|
|
351
|
+
* @param addressOrSymbol - Function address or symbol name
|
|
352
|
+
* @param includeXrefs - Whether to include cross-references
|
|
353
|
+
* @param timeout - Timeout in milliseconds
|
|
354
|
+
* @returns Ghidra output (stdout)
|
|
355
|
+
*/
|
|
356
|
+
private executeDecompileScript;
|
|
357
|
+
/**
|
|
358
|
+
* Parse decompile script output
|
|
359
|
+
*
|
|
360
|
+
* Requirements: 10.3, 10.4, 10.5
|
|
361
|
+
*
|
|
362
|
+
* @param output - Script stdout output
|
|
363
|
+
* @returns Parsed decompiled function or error
|
|
364
|
+
*/
|
|
365
|
+
private parseDecompileOutput;
|
|
366
|
+
/**
|
|
367
|
+
* Get control flow graph for a function
|
|
368
|
+
*
|
|
369
|
+
* Requirements: 11.1, 11.2, 11.3, 11.4, 11.5
|
|
370
|
+
*
|
|
371
|
+
* @param sampleId - Sample identifier
|
|
372
|
+
* @param addressOrSymbol - Function address (hex string) or symbol name
|
|
373
|
+
* @param timeout - Timeout in milliseconds (default: 30000)
|
|
374
|
+
* @returns Control flow graph with nodes and edges
|
|
375
|
+
*/
|
|
376
|
+
getFunctionCFG(sampleId: string, addressOrSymbol: string, timeout?: number): Promise<ControlFlowGraph>;
|
|
377
|
+
/**
|
|
378
|
+
* Execute ExtractCFG.py script
|
|
379
|
+
*
|
|
380
|
+
* Requirements: 11.1
|
|
381
|
+
*
|
|
382
|
+
* @param projectPath - Ghidra project directory path
|
|
383
|
+
* @param projectKey - Unique project key
|
|
384
|
+
* @param samplePath - Path to sample file
|
|
385
|
+
* @param addressOrSymbol - Function address or symbol name
|
|
386
|
+
* @param timeout - Timeout in milliseconds
|
|
387
|
+
* @returns Ghidra output (stdout)
|
|
388
|
+
*/
|
|
389
|
+
private executeCFGScript;
|
|
390
|
+
private searchFunctionsWithGhidra;
|
|
391
|
+
private searchFunctionsFromIndex;
|
|
392
|
+
private parseFunctionCallees;
|
|
393
|
+
private executeSearchScript;
|
|
394
|
+
private parseSearchOutput;
|
|
395
|
+
/**
|
|
396
|
+
* Parse CFG script output
|
|
397
|
+
*
|
|
398
|
+
* Requirements: 11.2, 11.3, 11.4, 11.5
|
|
399
|
+
*
|
|
400
|
+
* @param output - Script stdout output
|
|
401
|
+
* @returns Parsed control flow graph or error
|
|
402
|
+
*/
|
|
403
|
+
private parseCFGOutput;
|
|
404
|
+
/**
|
|
405
|
+
* Store functions to database
|
|
406
|
+
*
|
|
407
|
+
* Requirements: 8.4
|
|
408
|
+
*
|
|
409
|
+
* @param sampleId - Sample identifier
|
|
410
|
+
* @param functions - Array of functions from Ghidra
|
|
411
|
+
*/
|
|
412
|
+
private storeFunctions;
|
|
413
|
+
/**
|
|
414
|
+
* Create a job result from analysis result
|
|
415
|
+
* Helper method for job queue integration
|
|
416
|
+
*
|
|
417
|
+
* @param analysisResult - Analysis result
|
|
418
|
+
* @param elapsedMs - Elapsed time in milliseconds
|
|
419
|
+
* @returns Job result
|
|
420
|
+
*/
|
|
421
|
+
createJobResult(analysisResult: AnalysisResult, elapsedMs: number): JobResult;
|
|
422
|
+
/**
|
|
423
|
+
* Create a job result from error
|
|
424
|
+
* Helper method for job queue integration
|
|
425
|
+
*
|
|
426
|
+
* @param jobId - Job identifier
|
|
427
|
+
* @param error - Error that occurred
|
|
428
|
+
* @param elapsedMs - Elapsed time in milliseconds
|
|
429
|
+
* @returns Job result
|
|
430
|
+
*/
|
|
431
|
+
createErrorJobResult(jobId: string, error: Error, elapsedMs: number): JobResult;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Create a decompiler worker instance
|
|
435
|
+
*
|
|
436
|
+
* @param database - Database manager
|
|
437
|
+
* @param workspaceManager - Workspace manager
|
|
438
|
+
* @returns Decompiler worker instance
|
|
439
|
+
*/
|
|
440
|
+
export declare function createDecompilerWorker(database: DatabaseManager, workspaceManager: WorkspaceManager): DecompilerWorker;
|
|
441
|
+
//# sourceMappingURL=decompiler-worker.d.ts.map
|