CRED^:Password Attacks

John the Ripper

John the Ripper: 2john extractors, formats, wordlist/incremental/rules modes and session control.

intermediateupdated 2026-09-13John the Ripper

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 *2john helpers, 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

  1. Quick Workflow
  2. Identifying the Hash
  3. --format= Flag for Every Hash Type
  4. Preparing Hashes — the *2john Helpers
  5. Cracking Mode Flags
  6. Rules, Masks & Tuning
  7. Session, Output & Status Flags
  8. Running It — Worked Examples
  9. Alternative Approaches & Modern Tooling

1. Quick Workflow

Quick crack workflowLR
Obtain hashor artefact
Convert with*2john helper
Identify formathashid / --list=formats
Pick --format=NAME
Crack:wordlist -> rules -> incremental
john --showrecover plaintext
# 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. --show reads 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 — hashid guesses, 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 --format fails, 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-md532 hex
MD4 (raw)raw-md432 hex
SHA-1raw-sha140 hex
SHA-224raw-sha224
SHA-256raw-sha25664 hex
SHA-384raw-sha384
SHA-512raw-sha512128 hex
SHA3-256 / 512raw-sha3
RIPEMD-160ripemd-160
Whirlpoolwhirlpool
BLAKE2b-512raw-blake2
GOST R 34.11-94gost

OS / login hashes

Hash type--format=Notes
DES crypt (traditional)descrypt13 chars
MD5 crypt $1$md5cryptLinux/BSD, Cisco-IOS
bcrypt $2a$/$2b$/$2y$bcryptvery slow, GPU-resistant
SHA-256 crypt $5$sha256cryptLinux
SHA-512 crypt $6$sha512cryptmodern Linux /etc/shadow
scrypt $7$scrypt
Argon2argon2i / id / d variants
Apache $apr1$md5crypt (or apache-md5)htpasswd MD5
AIX smd5 / sshaaix-smd5 / aix-ssha256
macOS 10.8+pbkdf2-hmac-sha512via ml2john

Windows / Active Directory

Hash type--format=Notes
NTLM (NT hash)ntAD user hash, 32 hex
LM (legacy)lm
NetNTLMv1netntlmResponder capture
NetNTLMv2netntlmv2Responder capture (most common)
MS-Cache v1 (DCC)mscash
MS-Cache v2 (DCC2)mscash2domain cached creds
Kerberos AS-REP (roast)krb5asrepfrom GetNPUsers.py
Kerberos TGS (roast)krb5tgsfrom GetUserSPNs.py
Kerberos pre-auth (etype 23)krb5pa-md5
DPAPI masterkeydpapimk

Databases

Hash type--format=Notes
MySQL ≤ 4.0mysql16 hex
MySQL 4.1+/5+mysql-sha1leading *
PostgreSQL MD5postgres
MSSQL 2000mssql
MSSQL 2005mssql05
MSSQL 2012/2014mssql12
Oracle 7-10goracle
Oracle 11goracle11
Oracle 12coracle12c
MongoDB SCRAM-SHA-1mongodb

Apps, archives & files

Hash type--format=Prepare with
ZIP (classic/AES)zip / pkzipzip2john
RAR3 / RAR5rar / rar5rar2john
7-Zip7z7z2john
PDFpdfpdf2john
Office 2007-2013+officeoffice2john
Old Office (97-2003)oldofficeoffice2john
OpenDocumentodfodf2john
KeePass 1/2keepasskeepass2john
SSH private keysshssh2john
GPG/PGP secret keygpggpg2john
LUKSluksluks2john
BitLockerbitlockerbitlocker2john
macOS keychainkeychainkeychain2john
Bitcoin/Ethereum walletbitcoin / ethereumbitcoin2john / ethereum2john
WPA/WPA2 handshakewpapskhcxpcapngtool then wpapcap2john
htpasswd (bcrypt)bcryptalready a hash
JWT (HS256 etc.)HMAC-SHA256strip 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 *2john helper — 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

Cracking mode escalationTD
--single
fast, uses GECOS/username
--wordlist
+ mangling
--wordlist + --rules
exhausted
--mask
structured
--incremental
brute-force, last resort
done or give up
FlagModeUse when
--singleSingle crackFast first pass; derives candidates from the username/GECOS fields in the hash file
--wordlist=FILEDictionaryYou have a wordlist (default go-to)
--wordlist=FILE --rulesDictionary + manglingApply word-mangling rules (see below)
--incremental[=MODE]Brute-forceWordlists exhausted; MODE = ASCII, Digits, Alpha, LM_ASCII…
--mask=?u?l?l?l?d?dMask/bruteYou know the password pattern
--external=NAMEExternalCustom C-like generators in john.conf
--loopbackLoopbackFeed already-cracked passwords back as a wordlist
--prince=FILEPRINCECombinator-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 --single first, it is free. --single runs in seconds and catches passwords derived from the username (e.g. user admin → 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

PDF

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=bcrypt prints 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 *2john extractors and --single/rules ergonomics.

Note — hashid → mode mapping. hashid -m prints the matching hashcat -m number. There is no clean one-liner mapping to John format names, so keep the table in §3 as your lookup.

Warning — prefer hcxpcapngtool for Wi-Fi. The older wpapcap2john path is fragile with modern captures. Convert with hcxpcapngtool (from hcxtools) to a .hc22000 and crack in hashcat -m 22000, which is the current standard for WPA/WPA2/WPA3-SAE.

On this page

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.