Lesson 03 Command Structure & Parameters
Theme:

Command Structure & Parameters

Complete reference for hashcat command-line syntax, flags, and arguments.

General Syntax

Every hashcat invocation follows the same pattern:

hashcat [options...] hash_file [dictionary|mask|dictionary+mask]

The binary name varies by platform:

Options (flags) can appear in any order before or after the hash file, but the positional arguments — hash file, wordlists, and masks — must appear in the correct sequence after all flags.

Hash Type: -m

The -m parameter specifies the hash algorithm hashcat should use for cracking. Using the wrong mode is the most common beginner mistake — hashcat will run but find nothing because it is interpreting the hash bytes incorrectly.

Common Hash Modes

ModeAlgorithmTypical Source
0MD5Web application databases, legacy systems
100SHA-1Older web applications, Git commits
1000NTLMWindows SAM database, Active Directory
1800sha512crypt ($6$)Linux /etc/shadow
2500WPA/WPA2 (legacy)Wi-Fi capture files
3200bcrypt ($2*$)Modern web applications
13100Kerberos TGS-REP (RC4)Kerberoasting attacks
22000WPA-PBKDF2-PMKID+EAPOLModern Wi-Fi auditing
Tip: Use hashcat --example-hashes to see sample hashes for every supported mode. This helps you identify unknown hash types by visual comparison. There are over 350 supported modes.

Attack Mode: -a

The -a parameter selects the attack strategy. It determines what kind of arguments (wordlists, masks, or both) must follow the hash file.

ModeNameRequired ArgumentsDescription
0 Dictionary (Straight) wordlist Tests every word from a wordlist against the hashes. The most common starting point.
1 Combinator wordlist1 wordlist2 Combines every word from list 1 with every word from list 2. Good for compound passwords like "sunflower123".
3 Mask (Brute-force) mask pattern Generates candidates based on character position masks. Full brute-force when using ?a (all printable).
6 Hybrid: Dictionary + Mask wordlist mask Appends mask-generated characters to each dictionary word. Example: password + ?d?d = password00 through password99.
7 Hybrid: Mask + Dictionary mask wordlist Prepends mask-generated characters to each dictionary word. Example: ?d?d + password = 00password through 99password.

Mask Charsets

In mask mode (-a 3), each position in the mask is defined by a charset placeholder:

PlaceholderCharactersCount
?lLowercase letters (a-z)26
?uUppercase letters (A-Z)26
?dDigits (0-9)10
?sSpecial characters (!@#$... etc.)33
?aAll printable ASCII (?l?u?d?s)95
?bAll bytes (0x00-0xff)256

Output Control

Output File: -o

By default, hashcat displays cracked hashes on screen and stores them in hashcat.potfile. Use -o to write results to a specific file:

hashcat -m 0 -a 0 -o cracked.txt hashes.txt rockyou.txt

Output Format: --outfile-format

Controls what gets written to the output file. The value is a bitmask — add the numbers together to combine fields:

ValueContentExample Output
1Hash only5f4dcc3b5aa765d61d8327deb882cf99
2Plain password onlypassword
3Hash:password (default)5f4dcc3b...cf99:password
4Hex-encoded plain70617373776f7264
5Hash:hex-plain5f4dcc3b...cf99:70617373776f7264

Rules: -r

Rules transform dictionary words on the fly, dramatically expanding the effective wordlist without increasing file size. Each rule defines a mutation (capitalize, reverse, append digits, leet-speak substitution, etc.).

# Single rule file
hashcat -m 0 -a 0 -r rules/best64.rule hashes.txt rockyou.txt

# Multiple rule files (chained — every combination is applied)
hashcat -m 0 -a 0 -r rules/best64.rule -r rules/toggles1.rule hashes.txt rockyou.txt
Included rule files: Hashcat ships with several rule files in the rules/ directory. Popular choices: best64.rule (64 most effective rules), rockyou-30000.rule (30k rules extracted from the RockYou breach), d3ad0ne.rule (34k+ aggressive rules).

Incremental Mode: -i

By default, a mask attack only tries candidates matching the exact mask length. The -i (or --increment) flag tells hashcat to iterate through increasing lengths.

# Without increment: only tries 8-character combinations
hashcat -m 0 -a 3 hashes.txt ?a?a?a?a?a?a?a?a

# With increment: tries 1-char, 2-char, ..., up to 8-char
hashcat -m 0 -a 3 -i hashes.txt ?a?a?a?a?a?a?a?a

# With min/max bounds: tries 4-char through 8-char only
hashcat -m 0 -a 3 -i --increment-min 4 --increment-max 8 hashes.txt ?a?a?a?a?a?a?a?a
Warning: Incremental mode with ?a (all printable) generates enormous keyspaces. An 8-character ?a mask alone produces 95^8 = 6.6 quadrillion candidates. Adding lengths 4 through 7 adds another ~7.4 billion on top. Always set --increment-min to skip trivially short passwords.

Workload Profile: -w

The workload profile controls how aggressively hashcat uses the GPU. Higher values yield faster cracking but may cause system unresponsiveness.

LevelNameUse Case
1LowDesktop use — system remains responsive
2DefaultGeneral purpose
3HighDedicated cracking rig, headless server
4NightmareMaximum throughput; may freeze GUI/display

Device Selection: -D

By default, hashcat auto-detects available compute devices. Use -D to restrict to specific device types:

Use -I (or --backend-info) to list all detected devices and their capabilities before choosing.

Session Management

Long-running attacks can be paused and resumed using sessions.

# Start a named session
hashcat --session audit_q1 -m 1000 -a 0 hashes.txt rockyou.txt

# Pause: press 'c' during execution (checkpoint), or 'q' to quit gracefully

# Resume the session later
hashcat --session audit_q1 --restore

Session data is stored in *.restore and *.induct files in the hashcat working directory. Without --session, hashcat uses a default session name and will refuse to start a second instance.

Complete Command Examples

Example 1: Simple MD5 dictionary attack

hashcat -m 0 -a 0 -o results.txt hashes.txt rockyou.txt

Cracks MD5 hashes using the RockYou wordlist. Results written as hash:password pairs to results.txt.

Example 2: NTLM mask attack with incremental mode

hashcat -m 1000 -a 3 -o results.txt --session mysession \
  --increment --increment-min 4 --increment-max 8 \
  -w 3 hashes.txt ?a?a?a?a?a?a?a?a

Cracks NTLM hashes using a brute-force mask attack. Tries all printable character combinations from 4 to 8 characters. Uses high workload on GPU. Named session allows pause/resume.

Example 3: Dictionary + rules attack on SHA-512

hashcat -m 1800 -a 0 -r rules/best64.rule -o cracked.txt \
  -w 2 shadow_hashes.txt rockyou.txt

Cracks Linux shadow file hashes (sha512crypt) using a dictionary with the best64 rule file applied to each word.

Example 4: Hybrid dictionary + mask

hashcat -m 0 -a 6 -o results.txt hashes.txt rockyou.txt ?d?d?d?d

Appends 4 digits to every word in the dictionary. Catches patterns like password2024 or admin1234.

Example 5: Combinator attack

hashcat -m 0 -a 1 -o results.txt hashes.txt words1.txt words2.txt

Concatenates every word from words1.txt with every word from words2.txt. Effective for compound passwords.

Quick Reference Card

FlagPurposeCommon Values
-mHash type0 (MD5), 1000 (NTLM), 1800 (SHA-512), 3200 (bcrypt)
-aAttack mode0 (dict), 1 (combo), 3 (mask), 6 (hybrid d+m), 7 (hybrid m+d)
-oOutput fileAny file path
--outfile-formatOutput content1 (hash), 2 (plain), 3 (hash:plain)
-rRules filerules/best64.rule, rules/rockyou-30000.rule
-iIncremental mode(no value — it is a toggle)
--increment-minMin length for increment1–N
--increment-maxMax length for increment1–N
-wWorkload profile1 (low), 2 (default), 3 (high), 4 (nightmare)
-DDevice type1 (CPU), 2 (GPU), 1,2 (both)
--sessionSession nameAny string
--restoreResume session(no value — it is a toggle)

Further Reading