---
title: John the Ripper
description: "Cracker des hashes hors ligne : formats, wordlists, règles, masques et extraction avec les outils *2john."
category: cracking
kind: tool
tags: [password, hash, wordlist, rules, offline]
level: intermediate
updated: 2026-11-11
order: 3
aliases: ["john", "jtr", "johnny"]
---

## Identifier le hash

```bash
hashid '5f4dcc3b5aa765d61d8327deb882cf99'
john --list=formats | tr ',' '\n' | grep -iE "md5|nt|bcrypt|sha512|krb|ssh|zip"

# Forcer un format précis
john --format=raw-md5 hashes.txt
john --format=nt hashes.txt
```

| Type | Format John |
| --- | --- |
| MD5 / SHA-1 / SHA-256 | `raw-md5`, `raw-sha1`, `raw-sha256` |
| NTLM / LM | `nt`, `lm` |
| NetNTLMv2 | `netntlmv2` |
| Kerberoast / AS-REP | `krb5tgs`, `krb5asrep` |
| sha512crypt / bcrypt | `sha512crypt`, `bcrypt` |
| Clé SSH chiffrée | `ssh` |
| ZIP / RAR / PDF / Office | `zip`, `rar`, `pdf`, `office` |

> [!TIP]
> Utilise **John the Ripper Jumbo** : les formats récents, les masques et les outils `*2john` n'existent pas dans la version « core ». Sur Kali, le paquet `john` inclut Jumbo.

## Wordlists et règles

```bash
# Dictionnaire simple
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt

# Règles de mutation (majuscules, suffixes, leetspeak)
john --wordlist=rockyou.txt --rules hashes.txt
john --wordlist=rockyou.txt --rules=Jumbo hashes.txt

# Single mode : dérive les candidats du login et des champs GECOS
john --single hashes.txt

# Pipe de candidats générés à la volée
printf 'Spring2026!\nSummer2026!\n' | john --stdin hashes.txt
```

```bash
# Règles personnalisées dans ~/.john/john.conf ou /etc/john/john.conf
# [List.Rules:Corp]
# Az"[0-9][0-9][0-9][0-9]"
john --wordlist=words.txt --rules=Corp hashes.txt
```

## Masques et incrémental

```bash
# MotDePasse + 4 chiffres, minuscules
john --mask='?l?l?l?l?d?d?d?d' hashes.txt

# Incrémental intégré
john --incremental=Digits hashes.txt
john --incremental hashes.txt

# Combiner dictionnaire puis masque
john --wordlist=words.txt hashes.txt
john --mask='?u?l?l?l?l?d?d' hashes.txt
```

| Symbole | Classe |
| --- | --- |
| `?l` | minuscules |
| `?u` | majuscules |
| `?d` | chiffres |
| `?s` | caractères spéciaux |
| `?a` | tout l'espace imprimable |

## Sessions et performance

```bash
# Session nommée, reprise possible
john --session=mission --wordlist=rockyou.txt hashes.txt
john --status=mission
john --restore=mission

# Paralléliser sur plusieurs cœurs
john --fork=8 --wordlist=rockyou.txt hashes.txt

# Distribution manuelle : nœud 1 sur 4
john --node=1/4 --fork=4 --wordlist=rockyou.txt hashes.txt

# Pot file dédié
john --pot=mission.pot --wordlist=rockyou.txt hashes.txt

# Benchmark et résultats
john --test=10
john --show hashes.txt
john --show=left hashes.txt
```

> [!TIP]
> Si John paraît lent, vérifie d'abord le format avec `--format` et compare avec [Hashcat](/sheets/hashcat/) sur GPU. John est excellent pour les formats exotiques et les fichiers ; Hashcat est généralement plus rapide sur les gros dictionnaires.

## Extraire les hashes

```bash
# Linux : fusionner passwd + shadow
unshadow /etc/passwd /etc/shadow > shadow.txt
john --wordlist=rockyou.txt shadow.txt

# Windows : hashs NTLM issus de secretsdump / hashdump
john --format=nt ntlm.txt

# NetNTLMv2 capturés par Responder
john --format=netntlmv2 capture.txt

# Kerberos
john --format=krb5tgs kerberoast.txt
john --format=krb5asrep asrep.txt
```

```bash
# Fichiers protégés par mot de passe
zip2john archive.zip > zip.hash
rar2john archive.rar > rar.hash
7z2john.pl archive.7z > 7z.hash
pdf2john.py document.pdf > pdf.hash
office2john.py document.docx > office.hash
ssh2john id_rsa > ssh.hash
keepass2john base.kdbx > keepass.hash

john --wordlist=rockyou.txt zip.hash
john --wordlist=rockyou.txt ssh.hash
```

> [!TIP]
> Les outils `*2john` sont installés avec Jumbo, souvent dans `/usr/share/john/`. Si une commande manque : `dpkg -L john | grep 2john` ou `locate 2john`.

## Après le crack

```bash
# Afficher les mots de passe trouvés
john --show hashes.txt
john --show --format=nt ntlm.txt

# Ne garder que les comptes encore non cassés
john --show=left --format=krb5tgs kerberoast.txt
```

```bash
# Tester la réutilisation sur d'autres services
nxc smb 10.10.10.0/24 -u users.txt -p cracked.txt --continue-on-success
```

John casse des hashes ; il ne teste pas l'authentification en ligne. Pour les formulaires, SSH, RDP et le spraying, utilise [Hydra](/sheets/hydra/) et suis la méthode [Password attacks](/sheets/password-attacks/).

> [!WARNING]
> Le cracking consomme CPU/GPU et peut faire chauffer une machine de production. Travaille sur du matériel dédié, stocke les résultats dans un pot file chiffré et ne conserve pas les mots de passe en clair au-delà du rapport.
