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,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database module for Windows EXE Decompiler MCP Server
|
|
3
|
+
* Manages SQLite database schema and operations
|
|
4
|
+
*/
|
|
5
|
+
import Database from 'better-sqlite3';
|
|
6
|
+
/**
|
|
7
|
+
* Database interface types
|
|
8
|
+
*/
|
|
9
|
+
export interface Sample {
|
|
10
|
+
id: string;
|
|
11
|
+
sha256: string;
|
|
12
|
+
md5: string | null;
|
|
13
|
+
size: number;
|
|
14
|
+
file_type: string | null;
|
|
15
|
+
created_at: string;
|
|
16
|
+
source: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface Analysis {
|
|
19
|
+
id: string;
|
|
20
|
+
sample_id: string;
|
|
21
|
+
stage: string;
|
|
22
|
+
backend: string;
|
|
23
|
+
status: string;
|
|
24
|
+
started_at: string | null;
|
|
25
|
+
finished_at: string | null;
|
|
26
|
+
output_json: string | null;
|
|
27
|
+
metrics_json: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface Function {
|
|
30
|
+
sample_id: string;
|
|
31
|
+
address: string;
|
|
32
|
+
name: string | null;
|
|
33
|
+
size: number | null;
|
|
34
|
+
score: number | null;
|
|
35
|
+
tags: string | null;
|
|
36
|
+
summary: string | null;
|
|
37
|
+
caller_count: number | null;
|
|
38
|
+
callee_count: number | null;
|
|
39
|
+
is_entry_point: number | null;
|
|
40
|
+
is_exported: number | null;
|
|
41
|
+
callees: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface Artifact {
|
|
44
|
+
id: string;
|
|
45
|
+
sample_id: string;
|
|
46
|
+
type: string;
|
|
47
|
+
path: string;
|
|
48
|
+
sha256: string;
|
|
49
|
+
mime: string | null;
|
|
50
|
+
created_at: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CachedResult {
|
|
53
|
+
key: string;
|
|
54
|
+
data: unknown;
|
|
55
|
+
created_at: string;
|
|
56
|
+
expires_at: string | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Database manager class
|
|
60
|
+
*/
|
|
61
|
+
export declare class DatabaseManager {
|
|
62
|
+
private db;
|
|
63
|
+
constructor(dbPath: string);
|
|
64
|
+
/**
|
|
65
|
+
* Initialize database schema
|
|
66
|
+
*/
|
|
67
|
+
private initializeSchema;
|
|
68
|
+
/**
|
|
69
|
+
* Get the underlying database instance
|
|
70
|
+
*/
|
|
71
|
+
getDatabase(): Database.Database;
|
|
72
|
+
/**
|
|
73
|
+
* Close the database connection
|
|
74
|
+
*/
|
|
75
|
+
close(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a transaction
|
|
78
|
+
*/
|
|
79
|
+
transaction<T>(fn: () => T): T;
|
|
80
|
+
/**
|
|
81
|
+
* Insert a new sample
|
|
82
|
+
*/
|
|
83
|
+
insertSample(sample: Sample): void;
|
|
84
|
+
/**
|
|
85
|
+
* Find a sample by ID
|
|
86
|
+
*/
|
|
87
|
+
findSample(sampleId: string): Sample | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Find a sample by SHA256
|
|
90
|
+
*/
|
|
91
|
+
findSampleBySha256(sha256: string): Sample | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Insert a new analysis
|
|
94
|
+
*/
|
|
95
|
+
insertAnalysis(analysis: Analysis): void;
|
|
96
|
+
/**
|
|
97
|
+
* Update an analysis
|
|
98
|
+
*/
|
|
99
|
+
updateAnalysis(analysisId: string, updates: Partial<Omit<Analysis, 'id' | 'sample_id'>>): void;
|
|
100
|
+
/**
|
|
101
|
+
* Find an analysis by ID
|
|
102
|
+
*/
|
|
103
|
+
findAnalysis(analysisId: string): Analysis | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Find all analyses for a sample
|
|
106
|
+
*/
|
|
107
|
+
findAnalysesBySample(sampleId: string): Analysis[];
|
|
108
|
+
/**
|
|
109
|
+
* Find recent samples ordered by creation time.
|
|
110
|
+
*/
|
|
111
|
+
findRecentSamples(limit?: number): Sample[];
|
|
112
|
+
/**
|
|
113
|
+
* Mark stale running analyses as failed so persisted status does not remain misleading.
|
|
114
|
+
*/
|
|
115
|
+
reapStaleAnalyses(maxRuntimeMs: number, sampleId?: string): Analysis[];
|
|
116
|
+
/**
|
|
117
|
+
* Insert a new function
|
|
118
|
+
*/
|
|
119
|
+
insertFunction(func: Function): void;
|
|
120
|
+
/**
|
|
121
|
+
* Find all functions for a sample
|
|
122
|
+
*/
|
|
123
|
+
findFunctions(sampleId: string): Function[];
|
|
124
|
+
/**
|
|
125
|
+
* Find functions by sample with score ordering
|
|
126
|
+
*/
|
|
127
|
+
findFunctionsByScore(sampleId: string, limit?: number): Function[];
|
|
128
|
+
/**
|
|
129
|
+
* Update a function
|
|
130
|
+
*/
|
|
131
|
+
updateFunction(sampleId: string, address: string, updates: Partial<Omit<Function, 'sample_id' | 'address'>>): void;
|
|
132
|
+
/**
|
|
133
|
+
* Insert a new artifact
|
|
134
|
+
*/
|
|
135
|
+
insertArtifact(artifact: Artifact): void;
|
|
136
|
+
/**
|
|
137
|
+
* Find all artifacts for a sample
|
|
138
|
+
*/
|
|
139
|
+
findArtifacts(sampleId: string): Artifact[];
|
|
140
|
+
/**
|
|
141
|
+
* Find artifacts by sample and type
|
|
142
|
+
*/
|
|
143
|
+
findArtifactsByType(sampleId: string, type: string): Artifact[];
|
|
144
|
+
/**
|
|
145
|
+
* Get cached result from database
|
|
146
|
+
* Requirements: 20.5
|
|
147
|
+
*/
|
|
148
|
+
getCachedResult(key: string): Promise<{
|
|
149
|
+
data: unknown;
|
|
150
|
+
createdAt?: string;
|
|
151
|
+
expiresAt?: string;
|
|
152
|
+
sampleSha256?: string;
|
|
153
|
+
} | null>;
|
|
154
|
+
/**
|
|
155
|
+
* Set cached result in database
|
|
156
|
+
* Requirements: 20.5
|
|
157
|
+
*/
|
|
158
|
+
setCachedResult(key: string, data: unknown, expiresAt?: string, sampleSha256?: string): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Delete expired cache entries
|
|
161
|
+
*/
|
|
162
|
+
cleanExpiredCache(): number;
|
|
163
|
+
/**
|
|
164
|
+
* Get recent cache entries for prewarming
|
|
165
|
+
* Requirements: 26.1 (cache prewarming), 26.2 (query optimization)
|
|
166
|
+
*
|
|
167
|
+
* @param limit - Maximum number of entries to return
|
|
168
|
+
* @returns Array of cache entries ordered by creation time (most recent first)
|
|
169
|
+
*/
|
|
170
|
+
getRecentCacheEntries(limit: number): Promise<Array<{
|
|
171
|
+
key: string;
|
|
172
|
+
data: string;
|
|
173
|
+
expires_at: string | null;
|
|
174
|
+
}>>;
|
|
175
|
+
/**
|
|
176
|
+
* Get cache entries for a specific sample
|
|
177
|
+
* Requirements: 26.1 (cache prewarming), 26.2 (query optimization)
|
|
178
|
+
*
|
|
179
|
+
* @param sampleSha256 - SHA256 hash of the sample
|
|
180
|
+
* @returns Array of cache entries for the sample
|
|
181
|
+
*/
|
|
182
|
+
getCacheEntriesBySample(sampleSha256: string): Promise<Array<{
|
|
183
|
+
key: string;
|
|
184
|
+
data: string;
|
|
185
|
+
expires_at: string | null;
|
|
186
|
+
}>>;
|
|
187
|
+
/**
|
|
188
|
+
* Batch insert functions for better performance
|
|
189
|
+
* Requirements: 26.2 (database query optimization)
|
|
190
|
+
*
|
|
191
|
+
* @param functions - Array of functions to insert
|
|
192
|
+
*/
|
|
193
|
+
insertFunctionsBatch(functions: Function[]): void;
|
|
194
|
+
/**
|
|
195
|
+
* Batch insert artifacts for better performance
|
|
196
|
+
* Requirements: 26.2 (database query optimization)
|
|
197
|
+
*
|
|
198
|
+
* @param artifacts - Array of artifacts to insert
|
|
199
|
+
*/
|
|
200
|
+
insertArtifactsBatch(artifacts: Artifact[]): void;
|
|
201
|
+
/**
|
|
202
|
+
* Optimize database by running VACUUM and ANALYZE
|
|
203
|
+
* Requirements: 26.2 (database query optimization)
|
|
204
|
+
*
|
|
205
|
+
* Should be run periodically to maintain performance
|
|
206
|
+
*/
|
|
207
|
+
optimizeDatabase(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Get database statistics for monitoring
|
|
210
|
+
* Requirements: 26.2 (database query optimization)
|
|
211
|
+
*
|
|
212
|
+
* @returns Object with database statistics
|
|
213
|
+
*/
|
|
214
|
+
getDatabaseStats(): {
|
|
215
|
+
sampleCount: number;
|
|
216
|
+
analysisCount: number;
|
|
217
|
+
functionCount: number;
|
|
218
|
+
artifactCount: number;
|
|
219
|
+
cacheCount: number;
|
|
220
|
+
dbSizeBytes: number;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Create and initialize a database instance
|
|
225
|
+
*/
|
|
226
|
+
export declare function createDatabase(dbPath: string): DatabaseManager;
|
|
227
|
+
//# sourceMappingURL=database.d.ts.map
|