John the Ripper
John the Ripper – Offline Password Cracking Tool
John the Ripper is a fast and open-source password auditing and recovery tool. It is mainly used for offline hash cracking and supports a wide range of hash formats. It offers multiple attack modes such as dictionary attacks, brute force, and rule-based attacks.
Installation / Check
Check if John is installed:
which john
Install John the Ripper:
sudo apt install john
Basic Syntax
john [options] <password-file>
Common Commands
Start cracking (auto-detect hash type):
john hashes.txt
Dictionary attack using wordlist:
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
Show cracked passwords:
john --show hashes.txt
Specify hash format manually:
john --format=raw-md5 hashes.txt
Brute force attack:
john --incremental hashes.txt
Numeric-only brute force (PIN cracking):
john --incremental=digits hashes.txt
Combine passwd and shadow files:
unshadow /etc/passwd /etc/shadow > combined.txt
Rule-based attack (password variations):
john --rules --wordlist=wordlist.txt hashes.txt
Use multiple CPU cores:
john --fork=4 --wordlist=wordlist.txt hashes.txt
Save session:
john --session=mycrack hashes.txt
Restore session:
john --restore=mycrack
Crack Windows NTLM hashes:
john --format=nt hashes.txt
Crack SHA256 hashes:
john --format=raw-sha256 hashes.txt
Crack bcrypt hashes:
john --format=bcrypt hashes.txt
Crack ZIP file password:
john --format=zip encrypted.zip
Crack RAR file password:
john --format=rar encrypted.rar
Crack PDF password:
john --format=pdf document.pdf
Crack MS Office document password:
john --format=office document.docx
List supported formats:
john --list=formats
List available rules:
john --list=rules
Mask attack (pattern-based):
john --mask=?d?d?d?d hashes.txt
Complex mask attack:
john --mask=?u?l?l?l?d?d?d?s hashes.txt
Use custom pot file:
john --pot=custom.pot hashes.txt
External mode (advanced filtering):
john --external=filter hashes.txt
Extract ZIP hash:
zip2john encrypted.zip > ziphash.txt
Extract RAR hash:
rar2john encrypted.rar > rarhash.txt
Extract PDF hash:
pdf2john.pl document.pdf > pdfhash.txt
Step-by-Step Guide
- Obtain password hashes (with proper authorization)
- Identify the hash type if possible
- Run a dictionary attack:
john --wordlist=wordlist.txt hashes.txt
- Wait for the cracking process
- Monitor progress (press any key during execution)
- View cracked passwords:
john --show hashes.txt
- Results are stored in:
~/.john/john.pot
Understanding the Output
- Cracked passwords appear in:
username:password
- Displays cracking speed (passwords per second)
- Shows estimated time and progress
- Use --show to display all cracked results
⚠️ Legal Warning
Use password auditing tools only on systems you own or have explicit permission to test. Unauthorized use is illegal.