91 lines
No EOL
3 KiB
TypeScript
91 lines
No EOL
3 KiB
TypeScript
// =============================================================================
|
|
// FEATURE EXTRACTOR EXPORTS (TypeScript)
|
|
// =============================================================================
|
|
// Central export hub for all feature extraction functions used in threat scoring
|
|
// This module provides a clean interface for accessing all feature extractors
|
|
|
|
// Network-based feature extractors
|
|
export {
|
|
extractIPReputationFeatures,
|
|
extractNetworkAnomalyFeatures
|
|
} from './network.js';
|
|
|
|
// Behavioral feature extractors
|
|
export {
|
|
extractRequestPatternFeatures,
|
|
extractSessionBehaviorFeatures,
|
|
getSessionId
|
|
} from './behavioral.js';
|
|
|
|
// Content-based feature extractors
|
|
export {
|
|
extractPayloadFeatures,
|
|
normalizeWAFSignals
|
|
} from './content.js';
|
|
|
|
// Temporal feature extractors
|
|
export {
|
|
extractTimingFeatures,
|
|
extractVelocityFeatures
|
|
} from './temporal.js';
|
|
|
|
// Header analysis features
|
|
export {
|
|
extractHeaderFeatures
|
|
} from '../analyzers/headers.js';
|
|
|
|
// =============================================================================
|
|
// UTILITY FUNCTIONS
|
|
// =============================================================================
|
|
|
|
/**
|
|
* Gets a list of all available feature extractor categories
|
|
* @returns Array of feature extractor category names
|
|
*/
|
|
export function getFeatureExtractorCategories(): readonly string[] {
|
|
return ['network', 'behavioral', 'content', 'temporal', 'headers'] as const;
|
|
}
|
|
|
|
/**
|
|
* Validates that all required feature extractors are available
|
|
* @returns True if all extractors are properly loaded
|
|
*/
|
|
export function validateFeatureExtractors(): boolean {
|
|
try {
|
|
// Basic validation - just check if we can access the module
|
|
// More detailed validation can be done when the modules are converted to TypeScript
|
|
return true;
|
|
} catch (error) {
|
|
console.error('Feature extractor validation failed:', error);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// =============================================================================
|
|
// TYPE DEFINITIONS
|
|
// =============================================================================
|
|
// Basic type definitions for feature extractor functions until modules are converted
|
|
|
|
export type FeatureExtractorFunction = (...args: any[]) => Promise<unknown> | unknown;
|
|
|
|
export interface FeatureExtractorCategories {
|
|
readonly network: readonly string[];
|
|
readonly behavioral: readonly string[];
|
|
readonly content: readonly string[];
|
|
readonly temporal: readonly string[];
|
|
readonly headers: readonly string[];
|
|
}
|
|
|
|
/**
|
|
* Gets the available feature extractors by category
|
|
* @returns Object with arrays of extractor names by category
|
|
*/
|
|
export function getFeatureExtractorsByCategory(): FeatureExtractorCategories {
|
|
return {
|
|
network: ['extractIPReputationFeatures', 'extractNetworkAnomalyFeatures'],
|
|
behavioral: ['extractRequestPatternFeatures', 'extractSessionBehaviorFeatures', 'getSessionId'],
|
|
content: ['extractPayloadFeatures', 'normalizeWAFSignals'],
|
|
temporal: ['extractTimingFeatures', 'extractVelocityFeatures'],
|
|
headers: ['extractHeaderFeatures']
|
|
} as const;
|
|
}
|