Unified Hashcat Rule Processor — Extract, generate, and process hashcat password rules with GPU acceleration, Markov chain modeling, and functional minimization.
- OpenCL GPU Acceleration — Batch rule validation offloaded to GPU for high throughput
- Three Processing Modes — Extraction, Combinatorial generation, and Markov-based generation
- Hashcat Rule Engine Simulation — Full CPU-side implementation of hashcat's rule operators
- Functional Minimization — Deduplicate rules that produce identical outputs
- Levenshtein Distance Filtering — Remove near-duplicate rules by edit distance
- Memory Safety — Monitors RAM/swap usage with configurable thresholds and disk-spill mode
- Multiple Output Formats —
line(compact) orexpanded(operator + args separated by spaces) - Interactive & CLI Modes — Guided wizard or full argument-driven usage
Python 3.8+
sys, os, re, argparse, math, itertools, multiprocessing, tempfile, random, datetime, threading, collections, typing
| Package | Purpose | Install |
|---|---|---|
pyopencl | GPU-accelerated rule validation | pip install pyopencl |
numpy | Array operations for GPU buffers | pip install numpy |
tqdm | Progress bars | pip install tqdm |
psutil | RAM/swap monitoring | pip install psutil |
All optional packages degrade gracefully — the tool runs on pure Python if none are installed.
git clone https://github.com/youruser/concentrator.git cd concentrator pip install pyopencl numpy tqdm psutil # optional but recommendedRun without arguments to launch the guided wizard:
python concentrator.pypython concentrator.py [OPTIONS] FILE_OR_DIRECTORY [FILE_OR_DIRECTORY ...] One mode flag is required.
Extract the most frequent (or statistically weighted) rules from existing rule files.
# Extract top 5000 rules by frequency python concentrator.py -e -t 5000 rules/ # Extract top 10000 rules sorted by Markov sequence probability python concentrator.py -e -t 10000 -s rules/*.rule| Flag | Default | Description |
|---|---|---|
-t, --top-rules | 10000 | Number of top rules to extract |
-s, --statistical-sort | off | Sort by Markov probability instead of raw frequency |
Generate rules by exhaustively combining the most common operators up to a target count.
# Generate 50k rules using operator combinations of length 2–4 python concentrator.py -g -n 50000 -l 2 4 hashcat/rules/| Flag | Default | Description |
|---|---|---|
-n, --combo-target | 100000 | Target number of rules to generate |
-l, --combo-length | 1 3 | Min and max operator-chain length |
Generate statistically probable rules using a Markov chain model trained on the input rule files.
# Generate 10k Markov rules of length 1–5 python concentrator.py -gm -gt 10000 -ml 1 5 hashcat/rules/| Flag | Default | Description |
|---|---|---|
-gt, --generate-target | 10000 | Target number of rules to generate |
-ml, --markov-length | 1 3 | Min and max rule length |
Load, validate, deduplicate, and functionally minimize existing rule sets interactively.
# Process rules using disk mode to avoid RAM exhaustion python concentrator.py -p -d rules/ # Process with Levenshtein distance filtering (max dist 3) python concentrator.py -p -ld 3 rules/| Flag | Default | Description |
|---|---|---|
-d, --use-disk | off | Spill to disk instead of keeping everything in RAM |
-ld, --levenshtein-max-dist | 2 | Max edit distance for near-duplicate filtering |
| Flag | Default | Description |
|---|---|---|
-ob, --output-base-name | concentrator_output | Base filename for output (no extension) |
-f, --output-format | line | Output format: line or expanded |
-m, --max-length | 31 | Maximum rule token length to process |
--temp-dir | system default | Directory to write temporary files |
--in-memory | off | Process entirely in RAM (overrides disk mode) |
--no-gpu | off | Disable OpenCL GPU acceleration |
line — Standard hashcat rule format, one rule per line:
i3li4ei5y li6po7io8e D2i41o50 D1$9$6$0 o6g$1$5 D1i3hi4o expanded — Each operator and its arguments separated by spaces, one rule per line:
i3l i4e i5y l i6p o7i o8e D2 i41 o50 D1 $9 $6 $0 o6g $1 $5 D1 i3h i4o Concentrator recursively scans directories up to 3 levels deep for files with these extensions:
.rule .rules .hr .hashcat .txt .lst
You can pass individual files, directories, or a mix of both.
Concentrator validates and simulates the full hashcat rule operator set, including:
| Category | Operators |
|---|---|
| Case | l u c C t T |
| Reverse / Duplicate | r d f p q |
| Rotation | { } |
| Trim | [ ] D x O |
| Insert / Overwrite | i o ^ $ |
| Substitute / Delete | s @ ! . , |
| Extend | z Z y Y |
| Memory | M X 4 6 |
| Arithmetic | + - L R |
| Conditions / Length | < > _ = % |
| Leet / Replace | e E 3 |
| Misc | : k K Q * |
# Extract top 5000 rules (GPU off) from a glob python concentrator.py -e -t 5000 --no-gpu rules/*.rule # Generate 100k combinatorial rules, output in expanded format python concentrator.py -g -n 100000 -l 1 3 -f expanded hashcat/rules/ -ob my_rules # Markov generation with custom length range python concentrator.py -gm -gt 20000 -ml 2 4 hashcat/rules/ # Process and minimize rules, writing temp files to /tmp/scratch python concentrator.py -p -d --temp-dir /tmp/scratch rules/ # Interactive mode python concentrator.py- At startup, Concentrator prints current RAM and swap usage.
- If RAM usage exceeds 85%, a warning is raised and you are prompted before continuing.
- Use
--use-disk/-dwith-pmode to spill intermediate data to disk. - Use
--in-memoryto force full in-RAM processing (fastest, but watch your available memory). - Install
psutilto enable memory monitoring.
MIT License. See LICENSE for details.