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,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Pool - Manages worker processes for job execution
|
|
3
|
+
*
|
|
4
|
+
* Implements requirements 21.3, 27.2, and operational constraint 4:
|
|
5
|
+
* - Worker process management
|
|
6
|
+
* - Task allocation and status updates
|
|
7
|
+
* - Concurrency control (max 4 concurrent Ghidra analyses)
|
|
8
|
+
*/
|
|
9
|
+
import { EventEmitter } from 'events';
|
|
10
|
+
import type { Job, JobResult } from './types.js';
|
|
11
|
+
import { JobQueue } from './job-queue.js';
|
|
12
|
+
/**
|
|
13
|
+
* Worker pool configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface WorkerPoolConfig {
|
|
16
|
+
maxStaticWorkers?: number;
|
|
17
|
+
maxDecompileWorkers?: number;
|
|
18
|
+
maxDotNetWorkers?: number;
|
|
19
|
+
maxSandboxWorkers?: number;
|
|
20
|
+
heartbeatIntervalMs?: number;
|
|
21
|
+
workerTimeoutMs?: number;
|
|
22
|
+
testExecutor?: (job: Job) => Promise<JobResult>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Worker pool that manages worker processes and allocates jobs
|
|
26
|
+
*
|
|
27
|
+
* Features:
|
|
28
|
+
* - Per-worker-type concurrency limits
|
|
29
|
+
* - Automatic worker allocation
|
|
30
|
+
* - Job status tracking
|
|
31
|
+
* - Worker health monitoring
|
|
32
|
+
*/
|
|
33
|
+
export declare class WorkerPool extends EventEmitter {
|
|
34
|
+
private workers;
|
|
35
|
+
private config;
|
|
36
|
+
private jobQueue;
|
|
37
|
+
private heartbeatTimer?;
|
|
38
|
+
private allocationTimer?;
|
|
39
|
+
private isRunning;
|
|
40
|
+
constructor(jobQueue: JobQueue, config?: WorkerPoolConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Start the worker pool
|
|
43
|
+
*
|
|
44
|
+
* Begins monitoring the job queue and allocating jobs to workers
|
|
45
|
+
*/
|
|
46
|
+
start(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Stop the worker pool
|
|
49
|
+
*
|
|
50
|
+
* Stops allocating new jobs and waits for running jobs to complete
|
|
51
|
+
*/
|
|
52
|
+
stop(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Allocate jobs from the queue to available workers
|
|
55
|
+
*
|
|
56
|
+
* Requirements: 21.3 - Task allocation
|
|
57
|
+
*/
|
|
58
|
+
private allocateJobs;
|
|
59
|
+
/**
|
|
60
|
+
* Check if we have capacity to run more jobs
|
|
61
|
+
*/
|
|
62
|
+
private hasCapacity;
|
|
63
|
+
/**
|
|
64
|
+
* Allocate a worker for a job
|
|
65
|
+
*
|
|
66
|
+
* @param job - Job to allocate worker for
|
|
67
|
+
* @returns Worker state or undefined if no capacity
|
|
68
|
+
*/
|
|
69
|
+
private allocateWorker;
|
|
70
|
+
/**
|
|
71
|
+
* Create a new worker
|
|
72
|
+
*
|
|
73
|
+
* @param type - Worker type
|
|
74
|
+
* @returns New worker state
|
|
75
|
+
*/
|
|
76
|
+
private createWorker;
|
|
77
|
+
/**
|
|
78
|
+
* Execute a job on a worker
|
|
79
|
+
*
|
|
80
|
+
* Requirements: 21.3 - Task allocation and status updates
|
|
81
|
+
* Requirements: 21.5, 28.2 - Failure retry mechanism with exponential backoff
|
|
82
|
+
* Requirements: 21.6, 操作约束 5 - Timeout control and worker termination
|
|
83
|
+
*
|
|
84
|
+
* @param worker - Worker to execute job on
|
|
85
|
+
* @param job - Job to execute
|
|
86
|
+
*/
|
|
87
|
+
private executeJob;
|
|
88
|
+
/**
|
|
89
|
+
* Handle job timeout
|
|
90
|
+
*
|
|
91
|
+
* Requirements: 21.6 - Terminate worker process and mark task as failed when timeout occurs
|
|
92
|
+
* Requirements: 操作约束 5 - Enforce configurable timeout limits
|
|
93
|
+
*
|
|
94
|
+
* @param worker - Worker that timed out
|
|
95
|
+
* @param job - Job that timed out
|
|
96
|
+
*/
|
|
97
|
+
private handleJobTimeout;
|
|
98
|
+
/**
|
|
99
|
+
* Terminate a worker process
|
|
100
|
+
*
|
|
101
|
+
* Requirements: 21.6 - Worker process termination on timeout
|
|
102
|
+
*
|
|
103
|
+
* This method terminates the worker process to free up resources.
|
|
104
|
+
* In a real implementation, this would kill the actual subprocess.
|
|
105
|
+
*
|
|
106
|
+
* @param worker - Worker to terminate
|
|
107
|
+
*/
|
|
108
|
+
private terminateWorker;
|
|
109
|
+
/**
|
|
110
|
+
* Determine if a job should be retried
|
|
111
|
+
*
|
|
112
|
+
* Requirements: 21.5, 28.2 - Retry policy with max 3 attempts
|
|
113
|
+
*
|
|
114
|
+
* @param job - Job that failed
|
|
115
|
+
* @param errorMessage - Error message from failure
|
|
116
|
+
* @returns True if job should be retried
|
|
117
|
+
*/
|
|
118
|
+
private shouldRetryJob;
|
|
119
|
+
/**
|
|
120
|
+
* Retry a failed job with exponential backoff
|
|
121
|
+
*
|
|
122
|
+
* Requirements: 21.5, 28.2 - Exponential backoff retry
|
|
123
|
+
*
|
|
124
|
+
* @param job - Job to retry
|
|
125
|
+
*/
|
|
126
|
+
private retryJob;
|
|
127
|
+
/**
|
|
128
|
+
* Execute a job based on its type
|
|
129
|
+
*
|
|
130
|
+
* This is a placeholder that will be implemented by specific worker implementations
|
|
131
|
+
*
|
|
132
|
+
* @param job - Job to execute
|
|
133
|
+
* @returns Job result
|
|
134
|
+
*/
|
|
135
|
+
private executeJobByType;
|
|
136
|
+
/**
|
|
137
|
+
* Check worker health and handle timeouts
|
|
138
|
+
*
|
|
139
|
+
* Requirements: 27.2 - Worker process management
|
|
140
|
+
*/
|
|
141
|
+
private checkWorkerHealth;
|
|
142
|
+
/**
|
|
143
|
+
* Wait for all workers to finish their current jobs
|
|
144
|
+
*/
|
|
145
|
+
private waitForWorkers;
|
|
146
|
+
/**
|
|
147
|
+
* Get worker counts by type and status
|
|
148
|
+
*/
|
|
149
|
+
private getWorkerCounts;
|
|
150
|
+
/**
|
|
151
|
+
* Get count of workers by type and status
|
|
152
|
+
*/
|
|
153
|
+
private getWorkerCountByType;
|
|
154
|
+
/**
|
|
155
|
+
* Get maximum workers for a job type
|
|
156
|
+
*/
|
|
157
|
+
private getMaxWorkers;
|
|
158
|
+
/**
|
|
159
|
+
* Get pool statistics
|
|
160
|
+
*/
|
|
161
|
+
getStats(): {
|
|
162
|
+
isRunning: boolean;
|
|
163
|
+
queueLength: number;
|
|
164
|
+
workers: {
|
|
165
|
+
static: {
|
|
166
|
+
total: number;
|
|
167
|
+
idle: number;
|
|
168
|
+
busy: number;
|
|
169
|
+
failed: number;
|
|
170
|
+
max: number;
|
|
171
|
+
};
|
|
172
|
+
decompile: {
|
|
173
|
+
total: number;
|
|
174
|
+
idle: number;
|
|
175
|
+
busy: number;
|
|
176
|
+
failed: number;
|
|
177
|
+
max: number;
|
|
178
|
+
};
|
|
179
|
+
dotnet: {
|
|
180
|
+
total: number;
|
|
181
|
+
idle: number;
|
|
182
|
+
busy: number;
|
|
183
|
+
failed: number;
|
|
184
|
+
max: number;
|
|
185
|
+
};
|
|
186
|
+
sandbox: {
|
|
187
|
+
total: number;
|
|
188
|
+
idle: number;
|
|
189
|
+
busy: number;
|
|
190
|
+
failed: number;
|
|
191
|
+
max: number;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Update worker heartbeat
|
|
197
|
+
*
|
|
198
|
+
* Should be called by worker implementations to indicate they're still alive
|
|
199
|
+
*
|
|
200
|
+
* @param workerId - Worker identifier
|
|
201
|
+
*/
|
|
202
|
+
updateHeartbeat(workerId: string): void;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=worker-pool.d.ts.map
|