ThreatFlux String Analysis
A comprehensive Rust library for advanced string analysis and categorization, designed for security applications including malware analysis, threat hunting, and forensic investigations.
Features
- String Tracking: Track string occurrences across multiple files with full context
- Automatic Categorization: Identify URLs, paths, commands, registry keys, and more
- Entropy Analysis: Detect potentially encoded or encrypted strings
- Suspicious Pattern Detection: Built-in patterns for malware and threat indicators
- Statistical Analysis: Generate insights about string distributions and relationships
- Extensible Architecture: Add custom patterns and categorization rules
- High Performance: Optimized for analyzing large volumes of strings
- Serialization Support: Full serde support for all data structures
Quick Start
Add this to your Cargo.toml
:
[]
= "0.1.0"
Basic usage:
use ;
Advanced Usage
Custom Pattern Matching
use ;
let mut provider = empty;
// Add custom pattern for API keys
provider.add_pattern?;
Custom Categorization
use ;
let mut categorizer = new;
categorizer.add_rule?;
Filtering and Searching
use StringFilter;
// Filter for high-entropy suspicious strings
let filter = StringFilter ;
let filtered_stats = tracker.get_statistics;
Use Cases
Malware Analysis
- Extract and categorize strings from binary files
- Identify C2 servers, encryption keys, and malicious commands
- Track string patterns across malware families
Security Log Analysis
- Process security logs to identify IOCs
- Detect repeated attack patterns
- Correlate suspicious activities
Threat Hunting
- Search for specific threat indicators
- Analyze string entropy for obfuscation detection
- Track evolution of threats over time
Forensic Investigations
- Extract and analyze strings from memory dumps
- Categorize artifacts by type
- Build timelines of string occurrences
Architecture
The library is built with a modular, trait-based architecture:
- StringAnalyzer: Core trait for analyzing strings
- Categorizer: Trait for categorizing strings
- PatternProvider: Trait for managing detection patterns
- StringTracker: Main tracking and analysis engine
This design allows for easy extension and customization for specific use cases.
Examples
See the examples/
directory for complete examples:
basic_usage.rs
: Introduction to the librarysecurity_log_analysis.rs
: Analyzing security logscustom_patterns.rs
: Creating domain-specific patterns
Performance
The library is optimized for high-volume string analysis:
- Efficient string deduplication
- Configurable memory limits
- Fast pattern matching with compiled regexes
- Minimal allocations in hot paths
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
This project is licensed under the MIT license.