A1131
Active member
GPU-Accelerated Rule Mining for Hash Cracking Wordlists (rulest)
rulest is a highly optimized, GPU-compatible Hashcat rules engine. It discovers effective word-transformation rules and rule chains that convert words from a base dictionary into words from a target dictionary, using PyOpenCL for massive parallel acceleration on NVIDIA, AMD, or Intel GPUs.
The pipeline is organized into clear stages:
hashpwn thread: https://forum.hashpwn.net/topic/170/rulest-gpu-rules-extractor
rulest is a highly optimized, GPU-compatible Hashcat rules engine. It discovers effective word-transformation rules and rule chains that convert words from a base dictionary into words from a target dictionary, using PyOpenCL for massive parallel acceleration on NVIDIA, AMD, or Intel GPUs.
Overview
Rule-based attacks remain one of the most effective techniques against password hashes. This tool automates discovery of high-value Hashcat-compatible rules and multi-step rule chains (e.g. l $1 T0) that achieve high hit rates against a specific target wordlist. The extracted rules can be used directly with Hashcat or similar tools.The pipeline is organized into clear stages:
- STAGE 0 — Token-Strip (optional): Heuristically extracts rules by stripping common prefixes/suffixes and leetspeak patterns from target words.
- STAGE 1 — Single Rule Search: Exhaustive GPU sweep of atomic (single) rules against the base wordlist.
- STAGE S — Seed Extraction: Runs built-in numeric/pattern seed families and any user-supplied seed rules.
- STAGE 2 — Rule Chain Search: Breadth-first exploration of multi-step rule chains up to a configurable maximum depth.
- STAGE 3 — Genetic Algorithm (optional): Evolves promising rule chains via a genetic algorithm (population, elite selection, crossover, mutation).
- Post-processing: Signature-based minimization + rule selection (frequency ranking or exact greedy CELF marginal-coverage selection).
Key Features
- OpenCL / multi-GPU acceleration — word transformations run in parallel on one or more GPUs; supports device selection by index, name, or “all”.
- Full chain extraction — outputs the complete sequence of rules responsible for each hit (not just the final transformed word).
- Bloom-filter target matching with exact verification kernels for high throughput and low false-positive impact.
- Configurable search depth and per-depth chain limits.
- Genetic evolution of rule chains (--genetic).
- Advanced rule selection:
- Frequency (raw hit count)
- Greedy CELF (lazy-greedy) that maximizes distinct target-word recovery under a budget, with optional cost-aware scoring.
- Token-strip heuristics for rapid generation of candidate rules from the target set itself.
- Profiling (--profile / RULEST_PROFILE=1) with per-stage wall-clock and GPU-phase breakdowns.
- Memory-efficient data handling (uint8/uint16 buffers, sharded bloom filters, careful VRAM management).
- Hashcat rule compatibility including position encoding beyond single digits and support for the majority of common rule operators.
Requirements
- Python 3.x
- numpy
- pyopencl (requires OpenCL runtime drivers for your GPU vendor)
- tqdm
Usage
Code:
python3 run_rulest.py <base_wordlist> <target_wordlist> [options]
Links
Github: https://github.com/A113L/rulesthashpwn thread: https://forum.hashpwn.net/topic/170/rulest-gpu-rules-extractor