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,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dynamic.dependencies tool
|
|
3
|
+
* Dynamic-analysis capability bootstrap probe (safe: no sample execution).
|
|
4
|
+
*/
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { resolvePackagePath } from '../runtime-paths.js';
|
|
10
|
+
const TOOL_NAME = 'dynamic.dependencies';
|
|
11
|
+
const TOOL_VERSION = '0.1.0';
|
|
12
|
+
export const DynamicDependenciesInputSchema = z.object({
|
|
13
|
+
sample_id: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Optional sample ID; not required because this probe does not execute binaries'),
|
|
17
|
+
});
|
|
18
|
+
export const DynamicDependenciesOutputSchema = z.object({
|
|
19
|
+
ok: z.boolean(),
|
|
20
|
+
data: z
|
|
21
|
+
.object({
|
|
22
|
+
status: z.enum(['ready', 'partial', 'bootstrap_required']),
|
|
23
|
+
available_components: z.array(z.string()),
|
|
24
|
+
components: z.record(z.any()),
|
|
25
|
+
recommendations: z.array(z.string()),
|
|
26
|
+
checked_at: z.string(),
|
|
27
|
+
})
|
|
28
|
+
.optional(),
|
|
29
|
+
warnings: z.array(z.string()).optional(),
|
|
30
|
+
errors: z.array(z.string()).optional(),
|
|
31
|
+
artifacts: z.array(z.any()).optional(),
|
|
32
|
+
metrics: z
|
|
33
|
+
.object({
|
|
34
|
+
elapsed_ms: z.number(),
|
|
35
|
+
tool: z.string(),
|
|
36
|
+
})
|
|
37
|
+
.optional(),
|
|
38
|
+
});
|
|
39
|
+
export const dynamicDependenciesToolDefinition = {
|
|
40
|
+
name: TOOL_NAME,
|
|
41
|
+
description: 'Probe optional dynamic-analysis components (speakeasy/frida/psutil) and return actionable setup recommendations.',
|
|
42
|
+
inputSchema: DynamicDependenciesInputSchema,
|
|
43
|
+
outputSchema: DynamicDependenciesOutputSchema,
|
|
44
|
+
};
|
|
45
|
+
function buildBootstrapFallback(startTime, errorMessage) {
|
|
46
|
+
return {
|
|
47
|
+
ok: true,
|
|
48
|
+
data: {
|
|
49
|
+
status: 'bootstrap_required',
|
|
50
|
+
available_components: [],
|
|
51
|
+
components: {
|
|
52
|
+
speakeasy: {
|
|
53
|
+
available: false,
|
|
54
|
+
version: null,
|
|
55
|
+
distribution: null,
|
|
56
|
+
api_available: false,
|
|
57
|
+
warnings: [],
|
|
58
|
+
error: errorMessage,
|
|
59
|
+
},
|
|
60
|
+
frida: {
|
|
61
|
+
available: false,
|
|
62
|
+
version: null,
|
|
63
|
+
error: errorMessage,
|
|
64
|
+
},
|
|
65
|
+
psutil: {
|
|
66
|
+
available: false,
|
|
67
|
+
version: null,
|
|
68
|
+
error: errorMessage,
|
|
69
|
+
},
|
|
70
|
+
worker: {
|
|
71
|
+
available: false,
|
|
72
|
+
error: errorMessage,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
recommendations: [
|
|
76
|
+
'Install baseline Python dependencies first: pip install -r requirements.txt',
|
|
77
|
+
'Install FLARE Speakeasy emulator for PE user-mode emulation: pip install speakeasy-emulator',
|
|
78
|
+
'Install frida for runtime API tracing: pip install frida',
|
|
79
|
+
'Install psutil for process telemetry collection: pip install psutil',
|
|
80
|
+
],
|
|
81
|
+
checked_at: new Date().toISOString(),
|
|
82
|
+
},
|
|
83
|
+
warnings: [`dynamic.dependencies probe degraded: ${errorMessage}`],
|
|
84
|
+
metrics: {
|
|
85
|
+
elapsed_ms: Date.now() - startTime,
|
|
86
|
+
tool: TOOL_NAME,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function callStaticWorker(request) {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
const workerPath = resolvePackagePath('workers', 'static_worker.py');
|
|
93
|
+
const pythonCommand = process.platform === 'win32' ? 'python' : 'python3';
|
|
94
|
+
const pythonProcess = spawn(pythonCommand, [workerPath], {
|
|
95
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
96
|
+
});
|
|
97
|
+
let stdout = '';
|
|
98
|
+
let stderr = '';
|
|
99
|
+
pythonProcess.stdout.on('data', (data) => {
|
|
100
|
+
stdout += data.toString();
|
|
101
|
+
});
|
|
102
|
+
pythonProcess.stderr.on('data', (data) => {
|
|
103
|
+
stderr += data.toString();
|
|
104
|
+
});
|
|
105
|
+
pythonProcess.on('close', (code) => {
|
|
106
|
+
if (code !== 0) {
|
|
107
|
+
reject(new Error(`Python worker exited with code ${code}. stderr: ${stderr}`));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const lines = stdout.trim().split('\n');
|
|
112
|
+
const lastLine = lines[lines.length - 1];
|
|
113
|
+
const response = JSON.parse(lastLine);
|
|
114
|
+
resolve(response);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
reject(new Error(`Failed to parse worker response: ${error.message}. stdout: ${stdout}`));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
pythonProcess.on('error', (error) => {
|
|
121
|
+
reject(new Error(`Failed to spawn Python worker: ${error.message}`));
|
|
122
|
+
});
|
|
123
|
+
try {
|
|
124
|
+
pythonProcess.stdin.write(JSON.stringify(request) + '\n');
|
|
125
|
+
pythonProcess.stdin.end();
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
reject(new Error(`Failed to write to worker stdin: ${error.message}`));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function createDynamicDependenciesHandler(workspaceManager, database, dependencies) {
|
|
133
|
+
return async (args) => {
|
|
134
|
+
const startTime = Date.now();
|
|
135
|
+
const runWorker = dependencies?.callWorker || callStaticWorker;
|
|
136
|
+
try {
|
|
137
|
+
const input = DynamicDependenciesInputSchema.parse(args);
|
|
138
|
+
let sampleId = input.sample_id || 'dynamic-probe';
|
|
139
|
+
let samplePath = '';
|
|
140
|
+
if (input.sample_id) {
|
|
141
|
+
const sample = database.findSample(input.sample_id);
|
|
142
|
+
if (!sample) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
errors: [`Sample not found: ${input.sample_id}`],
|
|
146
|
+
metrics: {
|
|
147
|
+
elapsed_ms: Date.now() - startTime,
|
|
148
|
+
tool: TOOL_NAME,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const workspace = await workspaceManager.getWorkspace(input.sample_id);
|
|
153
|
+
const fs = await import('fs/promises');
|
|
154
|
+
const files = await fs.readdir(workspace.original);
|
|
155
|
+
if (files.length > 0) {
|
|
156
|
+
samplePath = path.join(workspace.original, files[0]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const workerRequest = {
|
|
160
|
+
job_id: uuidv4(),
|
|
161
|
+
tool: TOOL_NAME,
|
|
162
|
+
sample: {
|
|
163
|
+
sample_id: sampleId,
|
|
164
|
+
path: samplePath,
|
|
165
|
+
},
|
|
166
|
+
args: {},
|
|
167
|
+
context: {
|
|
168
|
+
request_time_utc: new Date().toISOString(),
|
|
169
|
+
policy: {
|
|
170
|
+
allow_dynamic: false,
|
|
171
|
+
allow_network: false,
|
|
172
|
+
},
|
|
173
|
+
versions: {
|
|
174
|
+
tool_version: TOOL_VERSION,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
let workerResponse;
|
|
179
|
+
try {
|
|
180
|
+
workerResponse = await runWorker(workerRequest);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
return buildBootstrapFallback(startTime, error.message);
|
|
184
|
+
}
|
|
185
|
+
if (!workerResponse.ok) {
|
|
186
|
+
return buildBootstrapFallback(startTime, workerResponse.errors.join('; ') || 'dynamic dependency probe failed');
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
ok: true,
|
|
190
|
+
data: workerResponse.data,
|
|
191
|
+
warnings: workerResponse.warnings,
|
|
192
|
+
errors: workerResponse.errors,
|
|
193
|
+
artifacts: workerResponse.artifacts,
|
|
194
|
+
metrics: {
|
|
195
|
+
...workerResponse.metrics,
|
|
196
|
+
elapsed_ms: Date.now() - startTime,
|
|
197
|
+
tool: TOOL_NAME,
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
return {
|
|
203
|
+
ok: false,
|
|
204
|
+
errors: [error.message],
|
|
205
|
+
metrics: {
|
|
206
|
+
elapsed_ms: Date.now() - startTime,
|
|
207
|
+
tool: TOOL_NAME,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=dynamic-dependencies.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dynamic.memory.import tool
|
|
3
|
+
* Import minidump or raw process-memory snapshots and normalize them into runtime evidence.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolDefinition, ToolArgs, WorkerResult } from '../types.js';
|
|
6
|
+
import type { WorkspaceManager } from '../workspace-manager.js';
|
|
7
|
+
import type { DatabaseManager } from '../database.js';
|
|
8
|
+
export declare const dynamicMemoryImportToolDefinition: ToolDefinition;
|
|
9
|
+
export declare function createDynamicMemoryImportHandler(workspaceManager: WorkspaceManager, database: DatabaseManager): (args: ToolArgs) => Promise<WorkerResult>;
|
|
10
|
+
//# sourceMappingURL=dynamic-memory-import.d.ts.map
|