windows-exe-decompiler-mcp-server 0.1.0 → 0.1.3

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.
Files changed (134) hide show
  1. package/CLAUDE_INSTALLATION.md +129 -0
  2. package/CODEX_INSTALLATION.md +25 -1
  3. package/COPILOT_INSTALLATION.md +29 -1
  4. package/LICENSE +21 -21
  5. package/README.md +232 -110
  6. package/dist/analysis-provenance.d.ts +50 -2
  7. package/dist/analysis-provenance.js +1 -0
  8. package/dist/analysis-task-runner.js +92 -0
  9. package/dist/config.d.ts +35 -16
  10. package/dist/config.js +37 -3
  11. package/dist/database.js +115 -115
  12. package/dist/decompiler-worker.d.ts +10 -5
  13. package/dist/decompiler-worker.js +240 -58
  14. package/dist/dynamic-trace.d.ts +6 -0
  15. package/dist/dynamic-trace.js +52 -1
  16. package/dist/ghidra-config.js +17 -1
  17. package/dist/index.js +38 -8
  18. package/dist/pe-runtime-functions.d.ts +90 -0
  19. package/dist/pe-runtime-functions.js +452 -0
  20. package/dist/prompts/module-reconstruction-review.d.ts +5 -0
  21. package/dist/prompts/module-reconstruction-review.js +65 -0
  22. package/dist/runtime-correlation.d.ts +5 -0
  23. package/dist/runtime-correlation.js +179 -2
  24. package/dist/sample-workspace.d.ts +28 -0
  25. package/dist/sample-workspace.js +186 -0
  26. package/dist/semantic-name-suggestion-artifacts.d.ts +56 -0
  27. package/dist/semantic-name-suggestion-artifacts.js +87 -0
  28. package/dist/server.js +1 -1
  29. package/dist/setup-guidance.d.ts +73 -0
  30. package/dist/setup-guidance.js +211 -0
  31. package/dist/tools/artifact-read.d.ts +10 -10
  32. package/dist/tools/artifacts-diff.d.ts +8 -8
  33. package/dist/tools/artifacts-list.d.ts +16 -16
  34. package/dist/tools/attack-map.d.ts +8 -8
  35. package/dist/tools/binary-role-profile.d.ts +1197 -0
  36. package/dist/tools/binary-role-profile.js +575 -0
  37. package/dist/tools/code-function-explain-apply.d.ts +12 -12
  38. package/dist/tools/code-function-explain-prepare.d.ts +12 -12
  39. package/dist/tools/code-function-explain-review.d.ts +58 -58
  40. package/dist/tools/code-function-rename-apply.d.ts +12 -12
  41. package/dist/tools/code-function-rename-prepare.d.ts +14 -14
  42. package/dist/tools/code-function-rename-review.d.ts +66 -66
  43. package/dist/tools/code-functions-define.d.ts +337 -0
  44. package/dist/tools/code-functions-define.js +337 -0
  45. package/dist/tools/code-functions-list.js +1 -1
  46. package/dist/tools/code-functions-rank.js +1 -1
  47. package/dist/tools/code-functions-reconstruct.d.ts +368 -58
  48. package/dist/tools/code-functions-reconstruct.js +130 -10
  49. package/dist/tools/code-functions-smart-recover.d.ts +352 -0
  50. package/dist/tools/code-functions-smart-recover.js +190 -0
  51. package/dist/tools/code-module-review-apply.d.ts +233 -0
  52. package/dist/tools/code-module-review-apply.js +209 -0
  53. package/dist/tools/code-module-review-prepare.d.ts +756 -0
  54. package/dist/tools/code-module-review-prepare.js +343 -0
  55. package/dist/tools/code-module-review.d.ts +474 -0
  56. package/dist/tools/code-module-review.js +566 -0
  57. package/dist/tools/code-reconstruct-export.d.ts +193 -21
  58. package/dist/tools/code-reconstruct-export.js +578 -21
  59. package/dist/tools/code-reconstruct-plan.d.ts +20 -20
  60. package/dist/tools/com-role-profile.d.ts +353 -0
  61. package/dist/tools/com-role-profile.js +186 -0
  62. package/dist/tools/dll-export-profile.d.ts +625 -0
  63. package/dist/tools/dll-export-profile.js +230 -0
  64. package/dist/tools/dotnet-metadata-extract.d.ts +122 -122
  65. package/dist/tools/dotnet-reconstruct-export.d.ts +49 -49
  66. package/dist/tools/dotnet-types-list.d.ts +66 -66
  67. package/dist/tools/dynamic-dependencies.d.ts +144 -8
  68. package/dist/tools/dynamic-dependencies.js +20 -1
  69. package/dist/tools/dynamic-memory-import.js +105 -2
  70. package/dist/tools/ghidra-analyze.d.ts +20 -0
  71. package/dist/tools/ghidra-analyze.js +10 -2
  72. package/dist/tools/ghidra-health.d.ts +177 -0
  73. package/dist/tools/ghidra-health.js +28 -0
  74. package/dist/tools/ioc-export.d.ts +8 -8
  75. package/dist/tools/packer-detect.d.ts +14 -14
  76. package/dist/tools/packer-detect.js +6 -9
  77. package/dist/tools/pe-exports-extract.d.ts +8 -8
  78. package/dist/tools/pe-exports-extract.js +6 -9
  79. package/dist/tools/pe-fingerprint.d.ts +36 -36
  80. package/dist/tools/pe-imports-extract.d.ts +8 -8
  81. package/dist/tools/pe-imports-extract.js +6 -9
  82. package/dist/tools/pe-pdata-extract.d.ts +448 -0
  83. package/dist/tools/pe-pdata-extract.js +219 -0
  84. package/dist/tools/pe-symbols-recover.d.ts +227 -0
  85. package/dist/tools/pe-symbols-recover.js +316 -0
  86. package/dist/tools/report-generate.d.ts +15 -1
  87. package/dist/tools/report-generate.js +139 -16
  88. package/dist/tools/report-summarize.d.ts +2242 -8
  89. package/dist/tools/report-summarize.js +246 -10
  90. package/dist/tools/runtime-detect.d.ts +8 -8
  91. package/dist/tools/runtime-detect.js +2 -12
  92. package/dist/tools/rust-binary-analyze.d.ts +2047 -0
  93. package/dist/tools/rust-binary-analyze.js +443 -0
  94. package/dist/tools/sample-profile-get.d.ts +135 -16
  95. package/dist/tools/sample-profile-get.js +35 -32
  96. package/dist/tools/sandbox-execute.d.ts +10 -10
  97. package/dist/tools/strings-extract.d.ts +8 -8
  98. package/dist/tools/strings-extract.js +2 -12
  99. package/dist/tools/strings-floss-decode.d.ts +8 -8
  100. package/dist/tools/system-health.d.ts +172 -36
  101. package/dist/tools/system-health.js +14 -0
  102. package/dist/tools/system-setup-guide.d.ts +179 -0
  103. package/dist/tools/system-setup-guide.js +62 -0
  104. package/dist/tools/tool-help.d.ts +16 -16
  105. package/dist/tools/tool-help.js +172 -0
  106. package/dist/tools/yara-scan.d.ts +8 -8
  107. package/dist/types.d.ts +2 -0
  108. package/dist/workflows/function-explanation-review.d.ts +3034 -76
  109. package/dist/workflows/function-explanation-review.js +172 -42
  110. package/dist/workflows/function-index-recover.d.ts +333 -0
  111. package/dist/workflows/function-index-recover.js +291 -0
  112. package/dist/workflows/module-reconstruction-review.d.ts +3537 -0
  113. package/dist/workflows/module-reconstruction-review.js +354 -0
  114. package/dist/workflows/reconstruct.d.ts +2182 -223
  115. package/dist/workflows/reconstruct.js +575 -32
  116. package/dist/workflows/semantic-name-review.d.ts +1436 -85
  117. package/dist/workflows/semantic-name-review.js +150 -58
  118. package/dist/workflows/triage.d.ts +8 -8
  119. package/ghidra_scripts/DecompileFunction.java +487 -487
  120. package/ghidra_scripts/ExtractCFG.java +256 -256
  121. package/ghidra_scripts/ExtractFunctions.java +442 -442
  122. package/ghidra_scripts/README.md +112 -112
  123. package/ghidra_scripts/SearchFunctionReferences.java +380 -380
  124. package/helpers/DotNetMetadataProbe/DotNetMetadataProbe.csproj +9 -9
  125. package/helpers/DotNetMetadataProbe/Program.cs +566 -566
  126. package/install-to-claude.ps1 +432 -0
  127. package/install-to-codex.ps1 +256 -178
  128. package/install-to-copilot.ps1 +389 -303
  129. package/package.json +4 -2
  130. package/requirements.txt +9 -9
  131. package/workers/requirements-dynamic.txt +11 -11
  132. package/workers/requirements.txt +8 -8
  133. package/workers/speakeasy_compat.py +175 -175
  134. package/workers/static_worker.py +3474 -3474
@@ -84,15 +84,15 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
84
84
  confidence: z.ZodNumber;
85
85
  }, "strip", z.ZodTypeAny, {
86
86
  confidence: number;
87
- title: string;
88
87
  phase: string;
88
+ title: string;
89
89
  objective: string;
90
90
  actions: string[];
91
91
  estimated_effort: "high" | "low" | "medium";
92
92
  }, {
93
93
  confidence: number;
94
- title: string;
95
94
  phase: string;
95
+ title: string;
96
96
  objective: string;
97
97
  actions: string[];
98
98
  estimated_effort: "high" | "low" | "medium";
@@ -117,8 +117,8 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
117
117
  recommendations: string[];
118
118
  phases: {
119
119
  confidence: number;
120
- title: string;
121
120
  phase: string;
121
+ title: string;
122
122
  objective: string;
123
123
  actions: string[];
124
124
  estimated_effort: "high" | "low" | "medium";
@@ -143,8 +143,8 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
143
143
  recommendations: string[];
144
144
  phases: {
145
145
  confidence: number;
146
- title: string;
147
146
  phase: string;
147
+ title: string;
148
148
  objective: string;
149
149
  actions: string[];
150
150
  estimated_effort: "high" | "low" | "medium";
@@ -182,16 +182,6 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
182
182
  }>>;
183
183
  }, "strip", z.ZodTypeAny, {
184
184
  ok: boolean;
185
- metrics?: {
186
- elapsed_ms: number;
187
- tool: string;
188
- cached?: boolean | undefined;
189
- cache_key?: string | undefined;
190
- cache_tier?: string | undefined;
191
- cache_created_at?: string | undefined;
192
- cache_expires_at?: string | undefined;
193
- cache_hit_at?: string | undefined;
194
- } | undefined;
195
185
  data?: {
196
186
  confidence: number;
197
187
  feasibility: "high" | "low" | "medium";
@@ -212,17 +202,13 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
212
202
  recommendations: string[];
213
203
  phases: {
214
204
  confidence: number;
215
- title: string;
216
205
  phase: string;
206
+ title: string;
217
207
  objective: string;
218
208
  actions: string[];
219
209
  estimated_effort: "high" | "low" | "medium";
220
210
  }[];
221
211
  } | undefined;
222
- warnings?: string[] | undefined;
223
- errors?: string[] | undefined;
224
- }, {
225
- ok: boolean;
226
212
  metrics?: {
227
213
  elapsed_ms: number;
228
214
  tool: string;
@@ -233,6 +219,10 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
233
219
  cache_expires_at?: string | undefined;
234
220
  cache_hit_at?: string | undefined;
235
221
  } | undefined;
222
+ warnings?: string[] | undefined;
223
+ errors?: string[] | undefined;
224
+ }, {
225
+ ok: boolean;
236
226
  data?: {
237
227
  confidence: number;
238
228
  feasibility: "high" | "low" | "medium";
@@ -253,13 +243,23 @@ export declare const CodeReconstructPlanOutputSchema: z.ZodObject<{
253
243
  recommendations: string[];
254
244
  phases: {
255
245
  confidence: number;
256
- title: string;
257
246
  phase: string;
247
+ title: string;
258
248
  objective: string;
259
249
  actions: string[];
260
250
  estimated_effort: "high" | "low" | "medium";
261
251
  }[];
262
252
  } | undefined;
253
+ metrics?: {
254
+ elapsed_ms: number;
255
+ tool: string;
256
+ cached?: boolean | undefined;
257
+ cache_key?: string | undefined;
258
+ cache_tier?: string | undefined;
259
+ cache_created_at?: string | undefined;
260
+ cache_expires_at?: string | undefined;
261
+ cache_hit_at?: string | undefined;
262
+ } | undefined;
263
263
  warnings?: string[] | undefined;
264
264
  errors?: string[] | undefined;
265
265
  }>;
@@ -0,0 +1,353 @@
1
+ import { z } from 'zod';
2
+ import type { ToolArgs, ToolDefinition, WorkerResult } from '../types.js';
3
+ import type { WorkspaceManager } from '../workspace-manager.js';
4
+ import type { DatabaseManager } from '../database.js';
5
+ import type { CacheManager } from '../cache-manager.js';
6
+ export declare const ComRoleProfileInputSchema: z.ZodObject<{
7
+ sample_id: z.ZodString;
8
+ max_exports: z.ZodDefault<z.ZodNumber>;
9
+ max_strings: z.ZodDefault<z.ZodNumber>;
10
+ force_refresh: z.ZodDefault<z.ZodBoolean>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ sample_id: string;
13
+ force_refresh: boolean;
14
+ max_strings: number;
15
+ max_exports: number;
16
+ }, {
17
+ sample_id: string;
18
+ force_refresh?: boolean | undefined;
19
+ max_strings?: number | undefined;
20
+ max_exports?: number | undefined;
21
+ }>;
22
+ export declare const ComRoleProfileDataSchema: z.ZodObject<{
23
+ sample_id: z.ZodString;
24
+ original_filename: z.ZodNullable<z.ZodString>;
25
+ binary_role: z.ZodString;
26
+ likely_com_server: z.ZodBoolean;
27
+ com_confidence: z.ZodNumber;
28
+ class_factory_exports: z.ZodArray<z.ZodString, "many">;
29
+ registration_exports: z.ZodArray<z.ZodString, "many">;
30
+ clsid_strings: z.ZodArray<z.ZodString, "many">;
31
+ progid_strings: z.ZodArray<z.ZodString, "many">;
32
+ interface_hints: z.ZodArray<z.ZodString, "many">;
33
+ registration_strings: z.ZodArray<z.ZodString, "many">;
34
+ class_factory_surface: z.ZodObject<{
35
+ class_factory_exports: z.ZodArray<z.ZodString, "many">;
36
+ activation_markers: z.ZodArray<z.ZodString, "many">;
37
+ interface_hints: z.ZodArray<z.ZodString, "many">;
38
+ confidence: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ confidence: number;
41
+ interface_hints: string[];
42
+ class_factory_exports: string[];
43
+ activation_markers: string[];
44
+ }, {
45
+ confidence: number;
46
+ interface_hints: string[];
47
+ class_factory_exports: string[];
48
+ activation_markers: string[];
49
+ }>;
50
+ activation_steps: z.ZodArray<z.ZodString, "many">;
51
+ host_interaction_profile: z.ZodObject<{
52
+ likely_hosted: z.ZodBoolean;
53
+ host_hints: z.ZodArray<z.ZodString, "many">;
54
+ callback_exports: z.ZodArray<z.ZodString, "many">;
55
+ callback_surface: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
56
+ callback_strings: z.ZodArray<z.ZodString, "many">;
57
+ service_hooks: z.ZodArray<z.ZodString, "many">;
58
+ confidence: z.ZodNumber;
59
+ }, "strip", z.ZodTypeAny, {
60
+ confidence: number;
61
+ callback_surface: string[];
62
+ likely_hosted: boolean;
63
+ host_hints: string[];
64
+ callback_exports: string[];
65
+ callback_strings: string[];
66
+ service_hooks: string[];
67
+ }, {
68
+ confidence: number;
69
+ likely_hosted: boolean;
70
+ host_hints: string[];
71
+ callback_exports: string[];
72
+ callback_strings: string[];
73
+ service_hooks: string[];
74
+ callback_surface?: string[] | undefined;
75
+ }>;
76
+ activation_model: z.ZodString;
77
+ analysis_priorities: z.ZodArray<z.ZodString, "many">;
78
+ }, "strip", z.ZodTypeAny, {
79
+ sample_id: string;
80
+ binary_role: string;
81
+ original_filename: string | null;
82
+ analysis_priorities: string[];
83
+ registration_exports: string[];
84
+ clsid_strings: string[];
85
+ progid_strings: string[];
86
+ interface_hints: string[];
87
+ registration_strings: string[];
88
+ class_factory_exports: string[];
89
+ class_factory_surface: {
90
+ confidence: number;
91
+ interface_hints: string[];
92
+ class_factory_exports: string[];
93
+ activation_markers: string[];
94
+ };
95
+ host_interaction_profile: {
96
+ confidence: number;
97
+ callback_surface: string[];
98
+ likely_hosted: boolean;
99
+ host_hints: string[];
100
+ callback_exports: string[];
101
+ callback_strings: string[];
102
+ service_hooks: string[];
103
+ };
104
+ likely_com_server: boolean;
105
+ com_confidence: number;
106
+ activation_steps: string[];
107
+ activation_model: string;
108
+ }, {
109
+ sample_id: string;
110
+ binary_role: string;
111
+ original_filename: string | null;
112
+ analysis_priorities: string[];
113
+ registration_exports: string[];
114
+ clsid_strings: string[];
115
+ progid_strings: string[];
116
+ interface_hints: string[];
117
+ registration_strings: string[];
118
+ class_factory_exports: string[];
119
+ class_factory_surface: {
120
+ confidence: number;
121
+ interface_hints: string[];
122
+ class_factory_exports: string[];
123
+ activation_markers: string[];
124
+ };
125
+ host_interaction_profile: {
126
+ confidence: number;
127
+ likely_hosted: boolean;
128
+ host_hints: string[];
129
+ callback_exports: string[];
130
+ callback_strings: string[];
131
+ service_hooks: string[];
132
+ callback_surface?: string[] | undefined;
133
+ };
134
+ likely_com_server: boolean;
135
+ com_confidence: number;
136
+ activation_steps: string[];
137
+ activation_model: string;
138
+ }>;
139
+ export declare const ComRoleProfileOutputSchema: z.ZodObject<{
140
+ ok: z.ZodBoolean;
141
+ data: z.ZodOptional<z.ZodObject<{
142
+ sample_id: z.ZodString;
143
+ original_filename: z.ZodNullable<z.ZodString>;
144
+ binary_role: z.ZodString;
145
+ likely_com_server: z.ZodBoolean;
146
+ com_confidence: z.ZodNumber;
147
+ class_factory_exports: z.ZodArray<z.ZodString, "many">;
148
+ registration_exports: z.ZodArray<z.ZodString, "many">;
149
+ clsid_strings: z.ZodArray<z.ZodString, "many">;
150
+ progid_strings: z.ZodArray<z.ZodString, "many">;
151
+ interface_hints: z.ZodArray<z.ZodString, "many">;
152
+ registration_strings: z.ZodArray<z.ZodString, "many">;
153
+ class_factory_surface: z.ZodObject<{
154
+ class_factory_exports: z.ZodArray<z.ZodString, "many">;
155
+ activation_markers: z.ZodArray<z.ZodString, "many">;
156
+ interface_hints: z.ZodArray<z.ZodString, "many">;
157
+ confidence: z.ZodNumber;
158
+ }, "strip", z.ZodTypeAny, {
159
+ confidence: number;
160
+ interface_hints: string[];
161
+ class_factory_exports: string[];
162
+ activation_markers: string[];
163
+ }, {
164
+ confidence: number;
165
+ interface_hints: string[];
166
+ class_factory_exports: string[];
167
+ activation_markers: string[];
168
+ }>;
169
+ activation_steps: z.ZodArray<z.ZodString, "many">;
170
+ host_interaction_profile: z.ZodObject<{
171
+ likely_hosted: z.ZodBoolean;
172
+ host_hints: z.ZodArray<z.ZodString, "many">;
173
+ callback_exports: z.ZodArray<z.ZodString, "many">;
174
+ callback_surface: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
175
+ callback_strings: z.ZodArray<z.ZodString, "many">;
176
+ service_hooks: z.ZodArray<z.ZodString, "many">;
177
+ confidence: z.ZodNumber;
178
+ }, "strip", z.ZodTypeAny, {
179
+ confidence: number;
180
+ callback_surface: string[];
181
+ likely_hosted: boolean;
182
+ host_hints: string[];
183
+ callback_exports: string[];
184
+ callback_strings: string[];
185
+ service_hooks: string[];
186
+ }, {
187
+ confidence: number;
188
+ likely_hosted: boolean;
189
+ host_hints: string[];
190
+ callback_exports: string[];
191
+ callback_strings: string[];
192
+ service_hooks: string[];
193
+ callback_surface?: string[] | undefined;
194
+ }>;
195
+ activation_model: z.ZodString;
196
+ analysis_priorities: z.ZodArray<z.ZodString, "many">;
197
+ }, "strip", z.ZodTypeAny, {
198
+ sample_id: string;
199
+ binary_role: string;
200
+ original_filename: string | null;
201
+ analysis_priorities: string[];
202
+ registration_exports: string[];
203
+ clsid_strings: string[];
204
+ progid_strings: string[];
205
+ interface_hints: string[];
206
+ registration_strings: string[];
207
+ class_factory_exports: string[];
208
+ class_factory_surface: {
209
+ confidence: number;
210
+ interface_hints: string[];
211
+ class_factory_exports: string[];
212
+ activation_markers: string[];
213
+ };
214
+ host_interaction_profile: {
215
+ confidence: number;
216
+ callback_surface: string[];
217
+ likely_hosted: boolean;
218
+ host_hints: string[];
219
+ callback_exports: string[];
220
+ callback_strings: string[];
221
+ service_hooks: string[];
222
+ };
223
+ likely_com_server: boolean;
224
+ com_confidence: number;
225
+ activation_steps: string[];
226
+ activation_model: string;
227
+ }, {
228
+ sample_id: string;
229
+ binary_role: string;
230
+ original_filename: string | null;
231
+ analysis_priorities: string[];
232
+ registration_exports: string[];
233
+ clsid_strings: string[];
234
+ progid_strings: string[];
235
+ interface_hints: string[];
236
+ registration_strings: string[];
237
+ class_factory_exports: string[];
238
+ class_factory_surface: {
239
+ confidence: number;
240
+ interface_hints: string[];
241
+ class_factory_exports: string[];
242
+ activation_markers: string[];
243
+ };
244
+ host_interaction_profile: {
245
+ confidence: number;
246
+ likely_hosted: boolean;
247
+ host_hints: string[];
248
+ callback_exports: string[];
249
+ callback_strings: string[];
250
+ service_hooks: string[];
251
+ callback_surface?: string[] | undefined;
252
+ };
253
+ likely_com_server: boolean;
254
+ com_confidence: number;
255
+ activation_steps: string[];
256
+ activation_model: string;
257
+ }>>;
258
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
259
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
+ metrics: z.ZodOptional<z.ZodObject<{
261
+ elapsed_ms: z.ZodNumber;
262
+ tool: z.ZodString;
263
+ }, "strip", z.ZodTypeAny, {
264
+ elapsed_ms: number;
265
+ tool: string;
266
+ }, {
267
+ elapsed_ms: number;
268
+ tool: string;
269
+ }>>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ ok: boolean;
272
+ data?: {
273
+ sample_id: string;
274
+ binary_role: string;
275
+ original_filename: string | null;
276
+ analysis_priorities: string[];
277
+ registration_exports: string[];
278
+ clsid_strings: string[];
279
+ progid_strings: string[];
280
+ interface_hints: string[];
281
+ registration_strings: string[];
282
+ class_factory_exports: string[];
283
+ class_factory_surface: {
284
+ confidence: number;
285
+ interface_hints: string[];
286
+ class_factory_exports: string[];
287
+ activation_markers: string[];
288
+ };
289
+ host_interaction_profile: {
290
+ confidence: number;
291
+ callback_surface: string[];
292
+ likely_hosted: boolean;
293
+ host_hints: string[];
294
+ callback_exports: string[];
295
+ callback_strings: string[];
296
+ service_hooks: string[];
297
+ };
298
+ likely_com_server: boolean;
299
+ com_confidence: number;
300
+ activation_steps: string[];
301
+ activation_model: string;
302
+ } | undefined;
303
+ metrics?: {
304
+ elapsed_ms: number;
305
+ tool: string;
306
+ } | undefined;
307
+ warnings?: string[] | undefined;
308
+ errors?: string[] | undefined;
309
+ }, {
310
+ ok: boolean;
311
+ data?: {
312
+ sample_id: string;
313
+ binary_role: string;
314
+ original_filename: string | null;
315
+ analysis_priorities: string[];
316
+ registration_exports: string[];
317
+ clsid_strings: string[];
318
+ progid_strings: string[];
319
+ interface_hints: string[];
320
+ registration_strings: string[];
321
+ class_factory_exports: string[];
322
+ class_factory_surface: {
323
+ confidence: number;
324
+ interface_hints: string[];
325
+ class_factory_exports: string[];
326
+ activation_markers: string[];
327
+ };
328
+ host_interaction_profile: {
329
+ confidence: number;
330
+ likely_hosted: boolean;
331
+ host_hints: string[];
332
+ callback_exports: string[];
333
+ callback_strings: string[];
334
+ service_hooks: string[];
335
+ callback_surface?: string[] | undefined;
336
+ };
337
+ likely_com_server: boolean;
338
+ com_confidence: number;
339
+ activation_steps: string[];
340
+ activation_model: string;
341
+ } | undefined;
342
+ metrics?: {
343
+ elapsed_ms: number;
344
+ tool: string;
345
+ } | undefined;
346
+ warnings?: string[] | undefined;
347
+ errors?: string[] | undefined;
348
+ }>;
349
+ export declare const comRoleProfileToolDefinition: ToolDefinition;
350
+ export declare function createComRoleProfileHandler(workspaceManager: WorkspaceManager, database: DatabaseManager, cacheManager: CacheManager, dependencies?: {
351
+ binaryRoleProfileHandler?: (args: ToolArgs) => Promise<WorkerResult>;
352
+ }): (args: ToolArgs) => Promise<WorkerResult>;
353
+ //# sourceMappingURL=com-role-profile.d.ts.map
@@ -0,0 +1,186 @@
1
+ import { z } from 'zod';
2
+ import { BinaryRoleProfileDataSchema, createBinaryRoleProfileHandler, } from './binary-role-profile.js';
3
+ const TOOL_NAME = 'com.role.profile';
4
+ export const ComRoleProfileInputSchema = z.object({
5
+ sample_id: z.string().describe('Sample ID (format: sha256:<hex>)'),
6
+ max_exports: z
7
+ .number()
8
+ .int()
9
+ .min(1)
10
+ .max(24)
11
+ .default(12)
12
+ .describe('Maximum class-factory and registration exports surfaced in the COM role profile'),
13
+ max_strings: z
14
+ .number()
15
+ .int()
16
+ .min(20)
17
+ .max(400)
18
+ .default(140)
19
+ .describe('Maximum strings inspected for CLSID, ProgID, interface, and registration hints'),
20
+ force_refresh: z
21
+ .boolean()
22
+ .default(false)
23
+ .describe('Bypass cache lookup and recompute the COM role profile from source evidence'),
24
+ });
25
+ export const ComRoleProfileDataSchema = z.object({
26
+ sample_id: z.string(),
27
+ original_filename: z.string().nullable(),
28
+ binary_role: z.string(),
29
+ likely_com_server: z.boolean(),
30
+ com_confidence: z.number().min(0).max(1),
31
+ class_factory_exports: z.array(z.string()),
32
+ registration_exports: z.array(z.string()),
33
+ clsid_strings: z.array(z.string()),
34
+ progid_strings: z.array(z.string()),
35
+ interface_hints: z.array(z.string()),
36
+ registration_strings: z.array(z.string()),
37
+ class_factory_surface: z.object({
38
+ class_factory_exports: z.array(z.string()),
39
+ activation_markers: z.array(z.string()),
40
+ interface_hints: z.array(z.string()),
41
+ confidence: z.number().min(0).max(1),
42
+ }),
43
+ activation_steps: z.array(z.string()),
44
+ host_interaction_profile: BinaryRoleProfileDataSchema.shape.host_interaction_profile,
45
+ activation_model: z.string(),
46
+ analysis_priorities: z.array(z.string()),
47
+ });
48
+ export const ComRoleProfileOutputSchema = z.object({
49
+ ok: z.boolean(),
50
+ data: ComRoleProfileDataSchema.optional(),
51
+ warnings: z.array(z.string()).optional(),
52
+ errors: z.array(z.string()).optional(),
53
+ metrics: z
54
+ .object({
55
+ elapsed_ms: z.number(),
56
+ tool: z.string(),
57
+ })
58
+ .optional(),
59
+ });
60
+ export const comRoleProfileToolDefinition = {
61
+ name: TOOL_NAME,
62
+ description: 'Profile COM-oriented PE samples, including class factory exports, CLSID/ProgID strings, registration hints, and likely activation flow.',
63
+ inputSchema: ComRoleProfileInputSchema,
64
+ outputSchema: ComRoleProfileOutputSchema,
65
+ };
66
+ function dedupe(values) {
67
+ return Array.from(new Set(values.map((item) => item.trim()).filter((item) => item.length > 0)));
68
+ }
69
+ function inferActivationModel(profile) {
70
+ if (profile.com_profile.class_factory_exports.length > 0) {
71
+ return 'inproc_class_factory';
72
+ }
73
+ if (profile.com_profile.registration_strings.some((item) => /localserver32/i.test(item))) {
74
+ return 'local_server_registration';
75
+ }
76
+ if (profile.com_profile.clsid_strings.length > 0 || profile.com_profile.progid_strings.length > 0) {
77
+ return 'registration_strings_only';
78
+ }
79
+ return 'not_com_like';
80
+ }
81
+ function buildActivationSteps(profile) {
82
+ const steps = [];
83
+ if (profile.export_dispatch_profile.registration_exports.length > 0) {
84
+ steps.push('Review COM registration exports and registry-facing installation routines.');
85
+ }
86
+ if (profile.com_profile.registration_strings.some((item) => /inprocserver32/i.test(item))) {
87
+ steps.push('Resolve the InprocServer32 registration path and associated CLSID/ProgID bindings.');
88
+ }
89
+ if (profile.com_profile.registration_strings.some((item) => /localserver32/i.test(item))) {
90
+ steps.push('Check whether activation can fall back to a LocalServer32-style out-of-process server.');
91
+ }
92
+ if (profile.com_profile.class_factory_exports.length > 0) {
93
+ steps.push('Trace DllGetClassObject or equivalent class-factory export into object instantiation logic.');
94
+ }
95
+ if (profile.com_profile.interface_hints.length > 0) {
96
+ steps.push('Follow interface negotiation paths for IClassFactory/IUnknown/IDispatch-style flows.');
97
+ }
98
+ return dedupe(steps);
99
+ }
100
+ function buildClassFactorySurface(profile) {
101
+ const activationMarkers = dedupe([
102
+ ...profile.com_profile.clsid_strings,
103
+ ...profile.com_profile.progid_strings,
104
+ ...profile.com_profile.registration_strings.filter((item) => /inprocserver32|localserver32|appid|clsid/i.test(item)),
105
+ ].slice(0, 8));
106
+ let confidence = profile.com_profile.class_factory_exports.length > 0 ? 0.64 : 0.28;
107
+ if (activationMarkers.length > 0)
108
+ confidence += 0.16;
109
+ if (profile.com_profile.interface_hints.length > 0)
110
+ confidence += 0.08;
111
+ return {
112
+ class_factory_exports: profile.com_profile.class_factory_exports,
113
+ activation_markers: activationMarkers,
114
+ interface_hints: profile.com_profile.interface_hints,
115
+ confidence: Math.min(1, confidence),
116
+ };
117
+ }
118
+ export function createComRoleProfileHandler(workspaceManager, database, cacheManager, dependencies) {
119
+ const binaryRoleProfileHandler = dependencies?.binaryRoleProfileHandler ||
120
+ createBinaryRoleProfileHandler(workspaceManager, database, cacheManager);
121
+ return async (args) => {
122
+ const startTime = Date.now();
123
+ try {
124
+ const input = ComRoleProfileInputSchema.parse(args);
125
+ const profileResult = await binaryRoleProfileHandler({
126
+ sample_id: input.sample_id,
127
+ max_exports: input.max_exports,
128
+ max_strings: input.max_strings,
129
+ force_refresh: input.force_refresh,
130
+ });
131
+ if (!profileResult.ok || !profileResult.data) {
132
+ return {
133
+ ok: false,
134
+ errors: profileResult.errors || ['Failed to compute binary role profile'],
135
+ warnings: profileResult.warnings,
136
+ metrics: {
137
+ elapsed_ms: Date.now() - startTime,
138
+ tool: TOOL_NAME,
139
+ },
140
+ };
141
+ }
142
+ const profile = BinaryRoleProfileDataSchema.parse(profileResult.data);
143
+ const payload = {
144
+ sample_id: profile.sample_id,
145
+ original_filename: profile.original_filename,
146
+ binary_role: profile.binary_role,
147
+ likely_com_server: profile.indicators.com_server.likely,
148
+ com_confidence: profile.com_profile.confidence,
149
+ class_factory_exports: profile.com_profile.class_factory_exports,
150
+ registration_exports: profile.export_dispatch_profile.registration_exports,
151
+ clsid_strings: profile.com_profile.clsid_strings,
152
+ progid_strings: profile.com_profile.progid_strings,
153
+ interface_hints: profile.com_profile.interface_hints,
154
+ registration_strings: profile.com_profile.registration_strings,
155
+ class_factory_surface: buildClassFactorySurface(profile),
156
+ activation_steps: buildActivationSteps(profile),
157
+ host_interaction_profile: profile.host_interaction_profile,
158
+ activation_model: inferActivationModel(profile),
159
+ analysis_priorities: dedupe([
160
+ ...profile.analysis_priorities,
161
+ 'trace_com_activation_and_class_factory_flow',
162
+ ]),
163
+ };
164
+ return {
165
+ ok: true,
166
+ data: payload,
167
+ warnings: profileResult.warnings,
168
+ metrics: {
169
+ elapsed_ms: Date.now() - startTime,
170
+ tool: TOOL_NAME,
171
+ },
172
+ };
173
+ }
174
+ catch (error) {
175
+ return {
176
+ ok: false,
177
+ errors: [error.message],
178
+ metrics: {
179
+ elapsed_ms: Date.now() - startTime,
180
+ tool: TOOL_NAME,
181
+ },
182
+ };
183
+ }
184
+ };
185
+ }
186
+ //# sourceMappingURL=com-role-profile.js.map