Commands / Passwords and hashes

Passwords and hashes

hashcat

Also hash cracker, gpu cracker, password recovery, -m mode

Cracks a raw hash fast by hashing wordlist candidates in a chosen mode, with rules and masks.

hashcat is the speed cracker for raw hashes. Unlike john, it does not autodetect: you give it the hash type as a mode with -m (0 md5, 100 SHA-1, 1400 SHA-256, 500 md5crypt, 1800 sha512crypt), which is why you run hashid first. -a 0 is a straight wordlist attack; -r FILE applies mangling rules to each word (c capitalises, $2$0$2$4 appends 2024), so a short profiled list covers the shapes people use. A fast, unsalted hash of a weak password falls in seconds; the defence is a slow, salted hash (bcrypt, Argon2). In a container with no GPU, add --force to run on CPU and -O -w 1 to keep it light; --show prints what has cracked.

hashcat command usage

hashcat -m MODE -a 0 [-O] [-w 1] [--force] HASHFILE WORDLIST [-r RULES]
hashcat -m MODE --show HASHFILE

Options

-m 100
the hash mode: 0 md5, 100 SHA-1, 1400 SHA-256, 500 md5crypt (pick it from hashid)
-a 0
attack mode 0 — a straight wordlist attack
-r mangle.rule
apply the mangling rules in this file to every candidate word
--force
run even without a GPU (CPU cracking, needed in a container)
--show
print the plaintext already cracked for this hash file

hashcat examples

hashcat -m 100 -a 0 -O -w 1 --force dbadmin.hash profiled.txt -r mangle.rule
Cracks a SHA-1 hash on CPU with a profiled wordlist and mangling rules.
da61475c…:Meridian2024!
hashcat -m 0 -a 0 --force admin.hashes profiled.txt
Tries the list against hashes as md5 — and rejects any that are not 32 hex with a token-length error.
hashcat -m 1400 --force --show finance.hash
Prints the plaintext already recovered for a SHA-256 hash.

Pitfalls

  • hashcat tries exactly the mode you give: the wrong -m throws a Token length exception and loads nothing, so identify the hash (hashid) first.
  • It caches cracks in a pot file: a solved hash shows as cracked on the next run rather than re-cracking — use --show, or a fresh --potfile-path.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab