--- title: "John the Ripper" description: "John the Ripper: 2john extractors, formats, wordlist/incremental/rules modes and session control." category: password-attacks tags: [password-attacks, cracking, hashes] tools: [John the Ripper] difficulty: intermediate updated: "2026-09-13" source: "vault:PasswordAttacks/john-cheatsheet.md" --- # 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](#1-quick-workflow) 2. [Identifying the Hash](#2-identifying-the-hash) 3. [`--format=` Flag for Every Hash Type](#3-format-flag-for-every-hash-type) 4. [Preparing Hashes — the `*2john` Helpers](#4-preparing-hashes--the-2john-helpers) 5. [Cracking Mode Flags](#5-cracking-mode-flags) 6. [Rules, Masks & Tuning](#6-rules-masks--tuning) 7. [Session, Output & Status Flags](#7-session-output--status-flags) 8. [Running It — Worked Examples](#8-running-it--worked-examples) 9. [Alternative Approaches & Modern Tooling](#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
```bash # 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 ```bash # 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-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 | `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 `*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. ```bash 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 ``` ```bash # 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
| 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 | ```bash # 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 ```bash # 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 ```bash 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) ```bash # 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) ```bash john --format=nt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt ntlm.txt john --show --format=nt ntlm.txt ``` ### Kerberoast — TGS ticket (`GetUserSPNs.py`) ```bash # 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`) ```bash # 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) ```bash # 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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) ```bash 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) ```bash # 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$`) ```bash # 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) ```bash 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 ```bash 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 ```bash # 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) ```bash # 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) ```bash 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) ```bash john --format=descrypt --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt descrypt.txt john --show --format=descrypt descrypt.txt ``` ### MySQL 4.1+ / 5+ (leading `*`) ```bash john --format=mysql-sha1 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt mysql.txt john --show --format=mysql-sha1 mysql.txt ``` ### MSSQL 2012/2014 ```bash john --format=mssql12 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt mssql.txt john --show --format=mssql12 mssql.txt ``` ### Oracle 11g ```bash john --format=oracle11 --wordlist=/home/daemon-sec/pentest/wordlists/rockyou.txt oracle.txt john --show --format=oracle11 oracle.txt ``` ### BitLocker volume ```bash 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 ```bash 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 ```bash 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 ```bash # 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.