rulest - GPU-accelerated Hashcat Rules Extractor and Optimizer

A1131

Active member
Feedback: 6 / 0 / 0
Joined
Dec 30, 2019
Messages
1,683
Reaction score
3,008
Credits
5,832
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.

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/rulest
hashpwn thread: https://forum.hashpwn.net/topic/170/rulest-gpu-rules-extractor
 

A1131

Active member
Feedback: 6 / 0 / 0
Joined
Dec 30, 2019
Messages
1,683
Reaction score
3,008
Credits
5,832

Frequency vs Coverage​

RuleRecovered (%)SizeEfficiency
rulest_heap.150000.rule37.96%1500010.2531
rulest.greedy.150000.rule36.12%1500000.2408
rulest_heap.50000.rule33.02%500010.6604
rulest.greedy.50000.rule29.78%500000.5956
rulest_heap.25000.rule29.59%250011.1836
rulest.freq.150000.rule28.02%1500000.1868
rulest.greedy.25000.rule24.91%250000.9964
rulest_heap.10000.rule24.72%100012.4718
rulest_heap.5000.rule20.98%50014.1952
rulest.freq.50000.rule20.25%500000.4050
rulest.greedy.10000.rule19.71%100001.9710
rulest.freq.25000.rule15.99%250000.6396
rulest_heap.1500.rule15.46%150110.2998
rulest.freq.10000.rule11.44%100001.1440
rulest.greedy.1500.rule10.45%15006.9667
rulest_heap.250.rule9.00%25135.8566
rulest.greedy.250.rule5.06%25020.2400
rulest_heap.64.rule4.77%6573.3846
rulest.freq.1500.rule4.61%15003.0733
rulest.freq.250.rule1.73%2506.9200

Full benchmark: https://docs.google.com/spreadsheet...e0FHnHGCEI/edit?gid=1513384572#gid=1513384572
 
Top