Skip to content

A113L/concentrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CONCENTRATOR v3.0

Unified Hashcat Rule Processor — Extract, generate, and process hashcat password rules with GPU acceleration, Markov chain modeling, and functional minimization.


Features

  • 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 Formatsline (compact) or expanded (operator + args separated by spaces)
  • Interactive & CLI Modes — Guided wizard or full argument-driven usage

Requirements

Python

Python 3.8+

Core (standard library — no install needed)

sys, os, re, argparse, math, itertools, multiprocessing, tempfile, random, datetime, threading, collections, typing

Optional (install for full functionality)

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.


Installation

git clone https://github.com/youruser/concentrator.git cd concentrator pip install pyopencl numpy tqdm psutil # optional but recommended

Usage

Interactive Mode

Run without arguments to launch the guided wizard:

python concentrator.py

CLI Mode

python concentrator.py [OPTIONS] FILE_OR_DIRECTORY [FILE_OR_DIRECTORY ...] 

One mode flag is required.


Modes

-e / --extract-rules — Extraction Mode

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

-g / --generate-combo — Combinatorial Mode

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

-gm / --generate-markov-rules — Markov Mode

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

-p / --process-rules — Processing Mode

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

Global Options

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

Output Formats

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 

Input Files

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.


Supported Hashcat Rule Operators

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 *

Examples

# 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

Memory Considerations

  • 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 / -d with -p mode to spill intermediate data to disk.
  • Use --in-memory to force full in-RAM processing (fastest, but watch your available memory).
  • Install psutil to enable memory monitoring.

License

MIT License. See LICENSE for details.

Credits

About

Unified Hashcat Rule Processor

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages