John the Ripper
What this covers — Full workflow for John the Ripper (Jumbo): identifying a hash, picking the correct
--format=value for every hash type, preparing hashes with the*2johnhelpers, and every cracking mode flag. For the GPU-heavy equivalents see Hashcat.
Use John the Ripper Jumbo (john-jumbo, the community build shipped on Kali/Parrot). The stock upstream build supports far fewer formats. All commands below assume the Jumbo build.
Table of Contents
- Quick Workflow
- Identifying the Hash
--format=Flag for Every Hash Type- Preparing Hashes — the
*2johnHelpers - Cracking Mode Flags
- Rules, Masks & Tuning
- Session, Output & Status Flags
- Running It — Worked Examples
- Alternative Approaches & Modern Tooling
1. Quick Workflow
# The canonical three-liner
zip2john secret.zip > hash.txt # 1. convert artefact -> john hash
john --format=zip --wordlist=rockyou.txt hash.txt # 2. crack
john --show --format=zip hash.txt # 3. reveal cracked passwords
Tip — cracked passwords live in
~/.john/john.pot. John never re-cracks a hash it has already solved.--showreads from the pot file. To force a fresh run, delete or point away from the pot:--pot=/tmp/fresh.pot.
2. Identifying the Hash
# Best-effort identification (installed as `hashid` or `hash-identifier`)
hashid '$6$rounds=5000$abc$...'
hashid -m 'hash' # also prints the matching hashcat -m mode
# List every format John supports (grep for what you need)
john --list=formats
john --list=formats | tr ',' '\n' | grep -i ntlm
# Show the subformats/notes for one format
john --list=format-details --format=krb5tgs
Warning —
hashidguesses, it does not confirm. Multiple algorithms share a length/shape (e.g. raw MD5 vs NTLM vs raw-MD4 are all 32 hex chars). If the first--formatfails, try the siblings in the table below before assuming the hash is wrong.
3. --format= Flag for Every Hash Type
The value passed to --format= is John’s internal format name, not a hashcat mode number. Below are the ones you will actually meet on HTB/CPTS boxes and real engagements. Names are case-insensitive.
Raw / unsalted digests
| Hash type | --format= | Notes |
|---|---|---|
| MD5 (raw) | raw-md5 | 32 hex |
| MD4 (raw) | raw-md4 | 32 hex |
| SHA-1 | raw-sha1 | 40 hex |
| SHA-224 | raw-sha224 | |
| SHA-256 | raw-sha256 | 64 hex |
| SHA-384 | raw-sha384 | |
| SHA-512 | raw-sha512 | 128 hex |
| SHA3-256 / 512 | raw-sha3 | |
| RIPEMD-160 | ripemd-160 | |
| Whirlpool | whirlpool | |
| BLAKE2b-512 | raw-blake2 | |
| GOST R 34.11-94 | gost |
OS / login hashes
| Hash type | --format= | Notes |
|---|---|---|
| DES crypt (traditional) | descrypt | 13 chars |
MD5 crypt $1$ | md5crypt | Linux/BSD, Cisco-IOS |
bcrypt $2a$/$2b$/$2y$ | bcrypt | very slow, GPU-resistant |
SHA-256 crypt $5$ | sha256crypt | Linux |
SHA-512 crypt $6$ | sha512crypt | modern Linux /etc/shadow |
scrypt $7$ | scrypt | |
| Argon2 | argon2 | i / id / d variants |
Apache $apr1$ | md5crypt (or apache-md5) | htpasswd MD5 |
| AIX smd5 / ssha | aix-smd5 / aix-ssha256 | |
| macOS 10.8+ | pbkdf2-hmac-sha512 | via ml2john |
Windows / Active Directory
| Hash type | --format= | Notes |
|---|---|---|
| NTLM (NT hash) | nt | AD user hash, 32 hex |
| LM (legacy) | lm | |
| NetNTLMv1 | netntlm | Responder capture |
| NetNTLMv2 | netntlmv2 | Responder capture (most common) |
| MS-Cache v1 (DCC) | mscash | |
| MS-Cache v2 (DCC2) | mscash2 | domain cached creds |
| Kerberos AS-REP (roast) | krb5asrep | from GetNPUsers.py |
| Kerberos TGS (roast) | krb5tgs | from GetUserSPNs.py |
| Kerberos pre-auth (etype 23) | krb5pa-md5 | |
| DPAPI masterkey | dpapimk |
Databases
| Hash type | --format= | Notes |
|---|---|---|
| MySQL ≤ 4.0 | mysql | 16 hex |
| MySQL 4.1+/5+ | mysql-sha1 | leading * |
| PostgreSQL MD5 | postgres | |
| MSSQL 2000 | mssql | |
| MSSQL 2005 | mssql05 | |
| MSSQL 2012/2014 | mssql12 | |
| Oracle 7-10g | oracle | |
| Oracle 11g | oracle11 | |
| Oracle 12c | oracle12c | |
| MongoDB SCRAM-SHA-1 | mongodb |
Apps, archives & files
| Hash type | --format= | Prepare with |
|---|---|---|
| ZIP (classic/AES) | zip / pkzip | zip2john |
| RAR3 / RAR5 | rar / rar5 | rar2john |
| 7-Zip | 7z | 7z2john |
pdf | pdf2john | |
| Office 2007-2013+ | office | office2john |
| Old Office (97-2003) | oldoffice | office2john |
| OpenDocument | odf | odf2john |
| KeePass 1/2 | keepass | keepass2john |
| SSH private key | ssh | ssh2john |
| GPG/PGP secret key | gpg | gpg2john |
| LUKS | luks | luks2john |
| BitLocker | bitlocker | bitlocker2john |
| macOS keychain | keychain | keychain2john |
| Bitcoin/Ethereum wallet | bitcoin / ethereum | bitcoin2john / ethereum2john |
| WPA/WPA2 handshake | wpapsk | hcxpcapngtool then wpapcap2john |
| htpasswd (bcrypt) | bcrypt | already a hash |
| JWT (HS256 etc.) | HMAC-SHA256 | strip and format manually, or use hashcat -m 16500 |
Note — formatting upgrade. Store the
--format=value in your notes next to the artefact type, not the hash string. On a real box you rarely know the algorithm until you have run the*2johnhelper — the helper output line usually starts with$name$, which tells you the format immediately (e.g.$krb5tgs$23$...→--format=krb5tgs).
4. Preparing Hashes — the *2john Helpers
Most non-trivial targets are not bare hashes; they are files or captures. The *2john scripts extract a crackable hash string. Run ls /usr/share/john/*2john* and ls /usr/bin/*2john to see what is installed.
ssh2john id_rsa > ssh.hash
zip2john archive.zip > zip.hash
rar2john archive.rar > rar.hash
7z2john archive.7z > 7z.hash # may be 7z2john.pl
pdf2john secret.pdf > pdf.hash
office2john report.docx > office.hash
keepass2john Database.kdbx > kp.hash
gpg2john secret.gpg > gpg.hash
# Then crack — format is often auto-detected, but pin it to be safe:
john --wordlist=/usr/share/wordlists/rockyou.txt --format=ssh ssh.hash
5. Cracking Mode Flags
| Flag | Mode | Use when |
|---|---|---|
--single | Single crack | Fast first pass; derives candidates from the username/GECOS fields in the hash file |
--wordlist=FILE | Dictionary | You have a wordlist (default go-to) |
--wordlist=FILE --rules | Dictionary + mangling | Apply word-mangling rules (see below) |
--incremental[=MODE] | Brute-force | Wordlists exhausted; MODE = ASCII, Digits, Alpha, LM_ASCII… |
--mask=?u?l?l?l?d?d | Mask/brute | You know the password pattern |
--external=NAME | External | Custom C-like generators in john.conf |
--loopback | Loopback | Feed already-cracked passwords back as a wordlist |
--prince=FILE | PRINCE | Combinator-style candidate generation |
# Classic escalating attack on a shadow file
john --single passwd.hash
john --wordlist=rockyou.txt passwd.hash
john --wordlist=rockyou.txt --rules=Jumbo passwd.hash
john --incremental passwd.hash
Tip — combine
--singlefirst, it is free.--singleruns in seconds and catches passwords derived from the username (e.g. useradmin→admin123,Admin!). Always run it before touching a wordlist.
6. Rules, Masks & Tuning
# Built-in rule sets (defined in /etc/john/john.conf)
john --wordlist=rockyou.txt --rules=Single hash.txt
john --wordlist=rockyou.txt --rules=Jumbo hash.txt # large, thorough
john --wordlist=rockyou.txt --rules=KoreLogic hash.txt
# Mask attack — placeholders:
# ?l lower ?u upper ?d digit ?s special ?a all ?h/?H hex
john --mask='?u?l?l?l?l?d?d' hash.txt
john --mask='Summer?d?d?d?d' hash.txt # e.g. Summer2024
# Hybrid: wordlist + appended mask
john --wordlist=rockyou.txt --mask='?w?d?d?d' hash.txt # word + 3 digits
# Fork across CPU cores (Jumbo)
john --fork=4 --wordlist=rockyou.txt hash.txt
# Limit runtime / candidate count
john --wordlist=rockyou.txt --max-run-time=300 hash.txt
7. Session, Output & Status Flags
john --show hash.txt # print cracked plaintexts
john --show --format=nt hash.txt # pin format when showing
john --show=left hash.txt # show still-uncracked hashes
john --session=engagement hash.txt # named session (resumable)
john --restore=engagement # resume it after Ctrl-C / crash
john --status=engagement # check progress of a running session
# During a live run: press any key for a status line, 'q' to quit gracefully
john --pot=/tmp/custom.pot hash.txt # use an alternate pot file
john --list=formats # all supported formats
john --test --format=sha512crypt # benchmark one format (speeds)
8. Running It — Worked Examples
Every example is the same two steps: crack with a format + wordlist, then --show the plaintext. Pin --format= so John never guesses wrong on a shared hash length.
NetNTLMv2 (Responder capture)
# Crack — file holds the $NETNTLMv2$ line captured by Responder / ntlmrelayx
john --format=netntlmv2 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt p.agila.ntlmv2
# Show the recovered password
john --show --format=netntlmv2 p.agila.ntlmv2
NTLM / NT hash (dumped from a DC)
john --format=nt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt ntlm.txt
john --show --format=nt ntlm.txt
Kerberoast — TGS ticket (GetUserSPNs.py)
# Output line begins with $krb5tgs$23$...
john --format=krb5tgs --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt spns.txt
john --show --format=krb5tgs spns.txt
AS-REP roast (GetNPUsers.py)
# Output line begins with $krb5asrep$23$...
john --format=krb5asrep --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt asrep.txt
john --show --format=krb5asrep asrep.txt
Linux /etc/shadow ($6$ = sha512crypt)
# Merge passwd + shadow first so --single can use usernames
unshadow /etc/passwd /etc/shadow > unshadowed.txt
john --format=sha512crypt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt unshadowed.txt
john --show --format=sha512crypt unshadowed.txt
SSH private key
ssh2john id_rsa > ssh.hash
john --format=ssh --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt ssh.hash
john --show --format=ssh ssh.hash
ZIP archive
zip2john secret.zip > zip.hash
john --format=zip --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt zip.hash
john --show --format=zip zip.hash
KeePass database
keepass2john Database.kdbx > kp.hash
john --format=keepass --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt kp.hash
john --show --format=keepass kp.hash
Office document
office2john report.docx > office.hash
john --format=office --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt office.hash
john --show --format=office office.hash
RAR archive
rar2john archive.rar > rar.hash
# rar2john stamps $rar5$ or $RAR3$ into the line — use rar5 for the former
john --format=rar5 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt rar.hash
john --show --format=rar5 rar.hash
7-Zip archive
7z2john archive.7z > 7z.hash # may be 7z2john.pl on some builds
john --format=7z --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt 7z.hash
john --show --format=7z 7z.hash
pdf2john secret.pdf > pdf.hash
john --format=pdf --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt pdf.hash
john --show --format=pdf pdf.hash
GPG / PGP secret key
gpg2john secret.gpg > gpg.hash
john --format=gpg --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt gpg.hash
john --show --format=gpg gpg.hash
NetNTLMv1 (Responder capture)
john --format=netntlm --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt netntlmv1.txt
john --show --format=netntlm netntlmv1.txt
Domain cached creds — MS-Cache v2 (DCC2)
# Format: username:$DCC2$10240#username#hash
john --format=mscash2 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt dcc2.txt
john --show --format=mscash2 dcc2.txt
bcrypt (htpasswd / app DB, $2a$/$2b$/$2y$)
# Already a hash — no *2john needed. Slow; keep the wordlist tight.
john --format=bcrypt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt bcrypt.txt
john --show --format=bcrypt bcrypt.txt
Raw MD5 (unsalted digest)
john --format=raw-md5 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt md5.txt
john --show --format=raw-md5 md5.txt
LUKS full-disk encryption
luks2john disk.img > luks.hash # or point at the LUKS device/partition
john --format=luks --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt luks.hash
john --show --format=luks luks.hash
WPA/WPA2 handshake
# Convert the capture, then crack the PSK
wpapcap2john capture.cap > wpa.hash
john --format=wpapsk --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt wpa.hash
john --show --format=wpapsk wpa.hash
LM hash (legacy Windows)
# LM is uppercase-only and split into two 7-char halves — cracks fast
john --format=lm --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt lm.txt
john --show --format=lm lm.txt
md5crypt ($1$ — Linux/BSD, Cisco IOS type 5)
john --format=md5crypt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt md5crypt.txt
john --show --format=md5crypt md5crypt.txt
DES crypt (traditional 13-char Unix)
john --format=descrypt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt descrypt.txt
john --show --format=descrypt descrypt.txt
MySQL 4.1+ / 5+ (leading *)
john --format=mysql-sha1 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt mysql.txt
john --show --format=mysql-sha1 mysql.txt
MSSQL 2012/2014
john --format=mssql12 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt mssql.txt
john --show --format=mssql12 mssql.txt
Oracle 11g
john --format=oracle11 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt oracle.txt
john --show --format=oracle11 oracle.txt
BitLocker volume
bitlocker2john -i disk.img > bitlocker.hash
john --format=bitlocker --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt bitlocker.hash
john --show --format=bitlocker bitlocker.hash
macOS keychain
keychain2john login.keychain-db > keychain.hash
john --format=keychain --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt keychain.hash
john --show --format=keychain keychain.hash
Bitcoin / crypto wallet
bitcoin2john wallet.dat > wallet.hash
john --format=bitcoin --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt wallet.hash
john --show --format=bitcoin wallet.hash
DPAPI masterkey
# Extract with dpapi.py (impacket) or the DPAPImk2john helper first
john --format=dpapimk --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt dpapi.hash
john --show --format=dpapimk dpapi.hash
Tip — benchmark before a slow run.
john --test --format=bcryptprints c/s (candidates per second) so you know whether a wordlist run is minutes or days. Omit--format=to benchmark everything.
9. Alternative Approaches & Modern Tooling
Tip — move salted-but-fast hashes to a GPU. John is CPU-first. For raw MD5/SHA/NTLM and other GPU-friendly algorithms, hashcat on a GPU is often 10–100× faster. Keep John for formats hashcat lacks and for its superb
*2johnextractors and--single/rules ergonomics.
Note —
hashid→ mode mapping.hashid -mprints the matching hashcat-mnumber. There is no clean one-liner mapping to John format names, so keep the table in §3 as your lookup.
Warning — prefer
hcxpcapngtoolfor Wi-Fi. The olderwpapcap2johnpath is fragile with modern captures. Convert withhcxpcapngtool(fromhcxtools) to a.hc22000and crack in hashcat-m 22000, which is the current standard for WPA/WPA2/WPA3-SAE.