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,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pe.exports.extract tool implementation
|
|
3
|
+
* Extracts PE file export table (function names, ordinals, addresses)
|
|
4
|
+
* Requirements: 3.3
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { spawn } from 'child_process';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
+
import { generateCacheKey } from '../cache-manager.js';
|
|
11
|
+
import { resolvePackagePath } from '../runtime-paths.js';
|
|
12
|
+
import { lookupCachedResult, formatCacheWarning } from './cache-observability.js';
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Constants
|
|
15
|
+
// ============================================================================
|
|
16
|
+
const TOOL_NAME = 'pe.exports.extract';
|
|
17
|
+
const TOOL_VERSION = '1.0.0';
|
|
18
|
+
const CACHE_TTL_MS = 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Input/Output Schemas
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Input schema for pe.exports.extract tool
|
|
24
|
+
* Requirements: 3.3
|
|
25
|
+
*/
|
|
26
|
+
export const PEExportsExtractInputSchema = z.object({
|
|
27
|
+
sample_id: z.string().describe('Sample ID (format: sha256:<hex>)'),
|
|
28
|
+
force_refresh: z
|
|
29
|
+
.boolean()
|
|
30
|
+
.optional()
|
|
31
|
+
.default(false)
|
|
32
|
+
.describe('Bypass cache lookup and recompute from source sample'),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Output schema for pe.exports.extract tool
|
|
36
|
+
* Requirements: 3.3
|
|
37
|
+
*/
|
|
38
|
+
export const PEExportsExtractOutputSchema = z.object({
|
|
39
|
+
ok: z.boolean(),
|
|
40
|
+
data: z.object({
|
|
41
|
+
exports: z.array(z.object({
|
|
42
|
+
ordinal: z.number(),
|
|
43
|
+
address: z.number(),
|
|
44
|
+
name: z.string().nullable(),
|
|
45
|
+
})),
|
|
46
|
+
forwarders: z.array(z.object({
|
|
47
|
+
ordinal: z.number(),
|
|
48
|
+
address: z.number(),
|
|
49
|
+
name: z.string().nullable(),
|
|
50
|
+
forwarder: z.string(),
|
|
51
|
+
})),
|
|
52
|
+
total_exports: z.number(),
|
|
53
|
+
total_forwarders: z.number(),
|
|
54
|
+
_parser: z.string().optional(),
|
|
55
|
+
_pefile_error: z.string().optional(),
|
|
56
|
+
}).optional(),
|
|
57
|
+
warnings: z.array(z.string()).optional(),
|
|
58
|
+
errors: z.array(z.string()).optional(),
|
|
59
|
+
artifacts: z.array(z.any()).optional(),
|
|
60
|
+
metrics: z.object({
|
|
61
|
+
elapsed_ms: z.number(),
|
|
62
|
+
tool: z.string(),
|
|
63
|
+
}).optional(),
|
|
64
|
+
});
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Tool Definition
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/**
|
|
69
|
+
* Tool definition for pe.exports.extract
|
|
70
|
+
*/
|
|
71
|
+
export const peExportsExtractToolDefinition = {
|
|
72
|
+
name: TOOL_NAME,
|
|
73
|
+
description: '提取 PE 文件的导出表(函数名称、序号、地址、转发器)',
|
|
74
|
+
inputSchema: PEExportsExtractInputSchema,
|
|
75
|
+
outputSchema: PEExportsExtractOutputSchema,
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Spawn Python Static Worker and communicate via stdin/stdout JSON protocol
|
|
79
|
+
*
|
|
80
|
+
* Requirements: Worker communication
|
|
81
|
+
*
|
|
82
|
+
* @param request - Worker request object
|
|
83
|
+
* @returns Worker response object
|
|
84
|
+
*/
|
|
85
|
+
async function callStaticWorker(request) {
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
// Get Python worker path
|
|
88
|
+
const workerPath = resolvePackagePath('workers', 'static_worker.py');
|
|
89
|
+
// Spawn Python process
|
|
90
|
+
const pythonCommand = process.platform === 'win32' ? 'python' : 'python3';
|
|
91
|
+
const pythonProcess = spawn(pythonCommand, [workerPath], {
|
|
92
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
93
|
+
});
|
|
94
|
+
let stdout = '';
|
|
95
|
+
let stderr = '';
|
|
96
|
+
// Collect stdout
|
|
97
|
+
pythonProcess.stdout.on('data', (data) => {
|
|
98
|
+
stdout += data.toString();
|
|
99
|
+
});
|
|
100
|
+
// Collect stderr
|
|
101
|
+
pythonProcess.stderr.on('data', (data) => {
|
|
102
|
+
stderr += data.toString();
|
|
103
|
+
});
|
|
104
|
+
// Handle process exit
|
|
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
|
+
// Parse response from stdout
|
|
111
|
+
try {
|
|
112
|
+
const lines = stdout.trim().split('\n');
|
|
113
|
+
const lastLine = lines[lines.length - 1];
|
|
114
|
+
const response = JSON.parse(lastLine);
|
|
115
|
+
resolve(response);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
reject(new Error(`Failed to parse worker response: ${error.message}. stdout: ${stdout}`));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
// Handle process error
|
|
122
|
+
pythonProcess.on('error', (error) => {
|
|
123
|
+
reject(new Error(`Failed to spawn Python worker: ${error.message}`));
|
|
124
|
+
});
|
|
125
|
+
// Send request to worker via stdin
|
|
126
|
+
try {
|
|
127
|
+
pythonProcess.stdin.write(JSON.stringify(request) + '\n');
|
|
128
|
+
pythonProcess.stdin.end();
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
reject(new Error(`Failed to write to worker stdin: ${error.message}`));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// ============================================================================
|
|
136
|
+
// Tool Handler
|
|
137
|
+
// ============================================================================
|
|
138
|
+
/**
|
|
139
|
+
* Create pe.exports.extract tool handler
|
|
140
|
+
* Requirements: 3.3
|
|
141
|
+
*/
|
|
142
|
+
export function createPEExportsExtractHandler(workspaceManager, database, cacheManager) {
|
|
143
|
+
return async (args) => {
|
|
144
|
+
const input = args;
|
|
145
|
+
const startTime = Date.now();
|
|
146
|
+
try {
|
|
147
|
+
// 1. Generate cache key
|
|
148
|
+
const sample = database.findSample(input.sample_id);
|
|
149
|
+
if (!sample) {
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
errors: [`Sample not found: ${input.sample_id}`],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const cacheKey = generateCacheKey({
|
|
156
|
+
sampleSha256: sample.sha256,
|
|
157
|
+
toolName: TOOL_NAME,
|
|
158
|
+
toolVersion: TOOL_VERSION,
|
|
159
|
+
args: {},
|
|
160
|
+
});
|
|
161
|
+
// 2. Check cache
|
|
162
|
+
if (!input.force_refresh) {
|
|
163
|
+
const cachedLookup = await lookupCachedResult(cacheManager, cacheKey);
|
|
164
|
+
if (cachedLookup) {
|
|
165
|
+
return {
|
|
166
|
+
ok: true,
|
|
167
|
+
data: cachedLookup.data,
|
|
168
|
+
warnings: ['Result from cache', formatCacheWarning(cachedLookup.metadata)],
|
|
169
|
+
metrics: {
|
|
170
|
+
elapsed_ms: Date.now() - startTime,
|
|
171
|
+
tool: TOOL_NAME,
|
|
172
|
+
cached: true,
|
|
173
|
+
cache_key: cachedLookup.metadata.key,
|
|
174
|
+
cache_tier: cachedLookup.metadata.tier,
|
|
175
|
+
cache_created_at: cachedLookup.metadata.createdAt,
|
|
176
|
+
cache_expires_at: cachedLookup.metadata.expiresAt,
|
|
177
|
+
cache_hit_at: cachedLookup.metadata.fetchedAt,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// 3. Get sample path from workspace
|
|
183
|
+
const workspace = await workspaceManager.getWorkspace(input.sample_id);
|
|
184
|
+
// Find the sample file in the original directory
|
|
185
|
+
const fs = await import('fs/promises');
|
|
186
|
+
const files = await fs.readdir(workspace.original);
|
|
187
|
+
if (files.length === 0) {
|
|
188
|
+
return {
|
|
189
|
+
ok: false,
|
|
190
|
+
errors: ['Sample file not found in workspace'],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const samplePath = path.join(workspace.original, files[0]);
|
|
194
|
+
// 4. Prepare worker request
|
|
195
|
+
const workerRequest = {
|
|
196
|
+
job_id: uuidv4(),
|
|
197
|
+
tool: TOOL_NAME,
|
|
198
|
+
sample: {
|
|
199
|
+
sample_id: input.sample_id,
|
|
200
|
+
path: samplePath,
|
|
201
|
+
},
|
|
202
|
+
args: {},
|
|
203
|
+
context: {
|
|
204
|
+
request_time_utc: new Date().toISOString(),
|
|
205
|
+
policy: {
|
|
206
|
+
allow_dynamic: false,
|
|
207
|
+
allow_network: false,
|
|
208
|
+
},
|
|
209
|
+
versions: {
|
|
210
|
+
tool_version: TOOL_VERSION,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
// 5. Call Static Worker
|
|
215
|
+
// Requirements: 3.3
|
|
216
|
+
const workerResponse = await callStaticWorker(workerRequest);
|
|
217
|
+
if (!workerResponse.ok) {
|
|
218
|
+
return {
|
|
219
|
+
ok: false,
|
|
220
|
+
errors: workerResponse.errors,
|
|
221
|
+
warnings: workerResponse.warnings,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
// 6. Cache result
|
|
225
|
+
await cacheManager.setCachedResult(cacheKey, workerResponse.data, CACHE_TTL_MS);
|
|
226
|
+
// 7. Return result
|
|
227
|
+
return {
|
|
228
|
+
ok: true,
|
|
229
|
+
data: workerResponse.data,
|
|
230
|
+
warnings: input.force_refresh
|
|
231
|
+
? ['force_refresh=true; bypassed cache lookup', ...(workerResponse.warnings || [])]
|
|
232
|
+
: workerResponse.warnings,
|
|
233
|
+
errors: workerResponse.errors,
|
|
234
|
+
artifacts: workerResponse.artifacts,
|
|
235
|
+
metrics: {
|
|
236
|
+
...workerResponse.metrics,
|
|
237
|
+
elapsed_ms: Date.now() - startTime,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
return {
|
|
243
|
+
ok: false,
|
|
244
|
+
errors: [error.message],
|
|
245
|
+
metrics: {
|
|
246
|
+
elapsed_ms: Date.now() - startTime,
|
|
247
|
+
tool: TOOL_NAME,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=pe-exports-extract.js.map
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pe.fingerprint tool implementation
|
|
3
|
+
* Extracts PE file fingerprint information
|
|
4
|
+
* Requirements: 2.1, 2.2, 2.3, 2.5
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import type { ToolDefinition, ToolArgs, WorkerResult } from '../types.js';
|
|
8
|
+
import type { WorkspaceManager } from '../workspace-manager.js';
|
|
9
|
+
import type { DatabaseManager } from '../database.js';
|
|
10
|
+
import type { CacheManager } from '../cache-manager.js';
|
|
11
|
+
/**
|
|
12
|
+
* Input schema for pe.fingerprint tool
|
|
13
|
+
* Requirements: 2.1, 2.3
|
|
14
|
+
*/
|
|
15
|
+
export declare const PEFingerprintInputSchema: z.ZodObject<{
|
|
16
|
+
sample_id: z.ZodString;
|
|
17
|
+
fast: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
|
+
force_refresh: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
sample_id: string;
|
|
21
|
+
fast: boolean;
|
|
22
|
+
force_refresh: boolean;
|
|
23
|
+
}, {
|
|
24
|
+
sample_id: string;
|
|
25
|
+
fast?: boolean | undefined;
|
|
26
|
+
force_refresh?: boolean | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export type PEFingerprintInput = z.infer<typeof PEFingerprintInputSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* Output schema for pe.fingerprint tool
|
|
31
|
+
* Requirements: 2.1, 2.2, 2.3
|
|
32
|
+
*/
|
|
33
|
+
export declare const PEFingerprintOutputSchema: z.ZodObject<{
|
|
34
|
+
ok: z.ZodBoolean;
|
|
35
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
machine: z.ZodNumber;
|
|
37
|
+
machine_name: z.ZodString;
|
|
38
|
+
subsystem: z.ZodNumber;
|
|
39
|
+
subsystem_name: z.ZodString;
|
|
40
|
+
timestamp: z.ZodNumber;
|
|
41
|
+
timestamp_iso: z.ZodNullable<z.ZodString>;
|
|
42
|
+
imphash: z.ZodNullable<z.ZodString>;
|
|
43
|
+
entry_point: z.ZodNumber;
|
|
44
|
+
image_base: z.ZodNumber;
|
|
45
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
virtual_address: z.ZodNumber;
|
|
48
|
+
virtual_size: z.ZodNumber;
|
|
49
|
+
raw_size: z.ZodNumber;
|
|
50
|
+
entropy: z.ZodNumber;
|
|
51
|
+
characteristics: z.ZodNumber;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
name: string;
|
|
54
|
+
virtual_address: number;
|
|
55
|
+
virtual_size: number;
|
|
56
|
+
raw_size: number;
|
|
57
|
+
entropy: number;
|
|
58
|
+
characteristics: number;
|
|
59
|
+
}, {
|
|
60
|
+
name: string;
|
|
61
|
+
virtual_address: number;
|
|
62
|
+
virtual_size: number;
|
|
63
|
+
raw_size: number;
|
|
64
|
+
entropy: number;
|
|
65
|
+
characteristics: number;
|
|
66
|
+
}>, "many">>;
|
|
67
|
+
signature: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
present: z.ZodBoolean;
|
|
69
|
+
address: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
present: boolean;
|
|
74
|
+
address?: number | undefined;
|
|
75
|
+
size?: number | undefined;
|
|
76
|
+
verified?: boolean | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
present: boolean;
|
|
79
|
+
address?: number | undefined;
|
|
80
|
+
size?: number | undefined;
|
|
81
|
+
verified?: boolean | undefined;
|
|
82
|
+
}>>;
|
|
83
|
+
_parser: z.ZodOptional<z.ZodString>;
|
|
84
|
+
_pefile_error: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
entry_point: number;
|
|
87
|
+
machine: number;
|
|
88
|
+
machine_name: string;
|
|
89
|
+
subsystem: number;
|
|
90
|
+
subsystem_name: string;
|
|
91
|
+
timestamp: number;
|
|
92
|
+
timestamp_iso: string | null;
|
|
93
|
+
imphash: string | null;
|
|
94
|
+
image_base: number;
|
|
95
|
+
signature?: {
|
|
96
|
+
present: boolean;
|
|
97
|
+
address?: number | undefined;
|
|
98
|
+
size?: number | undefined;
|
|
99
|
+
verified?: boolean | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
sections?: {
|
|
102
|
+
name: string;
|
|
103
|
+
virtual_address: number;
|
|
104
|
+
virtual_size: number;
|
|
105
|
+
raw_size: number;
|
|
106
|
+
entropy: number;
|
|
107
|
+
characteristics: number;
|
|
108
|
+
}[] | undefined;
|
|
109
|
+
_parser?: string | undefined;
|
|
110
|
+
_pefile_error?: string | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
entry_point: number;
|
|
113
|
+
machine: number;
|
|
114
|
+
machine_name: string;
|
|
115
|
+
subsystem: number;
|
|
116
|
+
subsystem_name: string;
|
|
117
|
+
timestamp: number;
|
|
118
|
+
timestamp_iso: string | null;
|
|
119
|
+
imphash: string | null;
|
|
120
|
+
image_base: number;
|
|
121
|
+
signature?: {
|
|
122
|
+
present: boolean;
|
|
123
|
+
address?: number | undefined;
|
|
124
|
+
size?: number | undefined;
|
|
125
|
+
verified?: boolean | undefined;
|
|
126
|
+
} | undefined;
|
|
127
|
+
sections?: {
|
|
128
|
+
name: string;
|
|
129
|
+
virtual_address: number;
|
|
130
|
+
virtual_size: number;
|
|
131
|
+
raw_size: number;
|
|
132
|
+
entropy: number;
|
|
133
|
+
characteristics: number;
|
|
134
|
+
}[] | undefined;
|
|
135
|
+
_parser?: string | undefined;
|
|
136
|
+
_pefile_error?: string | undefined;
|
|
137
|
+
}>>;
|
|
138
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
140
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
141
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
142
|
+
elapsed_ms: z.ZodNumber;
|
|
143
|
+
tool: z.ZodString;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
elapsed_ms: number;
|
|
146
|
+
tool: string;
|
|
147
|
+
}, {
|
|
148
|
+
elapsed_ms: number;
|
|
149
|
+
tool: string;
|
|
150
|
+
}>>;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
ok: boolean;
|
|
153
|
+
metrics?: {
|
|
154
|
+
elapsed_ms: number;
|
|
155
|
+
tool: string;
|
|
156
|
+
} | undefined;
|
|
157
|
+
data?: {
|
|
158
|
+
entry_point: number;
|
|
159
|
+
machine: number;
|
|
160
|
+
machine_name: string;
|
|
161
|
+
subsystem: number;
|
|
162
|
+
subsystem_name: string;
|
|
163
|
+
timestamp: number;
|
|
164
|
+
timestamp_iso: string | null;
|
|
165
|
+
imphash: string | null;
|
|
166
|
+
image_base: number;
|
|
167
|
+
signature?: {
|
|
168
|
+
present: boolean;
|
|
169
|
+
address?: number | undefined;
|
|
170
|
+
size?: number | undefined;
|
|
171
|
+
verified?: boolean | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
sections?: {
|
|
174
|
+
name: string;
|
|
175
|
+
virtual_address: number;
|
|
176
|
+
virtual_size: number;
|
|
177
|
+
raw_size: number;
|
|
178
|
+
entropy: number;
|
|
179
|
+
characteristics: number;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
_parser?: string | undefined;
|
|
182
|
+
_pefile_error?: string | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
warnings?: string[] | undefined;
|
|
185
|
+
errors?: string[] | undefined;
|
|
186
|
+
artifacts?: any[] | undefined;
|
|
187
|
+
}, {
|
|
188
|
+
ok: boolean;
|
|
189
|
+
metrics?: {
|
|
190
|
+
elapsed_ms: number;
|
|
191
|
+
tool: string;
|
|
192
|
+
} | undefined;
|
|
193
|
+
data?: {
|
|
194
|
+
entry_point: number;
|
|
195
|
+
machine: number;
|
|
196
|
+
machine_name: string;
|
|
197
|
+
subsystem: number;
|
|
198
|
+
subsystem_name: string;
|
|
199
|
+
timestamp: number;
|
|
200
|
+
timestamp_iso: string | null;
|
|
201
|
+
imphash: string | null;
|
|
202
|
+
image_base: number;
|
|
203
|
+
signature?: {
|
|
204
|
+
present: boolean;
|
|
205
|
+
address?: number | undefined;
|
|
206
|
+
size?: number | undefined;
|
|
207
|
+
verified?: boolean | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
sections?: {
|
|
210
|
+
name: string;
|
|
211
|
+
virtual_address: number;
|
|
212
|
+
virtual_size: number;
|
|
213
|
+
raw_size: number;
|
|
214
|
+
entropy: number;
|
|
215
|
+
characteristics: number;
|
|
216
|
+
}[] | undefined;
|
|
217
|
+
_parser?: string | undefined;
|
|
218
|
+
_pefile_error?: string | undefined;
|
|
219
|
+
} | undefined;
|
|
220
|
+
warnings?: string[] | undefined;
|
|
221
|
+
errors?: string[] | undefined;
|
|
222
|
+
artifacts?: any[] | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
export type PEFingerprintOutput = z.infer<typeof PEFingerprintOutputSchema>;
|
|
225
|
+
/**
|
|
226
|
+
* Tool definition for pe.fingerprint
|
|
227
|
+
*/
|
|
228
|
+
export declare const peFingerprintToolDefinition: ToolDefinition;
|
|
229
|
+
/**
|
|
230
|
+
* Create pe.fingerprint tool handler
|
|
231
|
+
* Requirements: 2.1, 2.2, 2.3, 2.5
|
|
232
|
+
*/
|
|
233
|
+
export declare function createPEFingerprintHandler(workspaceManager: WorkspaceManager, database: DatabaseManager, cacheManager: CacheManager): (args: ToolArgs) => Promise<WorkerResult>;
|
|
234
|
+
//# sourceMappingURL=pe-fingerprint.d.ts.map
|