There is a shorter way for one common case. If what you want is a mask around a word, attack mode 12 does that directly and you do not need a rule file at all. Generating rules with maskprocessor is still worth knowing for everything else, which is what the rest of this page covers.


Using maskprocessor to generate rules

maskprocessor can be used in various ways. This page covers creating rules for hashcat-legacy (CPU) or hashcat (OpenCL CPU/GPU).

Creating rules

Suppose you want to create rules that add 3 digits after each word in your dictionary and save them in a file called “append_3_digits.rule”.

By hand

$ vi append_3_digits.rule
$0 $0 $0
$0 $0 $1
$0 $0 $2
$0 $0 $3
$0 $0 $4
$0 $0 $5
$0 $0 $6
$0 $0 $7
$0 $0 $8
$0 $0 $9
$0 $1 $0
$0 $1 $1
and so on...

Creating these rules by hand would be tedious and time-consuming.

Using maskprocessor

$ ./mp64.bin -o append_3_digits.rule '$?d $?d $?d'

maskprocessor allows you to easily and quickly generate rule files.

Syntax:

  • $ is the function to append a char
  • ?d is the digits charset

Example Commands

Here are some example commands to enable you to generate common rules locally on your own computer.

  • Copy the appropriate set of commands for your operating system (32/64) bit.
32-bit

mp32.exe -1 0123456789 "^?1^?1^?1" -o Prefix-0-999.rule
mp32.exe -1 0123456789 "l^?1^?1^?1" -o Lower-All-Prefix-0-999.rule
mp32.exe -1 0123456789 "c^?1^?1^?1" -o Upper-First-Prefix-0-999.rule
mp32.exe -1 0123456789 "u^?1^?1^?1" -o Upper-All-Prefix-0-999.rule
mp32.exe -1 0123456789 "d^?1^?1^?1" -o Double-Word-Prefix-0-999.rule

mp32.exe -1 0123456789 "$?1$?1$?1" -o Suffix-0-999.rule
mp32.exe -1 0123456789 "l$?1$?1$?1" -o Lower-All-Suffix-0-999.rule
mp32.exe -1 0123456789 "c$?1$?1$?1" -o Upper-First-Suffix-0-999.rule
mp32.exe -1 0123456789 "u$?1$?1$?1" -o Upper-All-Suffix-0-999.rule
mp32.exe -1 0123456789 "d$?1$?1$?1" -o Double-Word-Suffix-0-999.rule

mp32.exe -1 0123456789 "^?1^?1^?1^?1" -o Prefix-0-9999.rule
mp32.exe -1 0123456789 "l^?1^?1^?1^?1" -o Lower-All-Prefix-0-9999.rule
mp32.exe -1 0123456789 "c^?1^?1^?1^?1" -o Upper-First-Prefix-0-9999.rule
mp32.exe -1 0123456789 "u^?1^?1^?1^?1" -o Upper-All-Prefix-0-9999.rule
mp32.exe -1 0123456789 "d^?1^?1^?1^?1" -o Double-Word-Prefix-0-9999.rule

mp32.exe -1 0123456789 "$?1$?1$?1$?1" -o Suffix-0-9999.rule
mp32.exe -1 0123456789 "l$?1$?1$?1$?1" -o Lower-All-Suffix-0-9999.rule
mp32.exe -1 0123456789 "c$?1$?1$?1$?1" -o Upper-First-Suffix-0-9999.rule
mp32.exe -1 0123456789 "u$?1$?1$?1$?1" -o Upper-All-Suffix-0-9999.rule
mp32.exe -1 0123456789 "d$?1$?1$?1$?1" -o Double-Word-Suffix-0-9999.rule



64-bit

mp64.exe -1 0123456789 "^?1^?1^?1" -o Prefix-0-999.rule
mp64.exe -1 0123456789 "l^?1^?1^?1" -o Lower-All-Prefix-0-999.rule
mp64.exe -1 0123456789 "c^?1^?1^?1" -o Upper-First-Prefix-0-999.rule
mp64.exe -1 0123456789 "u^?1^?1^?1" -o Upper-All-Prefix-0-999.rule
mp64.exe -1 0123456789 "d^?1^?1^?1" -o Double-Word-Prefix-0-999.rule

mp64.exe -1 0123456789 "$?1$?1$?1" -o Suffix-0-999.rule
mp64.exe -1 0123456789 "l$?1$?1$?1" -o Lower-All-Suffix-0-999.rule
mp64.exe -1 0123456789 "c$?1$?1$?1" -o Upper-First-Suffix-0-999.rule
mp64.exe -1 0123456789 "u$?1$?1$?1" -o Upper-All-Suffix-0-999.rule
mp64.exe -1 0123456789 "d$?1$?1$?1" -o Double-Word-Suffix-0-999.rule

mp64.exe -1 0123456789 "^?1^?1^?1^?1" -o Prefix-0-9999.rule
mp64.exe -1 0123456789 "l^?1^?1^?1^?1" -o Lower-All-Prefix-0-9999.rule
mp64.exe -1 0123456789 "c^?1^?1^?1^?1" -o Upper-First-Prefix-0-9999.rule
mp64.exe -1 0123456789 "u^?1^?1^?1^?1" -o Upper-All-Prefix-0-9999.rule
mp64.exe -1 0123456789 "d^?1^?1^?1^?1" -o Double-Word-Prefix-0-9999.rule

mp64.exe -1 0123456789 "$?1$?1$?1$?1" -o Suffix-0-9999.rule
mp64.exe -1 0123456789 "l$?1$?1$?1$?1" -o Lower-All-Suffix-0-9999.rule
mp64.exe -1 0123456789 "c$?1$?1$?1$?1" -o Upper-First-Suffix-0-9999.rule
mp64.exe -1 0123456789 "u$?1$?1$?1$?1" -o Upper-All-Suffix-0-9999.rule
mp64.exe -1 0123456789 "d$?1$?1$?1$?1" -o Double-Word-Suffix-0-9999.rule
  • Paste them into a text file and name it “Hashcat Rule Generator.cmd”.
  • Place this file in the same directory as maskprocessor and double-click it.

This generates a set of commonly used password modifications. Each rule file is named to identify its function.

Limitation

On Windows, enclose the ^ character in quotes to insert it. ^ is an escape character in the Windows command shell and will not be printed unless quoted.

Example:

mp32.exe -1 0123456789 "^"?1"^"?1"^"?1 -o "Prefix 0-999.rule"

NOT

mp32.exe -1 0123456789  ^?1^?1^?1 -o "Prefix 0-999.rule"
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain