hashcat & John
hashcat and John the Ripper are the reference password-cracking tools. hashcat uses the GPU (very fast); John excels on CPU and exotic formats. They’re used to audit passwords and, in pentest/CTF, to break captured hashes (see Hashing & cracking, Credential Dumping).
What it is
Section titled “What it is”Both recover plaintext passwords from their hash by trying candidates (dictionary, rules, mask) and comparing. hashcat leverages the GPU and is the fastest; John (JtR) is very sharp on CPU, ships *2john utilities to extract hashes from files, and supports a wide range of formats.
What it is for
Section titled “What it is for”- Audit password strength in an authorized environment.
- Break hashes captured in pentests (NTLM, Kerberos, NetNTLMv2…).
- Recover passwords from protected files (ZIP, SSH, KeePass…) with
*2john.
Installation
Section titled “Installation”sudo apt install hashcat john # Kali/Parrothashcat -I # list devices (GPU/CPU)# classic wordlistzcat /usr/share/wordlists/rockyou.txt.gz > rockyou.txtBasic usage
Section titled “Basic usage”hashcat — hashcat -m <mode> -a <attack> hashes.txt <wordlist/mask>:
hashcat -m 0 hashes.txt rockyou.txt # MD5 + dictionaryhashcat -m 1000 ntlm.txt rockyou.txt -r rules/best64.rule # NTLM + ruleshashcat -m 22000 capture.hc22000 rockyou.txt # WPA/WPA2 (see /en/wireless/wifi-wpa/)hashcat -m 1000 ntlm.txt -a 3 '?u?l?l?l?l?d?d' # mask (structured brute force)hashcat hashes.txt --identify # helps detect the modehashcat -m 0 hashes.txt --show # show already cracked (potfile)John — autodetects the format:
john --wordlist=rockyou.txt hash.txt # dictionaryjohn --wordlist=rockyou.txt --rules hash.txt # with rulesjohn --format=raw-md5 hash.txt # force formatjohn --show hash.txt # view resultsAdvanced usage
Section titled “Advanced usage”Common hashcat modes (-m):
| Mode | Hash |
|---|---|
| 0 | MD5 |
| 100 | SHA1 |
| 1000 | NTLM |
| 1800 | sha512crypt ($6$, Linux) |
| 3200 | bcrypt ($2*$) |
| 5600 | NetNTLMv2 (Responder) |
| 13100 | Kerberoast (TGS-REP, RC4) |
| 18200 | AS-REP roast |
| 22000 | WPA-PBKDF2-PMKID+EAPOL |
Attack types (-a): 0 dictionary, 1 combinator, 3 mask (brute force), 6 hybrid dict+mask, 7 hybrid mask+dict.
Mask charsets: ?l lowercase, ?u uppercase, ?d digits, ?s symbols, ?a all.
# hybrid: dictionary word + 3 digits at the endhashcat -m 1000 ntlm.txt -a 6 rockyou.txt '?d?d?d'# custom charset and maskhashcat -m 0 h.txt -a 3 -1 '?l?d' '?1?1?1?1?1?1'John — extract hashes from files with *2john utilities and crack:
zip2john secret.zip > zip.hash && john --wordlist=rockyou.txt zip.hashssh2john id_rsa > rsa.hash && john --wordlist=rockyou.txt rsa.hash# combine /etc/passwd + /etc/shadow to crack Linux usersunshadow passwd.txt shadow.txt > unshadow.txtjohn --wordlist=rockyou.txt unshadow.txtTricks / workflow
Section titled “Tricks / workflow”flowchart TD
A[Captured hash] --> B{Identify type}
B -->|hashcat --identify / name-that-hash| C[Pick -m]
C --> D[Dictionary + best64 rules]
D -->|no luck| E[Mask / hybrid]
E -->|no luck| F[Bigger wordlists + d3ad0ne rules]
A -->|protected file| G[*2john -> John]
- Always start with dictionary + rules (
best64.rule): the best cost/benefit ratio. - Save mask brute force for short passwords or known patterns.
- hashcat stores cracked hashes in the potfile;
--showretrieves them without recomputing. - To identify the type:
hashcat --identify,name-that-hash, orhashid.
Detection (Blue Team)
Section titled “Detection (Blue Team)”- Cracking is offline: it generates no traffic against the target, so it isn’t detectable over the network.
- What’s detectable is the prior stage (the dump or capture): Kerberoasting leaves mass TGS requests (Event ID 4769), and Responder/NetNTLMv2 involves anomalous LLMNR/NBT-NS traffic (see LLMNR/NBT-NS).
- Real defense: long, unique passwords and slow algorithms (bcrypt/argon2) that make cracking unfeasible.
Checklist
Section titled “Checklist”- Hashes obtained within an authorized audit.
- Hash type identified and correct
-mmode. - First attempt with dictionary + rules.
- Mask/hybrid only after exhausting the above.
- Results treated as sensitive data (no exfiltration).
See also
Section titled “See also”- Wordlists and dictionaries — dictionaries and rules for cracking.