pompelmi 0.35.5 → 1.0.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.
Files changed (133) hide show
  1. package/.claude/settings.local.json +40 -0
  2. package/LICENSE +12 -18
  3. package/README.md +159 -183
  4. package/eslint.config.mjs +8 -0
  5. package/package.json +26 -251
  6. package/src/ClamAVDatabaseUpdater.js +48 -0
  7. package/src/ClamAVInstaller.js +49 -0
  8. package/src/ClamAVScanner.js +31 -0
  9. package/src/InstallerCommand.js +11 -0
  10. package/src/config.js +22 -0
  11. package/src/constants.js +3 -0
  12. package/src/favicon.ico +0 -0
  13. package/src/grapefruit.png +0 -0
  14. package/src/index.js +5 -0
  15. package/CHANGELOG.md +0 -71
  16. package/dist/pompelmi.audit.cjs +0 -128
  17. package/dist/pompelmi.audit.cjs.map +0 -1
  18. package/dist/pompelmi.audit.esm.js +0 -107
  19. package/dist/pompelmi.audit.esm.js.map +0 -1
  20. package/dist/pompelmi.browser.cjs +0 -1549
  21. package/dist/pompelmi.browser.cjs.map +0 -1
  22. package/dist/pompelmi.browser.esm.js +0 -1523
  23. package/dist/pompelmi.browser.esm.js.map +0 -1
  24. package/dist/pompelmi.cjs +0 -2591
  25. package/dist/pompelmi.cjs.map +0 -1
  26. package/dist/pompelmi.esm.js +0 -2525
  27. package/dist/pompelmi.esm.js.map +0 -1
  28. package/dist/pompelmi.hooks.cjs +0 -75
  29. package/dist/pompelmi.hooks.cjs.map +0 -1
  30. package/dist/pompelmi.hooks.esm.js +0 -72
  31. package/dist/pompelmi.hooks.esm.js.map +0 -1
  32. package/dist/pompelmi.policy-packs.cjs +0 -240
  33. package/dist/pompelmi.policy-packs.cjs.map +0 -1
  34. package/dist/pompelmi.policy-packs.esm.js +0 -232
  35. package/dist/pompelmi.policy-packs.esm.js.map +0 -1
  36. package/dist/pompelmi.quarantine.cjs +0 -317
  37. package/dist/pompelmi.quarantine.cjs.map +0 -1
  38. package/dist/pompelmi.quarantine.esm.js +0 -293
  39. package/dist/pompelmi.quarantine.esm.js.map +0 -1
  40. package/dist/pompelmi.react.cjs +0 -1580
  41. package/dist/pompelmi.react.cjs.map +0 -1
  42. package/dist/pompelmi.react.esm.js +0 -1553
  43. package/dist/pompelmi.react.esm.js.map +0 -1
  44. package/dist/types/audit.d.ts +0 -84
  45. package/dist/types/browser-index.d.ts +0 -29
  46. package/dist/types/config.d.ts +0 -143
  47. package/dist/types/engines/dynamic-taint.d.ts +0 -102
  48. package/dist/types/engines/hybrid-orchestrator.d.ts +0 -65
  49. package/dist/types/engines/hybrid-taint-integration.d.ts +0 -129
  50. package/dist/types/engines/taint-policies.d.ts +0 -84
  51. package/dist/types/hipaa-compliance.d.ts +0 -110
  52. package/dist/types/hooks.d.ts +0 -89
  53. package/dist/types/index.d.ts +0 -29
  54. package/dist/types/magic.d.ts +0 -7
  55. package/dist/types/node/scanDir.d.ts +0 -30
  56. package/dist/types/policy-packs.d.ts +0 -98
  57. package/dist/types/policy.d.ts +0 -12
  58. package/dist/types/presets.d.ts +0 -72
  59. package/dist/types/quarantine/index.d.ts +0 -18
  60. package/dist/types/quarantine/storage.d.ts +0 -77
  61. package/dist/types/quarantine/types.d.ts +0 -78
  62. package/dist/types/quarantine/workflow.d.ts +0 -97
  63. package/dist/types/react-index.d.ts +0 -13
  64. package/dist/types/risk.d.ts +0 -18
  65. package/dist/types/scan/remote.d.ts +0 -12
  66. package/dist/types/scan.d.ts +0 -17
  67. package/dist/types/scanners/common-heuristics.d.ts +0 -14
  68. package/dist/types/scanners/zip-bomb-guard.d.ts +0 -9
  69. package/dist/types/scanners/zipTraversalGuard.d.ts +0 -19
  70. package/dist/types/src/audit.d.ts +0 -84
  71. package/dist/types/src/browser-index.d.ts +0 -29
  72. package/dist/types/src/config.d.ts +0 -143
  73. package/dist/types/src/engines/dynamic-taint.d.ts +0 -102
  74. package/dist/types/src/engines/hybrid-orchestrator.d.ts +0 -65
  75. package/dist/types/src/engines/hybrid-taint-integration.d.ts +0 -129
  76. package/dist/types/src/engines/taint-policies.d.ts +0 -84
  77. package/dist/types/src/hipaa-compliance.d.ts +0 -110
  78. package/dist/types/src/hooks.d.ts +0 -89
  79. package/dist/types/src/index.d.ts +0 -29
  80. package/dist/types/src/magic.d.ts +0 -7
  81. package/dist/types/src/node/scanDir.d.ts +0 -30
  82. package/dist/types/src/policy-packs.d.ts +0 -98
  83. package/dist/types/src/policy.d.ts +0 -12
  84. package/dist/types/src/presets.d.ts +0 -72
  85. package/dist/types/src/quarantine/index.d.ts +0 -18
  86. package/dist/types/src/quarantine/storage.d.ts +0 -77
  87. package/dist/types/src/quarantine/types.d.ts +0 -78
  88. package/dist/types/src/quarantine/workflow.d.ts +0 -97
  89. package/dist/types/src/react-index.d.ts +0 -13
  90. package/dist/types/src/risk.d.ts +0 -18
  91. package/dist/types/src/scan/remote.d.ts +0 -12
  92. package/dist/types/src/scan.d.ts +0 -17
  93. package/dist/types/src/scanners/common-heuristics.d.ts +0 -14
  94. package/dist/types/src/scanners/zip-bomb-guard.d.ts +0 -11
  95. package/dist/types/src/scanners/zipTraversalGuard.d.ts +0 -19
  96. package/dist/types/src/stream.d.ts +0 -10
  97. package/dist/types/src/types/decompilation.d.ts +0 -96
  98. package/dist/types/src/types/taint-tracking.d.ts +0 -495
  99. package/dist/types/src/types.d.ts +0 -48
  100. package/dist/types/src/useFileScanner.d.ts +0 -15
  101. package/dist/types/src/utils/advanced-detection.d.ts +0 -21
  102. package/dist/types/src/utils/batch-scanner.d.ts +0 -62
  103. package/dist/types/src/utils/cache-manager.d.ts +0 -95
  104. package/dist/types/src/utils/export.d.ts +0 -51
  105. package/dist/types/src/utils/performance-metrics.d.ts +0 -68
  106. package/dist/types/src/utils/threat-intelligence.d.ts +0 -96
  107. package/dist/types/src/validate.d.ts +0 -7
  108. package/dist/types/src/verdict.d.ts +0 -2
  109. package/dist/types/src/yara/browser.d.ts +0 -7
  110. package/dist/types/src/yara/index.d.ts +0 -17
  111. package/dist/types/src/yara/node.d.ts +0 -2
  112. package/dist/types/src/yara/remote.d.ts +0 -10
  113. package/dist/types/src/yara-bridge.d.ts +0 -3
  114. package/dist/types/src/zip.d.ts +0 -13
  115. package/dist/types/stream.d.ts +0 -10
  116. package/dist/types/types/decompilation.d.ts +0 -96
  117. package/dist/types/types/taint-tracking.d.ts +0 -495
  118. package/dist/types/types.d.ts +0 -48
  119. package/dist/types/useFileScanner.d.ts +0 -15
  120. package/dist/types/utils/advanced-detection.d.ts +0 -21
  121. package/dist/types/utils/batch-scanner.d.ts +0 -62
  122. package/dist/types/utils/cache-manager.d.ts +0 -95
  123. package/dist/types/utils/export.d.ts +0 -51
  124. package/dist/types/utils/performance-metrics.d.ts +0 -68
  125. package/dist/types/utils/threat-intelligence.d.ts +0 -96
  126. package/dist/types/validate.d.ts +0 -7
  127. package/dist/types/verdict.d.ts +0 -2
  128. package/dist/types/yara/browser.d.ts +0 -7
  129. package/dist/types/yara/index.d.ts +0 -17
  130. package/dist/types/yara/node.d.ts +0 -2
  131. package/dist/types/yara/remote.d.ts +0 -10
  132. package/dist/types/yara-bridge.d.ts +0 -3
  133. package/dist/types/zip.d.ts +0 -13
@@ -1,17 +0,0 @@
1
- import type { ScannerConfig } from "./config";
2
- import { type PresetName } from "./presets";
3
- import type { ScanContext, ScanReport } from "./types";
4
- export type ScanOptions = {
5
- preset?: PresetName;
6
- ctx?: ScanContext;
7
- enableAdvancedDetection?: boolean;
8
- enablePerformanceTracking?: boolean;
9
- enableCache?: boolean;
10
- config?: Partial<ScannerConfig>;
11
- };
12
- /** Scan di bytes (browser/node) usando preset (default: zip-basic) */
13
- export declare function scanBytes(input: Uint8Array, opts?: ScanOptions): Promise<ScanReport>;
14
- /** Scan di un file su disco (Node). Import dinamico per non vincolare il bundle browser. */
15
- export declare function scanFile(filePath: string, opts?: Omit<ScanOptions, "ctx">): Promise<ScanReport>;
16
- /** Scan multipli File (browser) usando scanBytes + preset di default */
17
- export declare function scanFiles(files: ArrayLike<File>, opts?: Omit<ScanOptions, "ctx">): Promise<ScanReport[]>;
@@ -1,14 +0,0 @@
1
- /**
2
- * CommonHeuristicsScanner
3
- * Lightweight, no-deps heuristics for common risky file patterns.
4
- * Returns matches as [{ rule, severity?, meta? }].
5
- */
6
- export type HeuristicMatch = {
7
- rule: string;
8
- severity?: "info" | "low" | "medium" | "high" | "critical" | "suspicious" | "malicious";
9
- meta?: Record<string, unknown>;
10
- };
11
- export interface SimpleScanner {
12
- scan(bytes: Uint8Array): Promise<HeuristicMatch[]>;
13
- }
14
- export declare const CommonHeuristicsScanner: SimpleScanner;
@@ -1,11 +0,0 @@
1
- import type { Scanner } from "../types";
2
- export type ZipBombGuardOptions = {
3
- maxEntries?: number;
4
- maxTotalUncompressedBytes?: number;
5
- maxPerEntryUncompressedBytes?: number;
6
- maxEntryNameLength?: number;
7
- maxCompressionRatio?: number;
8
- eocdSearchWindow?: number;
9
- };
10
- export declare const ARCHIVE_BOMB_DETECTED = "ARCHIVE_BOMB_DETECTED";
11
- export declare function createZipBombGuard(opts?: ZipBombGuardOptions): Scanner;
@@ -1,19 +0,0 @@
1
- /**
2
- * createZipTraversalGuard – guards against path traversal & header spoofing in ZIPs.
3
- * EXPECTS: caller provides an iterator over entries with metadata (name, isSymlink, target?, from CEN & LFH).
4
- * Return non-empty array to flag.
5
- */
6
- export type EntryMeta = {
7
- nameCEN: string;
8
- nameLFH: string;
9
- isSymlink?: boolean;
10
- linkTarget?: string;
11
- };
12
- export declare function createZipTraversalGuard(): {
13
- id: string;
14
- scan(entries: AsyncIterable<EntryMeta>): Promise<{
15
- rule: string;
16
- severity: "suspicious";
17
- msg: string;
18
- }[]>;
19
- };
@@ -1,10 +0,0 @@
1
- import type { ScanReport, YaraMatch } from "./types";
2
- export type ScanOptions = {
3
- maxBytes?: number;
4
- timeoutMs?: number;
5
- detectMime?: boolean;
6
- computeSha256?: boolean;
7
- scanChunk?: (chunk: Uint8Array) => Promise<void> | void;
8
- scanAll: (bytes: Uint8Array) => Promise<YaraMatch[]>;
9
- };
10
- export declare function scanStream(readable: NodeJS.ReadableStream, options: ScanOptions): Promise<ScanReport>;
@@ -1,96 +0,0 @@
1
- /** Decompilation-specific types for Pompelmi */
2
- export type DecompilationEngine = "binaryninja-hlil" | "ghidra-pcode";
3
- export type AnalysisDepth = "minimal" | "basic" | "deep";
4
- export interface DecompilationMatch {
5
- rule: string;
6
- severity?: "low" | "medium" | "high" | "critical";
7
- engine: DecompilationEngine;
8
- confidence: number;
9
- meta?: {
10
- function?: string;
11
- address?: string;
12
- instruction?: string;
13
- pattern?: string;
14
- [key: string]: unknown;
15
- };
16
- }
17
- export interface FunctionAnalysis {
18
- name: string;
19
- address: string;
20
- size: number;
21
- complexity?: number;
22
- callCount?: number;
23
- isObfuscated?: boolean;
24
- hasAntiAnalysis?: boolean;
25
- suspiciousCalls?: string[];
26
- }
27
- export interface DecompilationResult {
28
- engine: DecompilationEngine;
29
- success: boolean;
30
- functions: FunctionAnalysis[];
31
- matches: DecompilationMatch[];
32
- meta?: {
33
- analysisTime?: number;
34
- binaryFormat?: string;
35
- architecture?: string;
36
- [key: string]: unknown;
37
- };
38
- }
39
- export interface DecompilationScanner {
40
- scan(bytes: Uint8Array): Promise<DecompilationMatch[]>;
41
- analyze?(bytes: Uint8Array): Promise<DecompilationResult>;
42
- }
43
- export interface HLILInstruction {
44
- operation: string;
45
- address: string;
46
- operands?: any[];
47
- vars?: string[];
48
- }
49
- export interface HLILFunction {
50
- name: string;
51
- address: string;
52
- instructions: HLILInstruction[];
53
- basicBlocks?: number;
54
- complexity?: number;
55
- }
56
- export interface BinaryNinjaOptions {
57
- timeout?: number;
58
- depth?: AnalysisDepth;
59
- enableHeuristics?: boolean;
60
- pythonPath?: string;
61
- binaryNinjaPath?: string;
62
- }
63
- export interface PCodeOperation {
64
- opcode: string;
65
- address: string;
66
- inputs?: string[];
67
- output?: string;
68
- }
69
- export interface PCodeFunction {
70
- name: string;
71
- address: string;
72
- operations: PCodeOperation[];
73
- basicBlocks?: number;
74
- }
75
- export interface GhidraOptions {
76
- timeout?: number;
77
- depth?: AnalysisDepth;
78
- enableHeuristics?: boolean;
79
- ghidraPath?: string;
80
- analyzeHeadless?: string;
81
- }
82
- export interface DecompilationOptions {
83
- engine: DecompilationEngine;
84
- timeout?: number;
85
- depth?: AnalysisDepth;
86
- enableHeuristics?: boolean;
87
- binaryNinja?: BinaryNinjaOptions;
88
- ghidra?: GhidraOptions;
89
- }
90
- export interface SuspiciousPattern {
91
- name: string;
92
- description: string;
93
- severity: "low" | "medium" | "high" | "critical";
94
- pattern: RegExp | string | ((instruction: any) => boolean);
95
- }
96
- export declare const SUSPICIOUS_PATTERNS: SuspiciousPattern[];
@@ -1,495 +0,0 @@
1
- /**
2
- * Dynamic Taint Tracking Types
3
- *
4
- * Comprehensive type definitions for advanced taint analysis and hybrid orchestration
5
- * supporting multi-engine malware analysis with data flow tracking capabilities.
6
- */
7
- /**
8
- * Taint source types indicating where tainted data originates
9
- */
10
- export type TaintSource = "user_input" | "file_read" | "network_recv" | "registry_read" | "environment" | "crypto_weak" | "external_api" | "memory_leak" | "time_source" | "custom";
11
- /**
12
- * Taint sink types indicating where tainted data should not flow
13
- */
14
- export type TaintSink = "exec_function" | "file_write" | "network_send" | "registry_write" | "sql_query" | "format_string" | "memory_alloc" | "crypto_key" | "auth_check" | "log_output" | "custom";
15
- /**
16
- * Taint propagation operations that affect taint flow
17
- */
18
- export type TaintOperation = "copy" | "arithmetic" | "bitwise" | "comparison" | "concatenation" | "substring" | "conversion" | "encryption" | "hash" | "sanitization" | "validation" | "encoding" | "custom";
19
- /**
20
- * Taint label with metadata for tracking
21
- */
22
- export interface TaintLabel {
23
- /** Unique identifier for this taint */
24
- id: string;
25
- /** Source of the taint */
26
- source: TaintSource;
27
- /** Original location where taint was introduced */
28
- origin: {
29
- address: string;
30
- function?: string;
31
- instruction?: string;
32
- timestamp: number;
33
- };
34
- /** Confidence level of taint tracking (0.0 - 1.0) */
35
- confidence: number;
36
- /** Optional metadata for custom analysis */
37
- metadata?: {
38
- severity?: "low" | "medium" | "high" | "critical";
39
- description?: string;
40
- tags?: string[];
41
- [key: string]: unknown;
42
- };
43
- }
44
- /**
45
- * Memory location with taint information
46
- */
47
- export interface TaintedMemory {
48
- /** Memory address or symbolic location */
49
- address: string;
50
- /** Size of tainted region in bytes */
51
- size: number;
52
- /** Set of taint labels affecting this memory */
53
- taints: TaintLabel[];
54
- /** Last operation that affected this memory */
55
- lastOperation: {
56
- operation: TaintOperation;
57
- timestamp: number;
58
- instruction?: string;
59
- };
60
- }
61
- /**
62
- * Register state with taint information
63
- */
64
- export interface TaintedRegister {
65
- /** Register name (e.g., 'eax', 'rdi', 'r0') */
66
- name: string;
67
- /** Set of taint labels affecting this register */
68
- taints: TaintLabel[];
69
- /** Bit-level taint mask for partial register tainting */
70
- taintMask?: string;
71
- /** Last operation that affected this register */
72
- lastOperation: {
73
- operation: TaintOperation;
74
- timestamp: number;
75
- instruction?: string;
76
- };
77
- }
78
- /**
79
- * Taint propagation rule for specific operations
80
- */
81
- export interface TaintPropagationRule {
82
- /** Unique rule identifier */
83
- id: string;
84
- /** Rule name for debugging */
85
- name: string;
86
- /** Pattern to match instructions/operations */
87
- pattern: {
88
- /** Instruction mnemonic pattern (regex) */
89
- instruction?: string;
90
- /** Function name pattern (regex) */
91
- function?: string;
92
- /** API call pattern (regex) */
93
- api?: string;
94
- };
95
- /** How taint flows through this operation */
96
- propagation: {
97
- /** Source operands (0-based indices) */
98
- sources: number[];
99
- /** Destination operands (0-based indices) */
100
- destinations: number[];
101
- /** Operation type affecting taint */
102
- operation: TaintOperation;
103
- /** Whether operation removes taint */
104
- sanitizes?: boolean;
105
- /** Confidence adjustment factor */
106
- confidenceMultiplier?: number;
107
- };
108
- /** Whether this rule creates a taint sink */
109
- isSink?: boolean;
110
- /** Priority for rule matching (higher = more priority) */
111
- priority: number;
112
- }
113
- /**
114
- * Taint analysis configuration
115
- */
116
- export interface TaintConfig {
117
- /** Maximum number of instructions to analyze */
118
- maxInstructions?: number;
119
- /** Maximum analysis time in milliseconds */
120
- timeout?: number;
121
- /** Minimum confidence threshold for reporting */
122
- confidenceThreshold?: number;
123
- /** Sources to track */
124
- enabledSources: TaintSource[];
125
- /** Sinks to detect */
126
- enabledSinks: TaintSink[];
127
- /** Custom propagation rules */
128
- customRules?: TaintPropagationRule[];
129
- /** Whether to track implicit flows (control flow taint) */
130
- trackImplicitFlows?: boolean;
131
- /** Whether to perform path-sensitive analysis */
132
- pathSensitive?: boolean;
133
- /** Maximum call depth for interprocedural analysis */
134
- maxCallDepth?: number;
135
- /** HIPAA compliance settings */
136
- hipaaCompliance?: {
137
- enabled: boolean;
138
- sanitizeAddresses?: boolean;
139
- auditLevel?: "minimal" | "standard" | "comprehensive";
140
- };
141
- }
142
- /**
143
- * Taint flow path representing data flow from source to sink
144
- */
145
- export interface TaintFlow {
146
- /** Unique flow identifier */
147
- id: string;
148
- /** Source where taint originated */
149
- source: {
150
- label: TaintLabel;
151
- location: string;
152
- instruction?: string;
153
- };
154
- /** Sink where taint reaches */
155
- sink: {
156
- type: TaintSink;
157
- location: string;
158
- instruction?: string;
159
- function?: string;
160
- };
161
- /** Path through the program */
162
- path: Array<{
163
- address: string;
164
- instruction?: string;
165
- operation: TaintOperation;
166
- confidence: number;
167
- timestamp: number;
168
- }>;
169
- /** Overall confidence of this flow */
170
- confidence: number;
171
- /** Severity assessment */
172
- severity: "low" | "medium" | "high" | "critical";
173
- /** Whether this represents a security vulnerability */
174
- isVulnerability: boolean;
175
- /** Additional metadata */
176
- metadata?: {
177
- cwe?: string;
178
- description?: string;
179
- mitigations?: string[];
180
- [key: string]: unknown;
181
- };
182
- }
183
- /**
184
- * Taint analysis result
185
- */
186
- export interface TaintAnalysisResult {
187
- /** Analysis engine identifier */
188
- engine: "dynamic-taint" | "hybrid-taint";
189
- /** Analysis success status */
190
- success: boolean;
191
- /** Total analysis time in milliseconds */
192
- analysisTime: number;
193
- /** Number of instructions analyzed */
194
- instructionsAnalyzed: number;
195
- /** Detected taint flows */
196
- flows: TaintFlow[];
197
- /** Current memory taint state */
198
- memoryState: TaintedMemory[];
199
- /** Current register taint state */
200
- registerState: TaintedRegister[];
201
- /** Analysis statistics */
202
- statistics: {
203
- totalSources: number;
204
- totalSinks: number;
205
- vulnerableFlows: number;
206
- sanitizedFlows: number;
207
- highConfidenceFlows: number;
208
- uniqueTaints: number;
209
- };
210
- /** Any analysis errors or warnings */
211
- errors?: string[];
212
- warnings?: string[];
213
- /** Additional metadata */
214
- meta?: {
215
- configUsed?: TaintConfig;
216
- analysisMode?: string;
217
- [key: string]: unknown;
218
- };
219
- }
220
- /**
221
- * Analysis engine types supported by the orchestrator
222
- */
223
- export type AnalysisEngine = "binaryninja-hlil" | "ghidra-pcode" | "dynamic-taint" | "static-analysis" | "symbolic-execution" | "fuzzing" | "custom";
224
- /**
225
- * Analysis phase in the hybrid orchestration pipeline
226
- */
227
- export type AnalysisPhase = "preprocessing" | "static" | "dynamic" | "taint" | "correlation" | "postprocessing" | "reporting";
228
- /**
229
- * Engine capability descriptor
230
- */
231
- export interface EngineCapability {
232
- /** Engine identifier */
233
- engine: AnalysisEngine;
234
- /** Supported analysis types */
235
- capabilities: Array<"decompilation" | "disassembly" | "taint_tracking" | "control_flow" | "data_flow" | "symbolic_execution" | "vulnerability_detection" | "obfuscation_analysis" | "crypto_analysis" | "api_analysis">;
236
- /** Supported file formats */
237
- supportedFormats: string[];
238
- /** Supported architectures */
239
- supportedArchitectures: string[];
240
- /** Performance characteristics */
241
- performance: {
242
- speed: "fast" | "medium" | "slow";
243
- accuracy: "low" | "medium" | "high";
244
- memoryUsage: "low" | "medium" | "high";
245
- };
246
- /** Resource requirements */
247
- requirements: {
248
- minMemoryMB?: number;
249
- maxTimeoutMS?: number;
250
- externalDependencies?: string[];
251
- };
252
- }
253
- /**
254
- * Analysis task for orchestration
255
- */
256
- export interface AnalysisTask {
257
- /** Unique task identifier */
258
- id: string;
259
- /** Target engine for this task */
260
- engine: AnalysisEngine;
261
- /** Analysis phase this task belongs to */
262
- phase: AnalysisPhase;
263
- /** Task priority (higher = more urgent) */
264
- priority: number;
265
- /** Dependencies on other tasks */
266
- dependencies: string[];
267
- /** Input data for the task */
268
- input: {
269
- /** Binary data to analyze */
270
- data: Uint8Array;
271
- /** Previous analysis results to build upon */
272
- previousResults?: any[];
273
- /** Task-specific configuration */
274
- config?: any;
275
- };
276
- /** Task metadata */
277
- metadata: {
278
- description?: string;
279
- estimatedDuration?: number;
280
- maxRetries?: number;
281
- timeout?: number;
282
- };
283
- }
284
- /**
285
- * Task execution result
286
- */
287
- export interface TaskResult {
288
- /** Task identifier */
289
- taskId: string;
290
- /** Engine that executed the task */
291
- engine: AnalysisEngine;
292
- /** Execution status */
293
- status: "success" | "failed" | "timeout" | "cancelled";
294
- /** Result data */
295
- result?: any;
296
- /** Execution metrics */
297
- metrics: {
298
- startTime: number;
299
- endTime: number;
300
- memoryUsed?: number;
301
- cpuTime?: number;
302
- };
303
- /** Any errors that occurred */
304
- error?: string;
305
- /** Confidence in the result */
306
- confidence: number;
307
- }
308
- /**
309
- * Orchestration strategy for coordinating multiple engines
310
- */
311
- export interface OrchestrationStrategy {
312
- /** Strategy name */
313
- name: string;
314
- /** Strategy description */
315
- description: string;
316
- /** Phase execution order */
317
- phaseOrder: AnalysisPhase[];
318
- /** Engine selection rules for each phase */
319
- engineRules: {
320
- [phase in AnalysisPhase]?: {
321
- /** Preferred engines in order */
322
- preferred: AnalysisEngine[];
323
- /** Engines to avoid */
324
- exclude?: AnalysisEngine[];
325
- /** Conditional engine selection */
326
- conditions?: Array<{
327
- condition: string;
328
- engine: AnalysisEngine;
329
- priority: number;
330
- }>;
331
- };
332
- };
333
- /** Task scheduling configuration */
334
- scheduling: {
335
- /** Maximum concurrent tasks */
336
- maxConcurrency: number;
337
- /** Task timeout in milliseconds */
338
- defaultTimeout: number;
339
- /** Retry policy */
340
- retryPolicy: {
341
- maxRetries: number;
342
- retryDelay: number;
343
- backoffMultiplier: number;
344
- };
345
- };
346
- /** Result correlation rules */
347
- correlation: {
348
- /** Enable cross-engine result correlation */
349
- enabled: boolean;
350
- /** Correlation algorithms to use */
351
- algorithms: Array<"similarity" | "overlap" | "consensus" | "weighted">;
352
- /** Confidence weighting by engine */
353
- engineWeights: {
354
- [engine in AnalysisEngine]?: number;
355
- };
356
- };
357
- }
358
- /**
359
- * Hybrid orchestration configuration
360
- */
361
- export interface HybridConfig {
362
- /** Selected orchestration strategy */
363
- strategy: OrchestrationStrategy;
364
- /** Available engines and their configurations */
365
- engines: {
366
- [engine in AnalysisEngine]?: {
367
- enabled: boolean;
368
- config?: any;
369
- priority?: number;
370
- };
371
- };
372
- /** Global analysis settings */
373
- global: {
374
- /** Maximum total analysis time */
375
- maxAnalysisTime: number;
376
- /** Resource limits */
377
- resourceLimits: {
378
- maxMemoryMB: number;
379
- maxConcurrentEngines: number;
380
- maxTotalTasks: number;
381
- };
382
- /** HIPAA compliance settings */
383
- hipaaCompliance?: {
384
- enabled: boolean;
385
- auditAllTasks: boolean;
386
- sanitizeResults: boolean;
387
- };
388
- };
389
- /** Result aggregation settings */
390
- aggregation: {
391
- /** How to combine results from multiple engines */
392
- method: "union" | "intersection" | "weighted" | "consensus";
393
- /** Minimum confidence threshold for final results */
394
- confidenceThreshold: number;
395
- /** Whether to include intermediate results */
396
- includeIntermediateResults: boolean;
397
- };
398
- }
399
- /**
400
- * Hybrid analysis result aggregating multiple engines
401
- */
402
- export interface HybridAnalysisResult {
403
- /** Analysis session identifier */
404
- sessionId: string;
405
- /** Overall analysis success */
406
- success: boolean;
407
- /** Total analysis time */
408
- totalTime: number;
409
- /** Results from individual engines */
410
- engineResults: {
411
- [engine in AnalysisEngine]?: TaskResult[];
412
- };
413
- /** Aggregated findings */
414
- findings: {
415
- /** Static analysis results */
416
- static?: {
417
- functions: any[];
418
- matches: any[];
419
- metadata: any;
420
- };
421
- /** Dynamic taint analysis results */
422
- taint?: TaintAnalysisResult;
423
- /** Cross-engine correlations */
424
- correlations?: Array<{
425
- engines: AnalysisEngine[];
426
- finding: any;
427
- confidence: number;
428
- consensus: number;
429
- }>;
430
- };
431
- /** Analysis statistics */
432
- statistics: {
433
- enginesUsed: AnalysisEngine[];
434
- tasksExecuted: number;
435
- tasksSuccessful: number;
436
- tasksFailed: number;
437
- averageTaskTime: number;
438
- memoryPeak: number;
439
- };
440
- /** Recommendations based on analysis */
441
- recommendations?: Array<{
442
- type: "security" | "performance" | "analysis";
443
- severity: "info" | "warning" | "critical";
444
- message: string;
445
- evidence?: any;
446
- }>;
447
- /** Analysis metadata */
448
- meta: {
449
- configUsed: HybridConfig;
450
- strategyUsed: string;
451
- timestamp: number;
452
- version: string;
453
- };
454
- }
455
- /**
456
- * Interface for engines that support taint tracking
457
- */
458
- export interface TaintCapableEngine {
459
- /** Configure taint tracking */
460
- configureTaint(config: TaintConfig): Promise<void>;
461
- /** Perform taint analysis */
462
- performTaintAnalysis(data: Uint8Array): Promise<TaintAnalysisResult>;
463
- /** Get current taint state */
464
- getTaintState(): Promise<{
465
- memory: TaintedMemory[];
466
- registers: TaintedRegister[];
467
- }>;
468
- /** Add custom taint source */
469
- addTaintSource(address: string, source: TaintSource, label?: Partial<TaintLabel>): Promise<void>;
470
- /** Check if location is tainted */
471
- isTainted(address: string): Promise<boolean>;
472
- }
473
- /**
474
- * Interface for the hybrid orchestrator
475
- */
476
- export interface HybridOrchestrator {
477
- /** Configure the orchestrator */
478
- configure(config: HybridConfig): Promise<void>;
479
- /** Register an analysis engine */
480
- registerEngine(engine: AnalysisEngine, instance: any, capabilities: EngineCapability): Promise<void>;
481
- /** Execute hybrid analysis */
482
- analyze(data: Uint8Array): Promise<HybridAnalysisResult>;
483
- /** Get available engines and their capabilities */
484
- getAvailableEngines(): Promise<EngineCapability[]>;
485
- /** Cancel ongoing analysis */
486
- cancelAnalysis(sessionId: string): Promise<boolean>;
487
- /** Get analysis progress */
488
- getProgress(sessionId: string): Promise<{
489
- phase: AnalysisPhase;
490
- completedTasks: number;
491
- totalTasks: number;
492
- estimatedTimeRemaining: number;
493
- }>;
494
- }
495
- export type { BinaryNinjaOptions, DecompilationMatch, DecompilationResult, DecompilationScanner, FunctionAnalysis, GhidraOptions, } from "./decompilation";