pompelmi 0.35.5 → 1.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.
Files changed (135) hide show
  1. package/.claude/settings.local.json +45 -0
  2. package/LICENSE +12 -18
  3. package/README.md +174 -181
  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 +37 -0
  9. package/src/ClamdScanner.js +81 -0
  10. package/src/InstallerCommand.js +11 -0
  11. package/src/config.js +22 -0
  12. package/src/constants.js +3 -0
  13. package/src/favicon.ico +0 -0
  14. package/src/grapefruit.png +0 -0
  15. package/src/index.js +5 -0
  16. package/test_out.txt +74 -0
  17. package/CHANGELOG.md +0 -71
  18. package/dist/pompelmi.audit.cjs +0 -128
  19. package/dist/pompelmi.audit.cjs.map +0 -1
  20. package/dist/pompelmi.audit.esm.js +0 -107
  21. package/dist/pompelmi.audit.esm.js.map +0 -1
  22. package/dist/pompelmi.browser.cjs +0 -1549
  23. package/dist/pompelmi.browser.cjs.map +0 -1
  24. package/dist/pompelmi.browser.esm.js +0 -1523
  25. package/dist/pompelmi.browser.esm.js.map +0 -1
  26. package/dist/pompelmi.cjs +0 -2591
  27. package/dist/pompelmi.cjs.map +0 -1
  28. package/dist/pompelmi.esm.js +0 -2525
  29. package/dist/pompelmi.esm.js.map +0 -1
  30. package/dist/pompelmi.hooks.cjs +0 -75
  31. package/dist/pompelmi.hooks.cjs.map +0 -1
  32. package/dist/pompelmi.hooks.esm.js +0 -72
  33. package/dist/pompelmi.hooks.esm.js.map +0 -1
  34. package/dist/pompelmi.policy-packs.cjs +0 -240
  35. package/dist/pompelmi.policy-packs.cjs.map +0 -1
  36. package/dist/pompelmi.policy-packs.esm.js +0 -232
  37. package/dist/pompelmi.policy-packs.esm.js.map +0 -1
  38. package/dist/pompelmi.quarantine.cjs +0 -317
  39. package/dist/pompelmi.quarantine.cjs.map +0 -1
  40. package/dist/pompelmi.quarantine.esm.js +0 -293
  41. package/dist/pompelmi.quarantine.esm.js.map +0 -1
  42. package/dist/pompelmi.react.cjs +0 -1580
  43. package/dist/pompelmi.react.cjs.map +0 -1
  44. package/dist/pompelmi.react.esm.js +0 -1553
  45. package/dist/pompelmi.react.esm.js.map +0 -1
  46. package/dist/types/audit.d.ts +0 -84
  47. package/dist/types/browser-index.d.ts +0 -29
  48. package/dist/types/config.d.ts +0 -143
  49. package/dist/types/engines/dynamic-taint.d.ts +0 -102
  50. package/dist/types/engines/hybrid-orchestrator.d.ts +0 -65
  51. package/dist/types/engines/hybrid-taint-integration.d.ts +0 -129
  52. package/dist/types/engines/taint-policies.d.ts +0 -84
  53. package/dist/types/hipaa-compliance.d.ts +0 -110
  54. package/dist/types/hooks.d.ts +0 -89
  55. package/dist/types/index.d.ts +0 -29
  56. package/dist/types/magic.d.ts +0 -7
  57. package/dist/types/node/scanDir.d.ts +0 -30
  58. package/dist/types/policy-packs.d.ts +0 -98
  59. package/dist/types/policy.d.ts +0 -12
  60. package/dist/types/presets.d.ts +0 -72
  61. package/dist/types/quarantine/index.d.ts +0 -18
  62. package/dist/types/quarantine/storage.d.ts +0 -77
  63. package/dist/types/quarantine/types.d.ts +0 -78
  64. package/dist/types/quarantine/workflow.d.ts +0 -97
  65. package/dist/types/react-index.d.ts +0 -13
  66. package/dist/types/risk.d.ts +0 -18
  67. package/dist/types/scan/remote.d.ts +0 -12
  68. package/dist/types/scan.d.ts +0 -17
  69. package/dist/types/scanners/common-heuristics.d.ts +0 -14
  70. package/dist/types/scanners/zip-bomb-guard.d.ts +0 -9
  71. package/dist/types/scanners/zipTraversalGuard.d.ts +0 -19
  72. package/dist/types/src/audit.d.ts +0 -84
  73. package/dist/types/src/browser-index.d.ts +0 -29
  74. package/dist/types/src/config.d.ts +0 -143
  75. package/dist/types/src/engines/dynamic-taint.d.ts +0 -102
  76. package/dist/types/src/engines/hybrid-orchestrator.d.ts +0 -65
  77. package/dist/types/src/engines/hybrid-taint-integration.d.ts +0 -129
  78. package/dist/types/src/engines/taint-policies.d.ts +0 -84
  79. package/dist/types/src/hipaa-compliance.d.ts +0 -110
  80. package/dist/types/src/hooks.d.ts +0 -89
  81. package/dist/types/src/index.d.ts +0 -29
  82. package/dist/types/src/magic.d.ts +0 -7
  83. package/dist/types/src/node/scanDir.d.ts +0 -30
  84. package/dist/types/src/policy-packs.d.ts +0 -98
  85. package/dist/types/src/policy.d.ts +0 -12
  86. package/dist/types/src/presets.d.ts +0 -72
  87. package/dist/types/src/quarantine/index.d.ts +0 -18
  88. package/dist/types/src/quarantine/storage.d.ts +0 -77
  89. package/dist/types/src/quarantine/types.d.ts +0 -78
  90. package/dist/types/src/quarantine/workflow.d.ts +0 -97
  91. package/dist/types/src/react-index.d.ts +0 -13
  92. package/dist/types/src/risk.d.ts +0 -18
  93. package/dist/types/src/scan/remote.d.ts +0 -12
  94. package/dist/types/src/scan.d.ts +0 -17
  95. package/dist/types/src/scanners/common-heuristics.d.ts +0 -14
  96. package/dist/types/src/scanners/zip-bomb-guard.d.ts +0 -11
  97. package/dist/types/src/scanners/zipTraversalGuard.d.ts +0 -19
  98. package/dist/types/src/stream.d.ts +0 -10
  99. package/dist/types/src/types/decompilation.d.ts +0 -96
  100. package/dist/types/src/types/taint-tracking.d.ts +0 -495
  101. package/dist/types/src/types.d.ts +0 -48
  102. package/dist/types/src/useFileScanner.d.ts +0 -15
  103. package/dist/types/src/utils/advanced-detection.d.ts +0 -21
  104. package/dist/types/src/utils/batch-scanner.d.ts +0 -62
  105. package/dist/types/src/utils/cache-manager.d.ts +0 -95
  106. package/dist/types/src/utils/export.d.ts +0 -51
  107. package/dist/types/src/utils/performance-metrics.d.ts +0 -68
  108. package/dist/types/src/utils/threat-intelligence.d.ts +0 -96
  109. package/dist/types/src/validate.d.ts +0 -7
  110. package/dist/types/src/verdict.d.ts +0 -2
  111. package/dist/types/src/yara/browser.d.ts +0 -7
  112. package/dist/types/src/yara/index.d.ts +0 -17
  113. package/dist/types/src/yara/node.d.ts +0 -2
  114. package/dist/types/src/yara/remote.d.ts +0 -10
  115. package/dist/types/src/yara-bridge.d.ts +0 -3
  116. package/dist/types/src/zip.d.ts +0 -13
  117. package/dist/types/stream.d.ts +0 -10
  118. package/dist/types/types/decompilation.d.ts +0 -96
  119. package/dist/types/types/taint-tracking.d.ts +0 -495
  120. package/dist/types/types.d.ts +0 -48
  121. package/dist/types/useFileScanner.d.ts +0 -15
  122. package/dist/types/utils/advanced-detection.d.ts +0 -21
  123. package/dist/types/utils/batch-scanner.d.ts +0 -62
  124. package/dist/types/utils/cache-manager.d.ts +0 -95
  125. package/dist/types/utils/export.d.ts +0 -51
  126. package/dist/types/utils/performance-metrics.d.ts +0 -68
  127. package/dist/types/utils/threat-intelligence.d.ts +0 -96
  128. package/dist/types/validate.d.ts +0 -7
  129. package/dist/types/verdict.d.ts +0 -2
  130. package/dist/types/yara/browser.d.ts +0 -7
  131. package/dist/types/yara/index.d.ts +0 -17
  132. package/dist/types/yara/node.d.ts +0 -2
  133. package/dist/types/yara/remote.d.ts +0 -10
  134. package/dist/types/yara-bridge.d.ts +0 -3
  135. package/dist/types/zip.d.ts +0 -13
@@ -1,48 +0,0 @@
1
- /** Shared types for Pompelmi */
2
- export type Verdict = "clean" | "suspicious" | "malicious";
3
- export interface YaraMatch {
4
- rule: string;
5
- namespace?: string;
6
- tags?: string[];
7
- meta?: Record<string, unknown>;
8
- }
9
- export * from "./types/decompilation";
10
- export interface Match {
11
- rule: string;
12
- severity?: "info" | "low" | "medium" | "high" | "critical" | "suspicious" | "malicious";
13
- meta?: Record<string, unknown>;
14
- }
15
- export interface FileInfo {
16
- name?: string;
17
- mimeType?: string;
18
- size?: number;
19
- sha256?: string;
20
- }
21
- export type ScanContext = {
22
- filename?: string;
23
- mimeType?: string;
24
- size?: number;
25
- };
26
- export type ScanFn = (input: Uint8Array, ctx?: ScanContext) => Promise<Match[]> | Match[];
27
- export type Scanner = ScanFn | {
28
- name?: string;
29
- scan: ScanFn;
30
- };
31
- interface BaseReport {
32
- verdict: Verdict;
33
- matches: YaraMatch[];
34
- reasons?: string[];
35
- file?: FileInfo;
36
- durationMs?: number;
37
- error?: string;
38
- ok: boolean;
39
- truncated?: boolean;
40
- timedOut?: boolean;
41
- engine?: string;
42
- }
43
- export interface NormalScanReport extends BaseReport {
44
- }
45
- export interface StreamScanReport extends BaseReport {
46
- }
47
- export type ScanReport = NormalScanReport | StreamScanReport;
48
- export type Uint8ArrayLike = Uint8Array | ArrayBufferView;
@@ -1,15 +0,0 @@
1
- import type { ScanReport } from "./types";
2
- /**
3
- * React Hook: handles <input type="file" onChange> with validation + scanning.
4
- */
5
- export declare function useFileScanner(): {
6
- results: {
7
- file: File;
8
- report: ScanReport;
9
- }[];
10
- errors: {
11
- file: File;
12
- error: string;
13
- }[];
14
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
15
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * Advanced threat detection utilities
3
- * @module utils/advanced-detection
4
- */
5
- import type { Match } from "../types";
6
- /**
7
- * Enhanced polyglot file detection
8
- * Detects files that can be interpreted as multiple formats
9
- */
10
- export declare function detectPolyglot(bytes: Uint8Array): Match[];
11
- /**
12
- * Detect obfuscated JavaScript/VBScript
13
- */
14
- export declare function detectObfuscatedScripts(bytes: Uint8Array): Match[];
15
- /**
16
- * Enhanced nested archive detection with depth limits
17
- */
18
- export declare function analyzeNestedArchives(bytes: Uint8Array, maxDepth?: number): {
19
- depth: number;
20
- hasExcessiveNesting: boolean;
21
- };
@@ -1,62 +0,0 @@
1
- /**
2
- * Batch scanning with concurrency control
3
- * @module utils/batch-scanner
4
- */
5
- import { type ScanOptions } from "../scan";
6
- import type { ScanContext, ScanReport } from "../types";
7
- export interface BatchScanOptions extends Omit<ScanOptions, "ctx"> {
8
- /** Maximum concurrent scans (default: 5) */
9
- concurrency?: number;
10
- /** Callback for individual scan completion */
11
- onProgress?: (completed: number, total: number, report: ScanReport) => void;
12
- /** Callback for individual scan error */
13
- onError?: (error: Error, index: number) => void;
14
- /** Continue scanning on error (default: true) */
15
- continueOnError?: boolean;
16
- /** Enable result caching (default: false) */
17
- enableCache?: boolean;
18
- }
19
- export interface BatchScanResult {
20
- /** All scan reports (null for failed scans if continueOnError is true) */
21
- reports: (ScanReport | null)[];
22
- /** Number of successful scans */
23
- successCount: number;
24
- /** Number of failed scans */
25
- errorCount: number;
26
- /** Total duration in milliseconds */
27
- totalDurationMs: number;
28
- /** Errors encountered (if continueOnError is true) */
29
- errors: Array<{
30
- index: number;
31
- error: Error;
32
- }>;
33
- }
34
- export interface ScanTask {
35
- /** File content to scan */
36
- content: Uint8Array;
37
- /** Scan context (filename, mime type, etc.) */
38
- context?: ScanContext;
39
- }
40
- /**
41
- * Batch file scanner with concurrency control and progress tracking
42
- */
43
- export declare class BatchScanner {
44
- private readonly options;
45
- constructor(options?: BatchScanOptions);
46
- /**
47
- * Scan multiple files with controlled concurrency
48
- */
49
- scanBatch(tasks: ScanTask[]): Promise<BatchScanResult>;
50
- /**
51
- * Scan files from File objects (browser environment)
52
- */
53
- scanFiles(files: File[]): Promise<BatchScanResult>;
54
- /**
55
- * Scan files from file paths (Node.js environment)
56
- */
57
- scanFilePaths(filePaths: string[]): Promise<BatchScanResult>;
58
- }
59
- /**
60
- * Quick helper for batch scanning with default options
61
- */
62
- export declare function batchScan(tasks: ScanTask[], options?: BatchScanOptions): Promise<BatchScanResult>;
@@ -1,95 +0,0 @@
1
- /**
2
- * Cache management system for scan results
3
- * @module utils/cache-manager
4
- */
5
- import type { ScanReport } from "../types";
6
- export interface CacheEntry {
7
- /** Scan report */
8
- report: ScanReport;
9
- /** Timestamp when cached */
10
- timestamp: number;
11
- /** Number of times this entry was accessed */
12
- accessCount: number;
13
- }
14
- export interface CacheOptions {
15
- /** Maximum cache size in number of entries (default: 1000) */
16
- maxSize?: number;
17
- /** Time-to-live in milliseconds (default: 3600000 = 1 hour) */
18
- ttl?: number;
19
- /** Enable LRU eviction (default: true) */
20
- enableLRU?: boolean;
21
- /** Enable cache statistics (default: false) */
22
- enableStats?: boolean;
23
- }
24
- export interface CacheStats {
25
- /** Total cache hits */
26
- hits: number;
27
- /** Total cache misses */
28
- misses: number;
29
- /** Current cache size */
30
- size: number;
31
- /** Hit rate percentage */
32
- hitRate: number;
33
- /** Total evictions */
34
- evictions: number;
35
- }
36
- /**
37
- * LRU cache for scan results with TTL support
38
- */
39
- export declare class ScanCacheManager {
40
- private cache;
41
- private readonly maxSize;
42
- private readonly ttl;
43
- private readonly enableLRU;
44
- private readonly enableStats;
45
- private stats;
46
- constructor(options?: CacheOptions);
47
- /**
48
- * Generate cache key from file content
49
- */
50
- private generateKey;
51
- /**
52
- * Check if cache entry is still valid
53
- */
54
- private isValid;
55
- /**
56
- * Evict oldest or least-used entry when cache is full
57
- */
58
- private evict;
59
- /**
60
- * Store scan result in cache
61
- */
62
- set(content: Uint8Array, report: ScanReport, preset?: string): void;
63
- /**
64
- * Retrieve scan result from cache
65
- */
66
- get(content: Uint8Array, preset?: string): ScanReport | null;
67
- /**
68
- * Check if result exists in cache
69
- */
70
- has(content: Uint8Array, preset?: string): boolean;
71
- /**
72
- * Clear entire cache
73
- */
74
- clear(): void;
75
- /**
76
- * Remove expired entries
77
- */
78
- prune(): number;
79
- /**
80
- * Get cache statistics
81
- */
82
- getStats(): CacheStats;
83
- /**
84
- * Get current cache size
85
- */
86
- get size(): number;
87
- }
88
- /**
89
- * Get or create the default cache instance
90
- */
91
- export declare function getDefaultCache(options?: CacheOptions): ScanCacheManager;
92
- /**
93
- * Reset the default cache instance
94
- */
95
- export declare function resetDefaultCache(): void;
@@ -1,51 +0,0 @@
1
- /**
2
- * Export utilities for scan results
3
- * @module utils/export
4
- */
5
- import type { ScanReport } from "../types";
6
- export type ExportFormat = "json" | "csv" | "markdown" | "html" | "sarif";
7
- export interface ExportOptions {
8
- /** Include detailed match information */
9
- includeDetails?: boolean;
10
- /** Include performance metrics if available */
11
- includeMetrics?: boolean;
12
- /** Pretty print JSON output */
13
- prettyPrint?: boolean;
14
- }
15
- /**
16
- * Export scan results to various formats
17
- */
18
- export declare class ScanResultExporter {
19
- /**
20
- * Export to JSON format
21
- */
22
- toJSON(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
23
- /**
24
- * Export to CSV format
25
- */
26
- toCSV(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
27
- /**
28
- * Export to Markdown format
29
- */
30
- toMarkdown(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
31
- /**
32
- * Export to SARIF format (Static Analysis Results Interchange Format)
33
- * Useful for CI/CD integration
34
- */
35
- toSARIF(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
36
- /**
37
- * Export to HTML format
38
- */
39
- toHTML(reports: ScanReport | ScanReport[], options?: ExportOptions): string;
40
- /**
41
- * Export to specified format
42
- */
43
- export(reports: ScanReport | ScanReport[], format: ExportFormat, options?: ExportOptions): string;
44
- private escapeCsv;
45
- private escapeHtml;
46
- private formatBytes;
47
- }
48
- /**
49
- * Quick export helper
50
- */
51
- export declare function exportScanResults(reports: ScanReport | ScanReport[], format: ExportFormat, options?: ExportOptions): string;
@@ -1,68 +0,0 @@
1
- /**
2
- * Performance monitoring utilities for pompelmi scans
3
- * @module utils/performance-metrics
4
- */
5
- export interface PerformanceMetrics {
6
- /** Total scan duration in milliseconds */
7
- totalDurationMs: number;
8
- /** Time spent in heuristic analysis */
9
- heuristicsDurationMs?: number;
10
- /** Time spent in YARA scanning */
11
- yaraDurationMs?: number;
12
- /** Time spent reading/preparing file */
13
- prepDurationMs?: number;
14
- /** Throughput in bytes per second */
15
- throughputBps?: number;
16
- /** Number of bytes scanned */
17
- bytesScanned: number;
18
- /** Timestamp when scan started */
19
- startedAt: number;
20
- /** Timestamp when scan completed */
21
- completedAt: number;
22
- }
23
- export interface ScanStatistics {
24
- /** Total number of scans performed */
25
- totalScans: number;
26
- /** Number of clean files */
27
- cleanCount: number;
28
- /** Number of suspicious files */
29
- suspiciousCount: number;
30
- /** Number of malicious files */
31
- maliciousCount: number;
32
- /** Average scan duration */
33
- avgDurationMs: number;
34
- /** Average throughput */
35
- avgThroughputBps: number;
36
- /** Total bytes scanned */
37
- totalBytesScanned: number;
38
- }
39
- /**
40
- * Track performance metrics for a scan operation
41
- */
42
- export declare class PerformanceTracker {
43
- private startTime;
44
- private checkpoints;
45
- constructor();
46
- /**
47
- * Mark a checkpoint in the scan process
48
- */
49
- checkpoint(name: string): void;
50
- /**
51
- * Get duration since start or since a specific checkpoint
52
- */
53
- getDuration(since?: string): number;
54
- /**
55
- * Generate final metrics report
56
- */
57
- getMetrics(bytesScanned: number): PerformanceMetrics;
58
- }
59
- /**
60
- * Aggregate statistics from multiple scan reports
61
- */
62
- export declare function aggregateScanStats(reports: Array<{
63
- verdict: string;
64
- durationMs?: number;
65
- file?: {
66
- size?: number;
67
- };
68
- }>): ScanStatistics;
@@ -1,96 +0,0 @@
1
- /**
2
- * Threat intelligence integration and enhanced detection
3
- * @module utils/threat-intelligence
4
- */
5
- import type { ScanReport } from "../types";
6
- export interface ThreatIntelligenceSource {
7
- /** Source name */
8
- name: string;
9
- /** Check if hash is known malicious */
10
- checkHash: (hash: string) => Promise<ThreatInfo | null>;
11
- }
12
- export interface ThreatInfo {
13
- /** Threat level (0-100) */
14
- threatLevel: number;
15
- /** Threat category */
16
- category: string;
17
- /** Source of the intelligence */
18
- source: string;
19
- /** Additional metadata */
20
- metadata?: Record<string, unknown>;
21
- /** Detection timestamp */
22
- detectedAt?: Date;
23
- }
24
- export interface EnhancedScanReport {
25
- /** Threat intelligence findings */
26
- threatIntel?: ThreatInfo[];
27
- /** File hash (SHA-256) */
28
- fileHash?: string;
29
- /** Risk score (0-100) */
30
- riskScore?: number;
31
- /** Include all properties from ScanReport */
32
- verdict: import("../types").Verdict;
33
- matches: import("../types").YaraMatch[];
34
- reasons?: string[];
35
- file?: import("../types").FileInfo;
36
- durationMs?: number;
37
- error?: string;
38
- ok: boolean;
39
- truncated?: boolean;
40
- timedOut?: boolean;
41
- engine?: string;
42
- }
43
- /**
44
- * Built-in threat intelligence - known malware hashes
45
- * In production, this would connect to real threat intel APIs
46
- */
47
- export declare class LocalThreatIntelligence implements ThreatIntelligenceSource {
48
- name: string;
49
- private knownThreats;
50
- constructor();
51
- private initializeKnownThreats;
52
- checkHash(hash: string): Promise<ThreatInfo | null>;
53
- /**
54
- * Add a known threat to the local database
55
- */
56
- addThreat(hash: string, info: ThreatInfo): void;
57
- /**
58
- * Remove a threat from the local database
59
- */
60
- removeThreat(hash: string): boolean;
61
- /**
62
- * Get all known threats
63
- */
64
- getAllThreats(): Map<string, ThreatInfo>;
65
- }
66
- /**
67
- * Threat intelligence aggregator
68
- */
69
- export declare class ThreatIntelligenceAggregator {
70
- private sources;
71
- constructor(sources?: ThreatIntelligenceSource[]);
72
- /**
73
- * Add a threat intelligence source
74
- */
75
- addSource(source: ThreatIntelligenceSource): void;
76
- /**
77
- * Check file hash against all sources
78
- */
79
- checkHash(hash: string): Promise<ThreatInfo[]>;
80
- /**
81
- * Enhance scan report with threat intelligence
82
- */
83
- enhanceScanReport(content: Uint8Array, report: ScanReport): Promise<EnhancedScanReport>;
84
- /**
85
- * Calculate overall risk score based on scan results and threat intel
86
- */
87
- private calculateRiskScore;
88
- }
89
- /**
90
- * Create default threat intelligence aggregator
91
- */
92
- export declare function createThreatIntelligence(): ThreatIntelligenceAggregator;
93
- /**
94
- * Helper to get file hash
95
- */
96
- export declare function getFileHash(content: Uint8Array): string;
@@ -1,7 +0,0 @@
1
- /**
2
- * Validates a File by MIME type and size (max 5 MB).
3
- */
4
- export declare function validateFile(file: File): {
5
- valid: boolean;
6
- error?: string;
7
- };
@@ -1,2 +0,0 @@
1
- import type { Verdict, YaraMatch } from "./types";
2
- export declare function mapMatchesToVerdict(matches?: YaraMatch[]): Verdict;
@@ -1,7 +0,0 @@
1
- import type { YaraEngine } from "./index";
2
- /**
3
- * Engine YARA lato browser — NO WASM.
4
- * È un no-op sicuro: non produce match e non richiede dipendenze native.
5
- * Se vuoi YARA in browser senza WASM, userai un adapter remoto (vedi step successivo).
6
- */
7
- export declare function createBrowserEngine(): Promise<YaraEngine>;
@@ -1,17 +0,0 @@
1
- export interface YaraMatch {
2
- rule: string;
3
- tags?: string[];
4
- }
5
- export interface YaraCompiled {
6
- scan(data: Uint8Array): Promise<YaraMatch[]>;
7
- scanFile?: (filePath: string) => Promise<YaraMatch[]>;
8
- scanFileAsync?: (filePath: string) => Promise<YaraMatch[]>;
9
- }
10
- export interface YaraEngine {
11
- compile(rulesSource: string): Promise<YaraCompiled>;
12
- compileFile?: (rulesPath: string) => Promise<YaraCompiled>;
13
- }
14
- export declare function createYaraEngine(): Promise<YaraEngine>;
15
- export declare function createYaraScannerFromRules(rulesSource: string): Promise<YaraCompiled>;
16
- export declare function createYaraScannerFromFile(rulesPath: string): Promise<YaraCompiled>;
17
- export { createRemoteEngine } from "./remote";
@@ -1,2 +0,0 @@
1
- import type { YaraEngine } from "./index";
2
- export declare function createNodeEngine(): Promise<YaraEngine>;
@@ -1,10 +0,0 @@
1
- import type { YaraEngine } from "./index";
2
- export interface RemoteEngineOptions {
3
- endpoint: string;
4
- headers?: Record<string, string>;
5
- rulesField?: string;
6
- fileField?: string;
7
- mode?: "multipart" | "json-base64";
8
- rulesAsBase64?: boolean;
9
- }
10
- export declare function createRemoteEngine(opts: RemoteEngineOptions): Promise<YaraEngine>;
@@ -1,3 +0,0 @@
1
- export declare function createScanner(rulesPath?: string): {
2
- scan(bytes: Uint8Array): Promise<unknown>;
3
- };
@@ -1,13 +0,0 @@
1
- export type ZipBudget = {
2
- maxEntries: number;
3
- maxDepth: number;
4
- maxTotalUncompressed: number;
5
- maxPerEntryUncompressed: number;
6
- maxCompressionRatio: number;
7
- };
8
- export type ZipEntry = {
9
- path: string;
10
- depth: number;
11
- data: Uint8Array;
12
- };
13
- export declare function iterateZip(buffer: Uint8Array, budget: ZipBudget, depth?: number): AsyncGenerator<ZipEntry>;
@@ -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[];