/** * @fileoverview Malware Detection Module - Main Entry Point * @module rules/malware * * Enterprise-grade malware detection system with: * - Multi-pattern detection (Regex, AST, Heuristic, Semantic) * - Dynamic scoring with MITRE ATT&CK integration * - 60+ comprehensive rules across 7 categories * - Support for 13 programming languages * - ReDoS protection and timeout safeguards * - Obfuscation detection and entropy analysis * * @example * ```typescript * import { MalwareRuleEngine, createMalwareEngine } from './rules/malware'; * * // Create engine with all rules * const engine = createMalwareEngine(); * * // Analyze code * const findings = await engine.analyze(code, { * filePath: 'suspicious.js', * language: 'javascript' * }); * * // Check results * findings.forEach(finding => { * console.log(`${finding.severity}: ${finding.ruleName}`); * console.log(`Score: ${finding.score.totalScore}/100`); * }); * ``` */ import { Rule } from '../../types'; export * from './types'; export { calculateEntropy, analyzeEntropyByLine, normalizeCode, detectObfuscationLevel, detectAntiDebugging, detectEnvironmentChecks, safeRegexMatch, extractSnippet, analyzeBase64Content, extractSuspiciousStrings } from './utils'; export { SCORE_THRESHOLDS, ENTROPY_THRESHOLDS, LIMITS, OBFUSCATION_INDICATORS, SUSPICIOUS_HOSTS, CRYPTO_INDICATORS, DANGEROUS_FUNCTIONS, MITRE_TECHNIQUES } from './constants'; export { MalwareScoreCalculator } from './scoring'; export { MalwareRuleEngine, PatternMatcher, createDefaultEngine, quickScan, EngineOptions } from './engine'; import { backdoorRules as newBackdoorRules } from './categories/backdoors'; import { cryptominerRules as newCryptominerRules } from './categories/cryptominers'; import { keyloggerRules as newKeyloggerRules } from './categories/keyloggers'; import { exfiltrationRules as newExfiltrationRules } from './categories/exfiltration'; import { obfuscationRules as newObfuscationRules } from './categories/obfuscation'; import { loaderRules as newLoaderRules } from './categories/loaders'; import { networkRules as newNetworkRules } from './categories/network'; export { newBackdoorRules as backdoorRulesV2, newCryptominerRules as cryptominerRulesV2, newKeyloggerRules as keyloggerRulesV2, newExfiltrationRules as exfiltrationRulesV2, newObfuscationRules as obfuscationRulesV2, newLoaderRules as loaderRulesV2, newNetworkRules as networkRulesV2 }; import { MalwareRule } from './types'; /** * All malware detection rules (60+ rules) */ export declare const allMalwareRules: MalwareRule[]; /** * Critical severity rules only */ export declare const criticalRules: MalwareRule[]; /** * High confidence rules only */ export declare const highConfidenceRules: MalwareRule[]; import { MalwareRuleEngine, EngineOptions } from './engine'; /** * Create a fully configured malware detection engine with all rules * * @param options - Optional analysis configuration * @returns Configured MalwareRuleEngine instance * * @example * ```typescript * const engine = createMalwareEngine({ * enableHeuristics: true, * enableAstAnalysis: true, * minConfidence: 0.5 * }); * ``` */ export declare function createMalwareEngine(options?: Partial): MalwareRuleEngine; /** * Create an engine with only critical severity rules * * @param options - Optional analysis configuration * @returns MalwareRuleEngine with critical rules only */ export declare function createCriticalOnlyEngine(options?: Partial): MalwareRuleEngine; /** * Create an engine with custom rule subset * * @param rules - Array of rules to include * @param options - Optional analysis configuration * @returns MalwareRuleEngine with specified rules */ export declare function createCustomEngine(rules: MalwareRule[], options?: Partial): MalwareRuleEngine; import { MalwareFinding } from './types'; /** * Quick malware scan with default settings * * @param code - Code to analyze * @param language - Programming language * @returns Scan results with malicious status * * @example * ```typescript * const result = await scanForMalware(suspiciousCode, 'javascript'); * if (result.isMalicious) { * console.log(`Malware detected! Score: ${result.score}`); * result.findings.forEach(f => console.log(f.ruleName)); * } * ``` */ export declare function scanForMalware(code: string, language?: string): Promise<{ isMalicious: boolean; score: number; severity: 'critical' | 'high' | 'medium' | 'low' | 'clean'; findings: MalwareFinding[]; summary: { totalFindings: number; criticalCount: number; highCount: number; }; }>; /** * Check if code contains specific malware category * * @param code - Code to analyze * @param category - Malware category to check * @param language - Programming language * @returns True if category detected * * @example * ```typescript * const hasBackdoor = await hasMalwareCategory(code, 'backdoor', 'javascript'); * ``` */ export declare function hasMalwareCategory(code: string, category: 'backdoor' | 'cryptominer' | 'keylogger' | 'exfiltration' | 'obfuscation' | 'loader' | 'network', language?: string): Promise; /** * Analyze code and generate detailed report * * @param code - Code to analyze * @param filePath - File path for context * @param language - Programming language * @returns Detailed analysis report */ export declare function generateMalwareReport(code: string, filePath: string, language?: string): Promise<{ filePath: string; language?: string; timestamp: Date; findings: MalwareFinding[]; summary: { totalFindings: number; bySeverity: Record; byCategory: Record; highestScore: number; isMalicious: boolean; }; mitreAttack: Array<{ tactic: string; technique: string; count: number; }>; recommendations: string[]; }>; export declare const MALWARE_MODULE_INFO: { version: string; totalRules: number; categories: string[]; supportedLanguages: string[]; features: string[]; }; /** * Get module information */ export declare function getModuleInfo(): typeof MALWARE_MODULE_INFO; /** * Export all malware rules (LEGACY COMPATIBILITY) * For backward compatibility with existing codebase */ export declare const malwareRules: Rule[]; declare const _default: { MalwareRuleEngine: typeof MalwareRuleEngine; createMalwareEngine: typeof createMalwareEngine; createCriticalOnlyEngine: typeof createCriticalOnlyEngine; createCustomEngine: typeof createCustomEngine; allMalwareRules: MalwareRule[]; backdoorRulesV2: MalwareRule[]; cryptominerRules: Rule[]; keyloggerRules: Rule[]; exfiltrationRules: Rule[]; obfuscationRules: Rule[]; loaderRules: Rule[]; networkRules: Rule[]; scanForMalware: typeof scanForMalware; hasMalwareCategory: typeof hasMalwareCategory; generateMalwareReport: typeof generateMalwareReport; getModuleInfo: typeof getModuleInfo; malwareRules: Rule[]; backdoorRules: Rule[]; MALWARE_MODULE_INFO: { version: string; totalRules: number; categories: string[]; supportedLanguages: string[]; features: string[]; }; }; export default _default; //# sourceMappingURL=index.d.ts.map