A high-performance Rust application for scanning process memory using advanced techniques like Aho-Corasick algorithms and parallel processing.
This scanner specializes in:
1. Efficient memory region querying with WinAPI
2. Multi-phase scanning algorithm optimization
3. Parallel processing with Rayon
4. Pattern matching with Aho-Corasick automata
5. Detailed performance profiling
Project architecture:
src/
├── main.rs # Application entry point and orchestration
├── profiler.rs # Performance measurement and reporting
├── process_reader.rs # WinAPI memory access utilities
└── scanning.rs # Core scanning algorithms
graph TD
A[Query Memory Regions] --> B[Find Type Objects]
B --> C[Find Class Candidates]
C --> D[Validate Candidates]
D --> E[Find Highest Instance]
E --> F[Report Results]
-
Memory Region Identification
Queries all readable memory regions using WinAPI'sVirtualQueryEx -
Type Object Detection
Scans for Python type objects by identifying self-referential pointers -
Candidate Screening
Fast parallel scanning using pointer comparison heuristics -
Class Validation
String-based verification with batch I/O optimization -
Instance Detection
Aho-Corasick pattern matching to locate highest memory instance
- Blazing Fast Scanning
Processes memory at GB/s speeds using 4MB chunks - Multi-threaded Processing
Utilizes all CPU cores with Rayon parallel iterators - WinAPI Memory Access
Direct process memory reading withReadProcessMemory - Accurate Pattern Matching
Aho-Corasick algorithm for efficient byte scanning - Detailed Profiling
Nanosecond-ll timing and memory throughput reporting - Error Resilience
Continues through inaccessible memory regions
# Clone repository
git clone https://github.com/yourusername/memory-scanner.git
cd memory-scanner
# Build release version (optimized)
cargo build --release
# Run scanner
.\target\release\memory-scanner.exeEdit constants in main.rs:
const _PID: u32 = 6876; // Target Process ID
const CHUNK_SIZE: usize = 4 * 1024 * 1024; // Memory chunk size
const MAX_STRING_LEN: usize = 256; // Maximum string length--- Profiling Report ---
Total run time: 2.147s
Total memory scanned: 6.37 GB
Throughput: 2.96 GB/s
Pass Timings:
- Regions Query............ 0.038s (1.8%)
- Type Object Scanning..... 0.847s (39.5%)
- Candidate Collection..... 0.932s (43.4%)
- Validation.............. 1.423s (66.3%)
- Instance Detection...... 0.791s (36.8%)
Starting Memory Process Scanner
Using PID: 6876
Successfully opened process handle: 0x201
Querying memory regions...
-> Found 87 readable regions (2.11 GB)
Pass 1: Finding type objects...
-> Found 312 type objects in 0.847s
Pass 2: Finding class candidates...
-> Collected 1427 candidates in 0.932s
Validating candidates...
-> Confirmed 3 target classes in 1.423s
Pass 3: Finding highest instance...
-> Located highest instance at 0x7FFD4C8DB140
Scan completed in 2.147s
rayon- Parallel processingaho-corasick- Optimized pattern matchingwinapi- Windows system bindings
MIT License - Free for educational and personal use