| name | john-crack |
| description | 使用 John the Ripper 进行离线密码破解。当需要破解哈希(MD5/SHA/NTLM/Kerberos/ZIP/RAR/PDF/SSH Key 等)时使用。John 支持自动检测哈希类型、字典攻击、规则变形、增量爆破,内置 *2john 工具链从各种格式提取哈希。任何涉及离线密码破解、哈希还原、密码审计的场景都应使用此技能 |
| metadata | {"tags":"john,crack,password,密码破解,哈希,hash,MD5,NTLM,Kerberos,字典攻击,规则,暴力破解","category":"tool"} |
John the Ripper 离线密码破解方法论
John the Ripper 是最经典的离线密码破解工具。核心优势:自动哈希识别 + 丰富规则引擎 + *2john 提取工具链。支持 200+ 哈希类型。
项目地址:https://github.com/openwall/john
Phase 1: 基本破解
john hashes.txt
john --format=Raw-MD5 hashes.txt
john --format=NT hashes.txt
john --format=Raw-SHA256 hashes.txt
john --wordlist=rockyou.txt hashes.txt
john --show hashes.txt
Phase 2: 规则变形攻击
john --wordlist=rockyou.txt --rules hashes.txt
john --wordlist=rockyou.txt --rules=best64 hashes.txt
john --wordlist=rockyou.txt --rules=Jumbo hashes.txt
john --wordlist=rockyou.txt --rules=KoreLogic hashes.txt
john --list=rules
Phase 3: 哈希提取(*2john 工具链)
zip2john secret.zip > zip_hash.txt
john zip_hash.txt
rar2john secret.rar > rar_hash.txt
pdf2john.pl secret.pdf > pdf_hash.txt
ssh2john id_rsa > ssh_hash.txt
keepass2john database.kdbx > keepass_hash.txt
office2john document.docx > office_hash.txt
john --format=krb5tgs --wordlist=rockyou.txt tgs_hashes.txt
john --format=krb5asrep --wordlist=rockyou.txt asrep_hashes.txt
john --format=NT --wordlist=rockyou.txt ntlm_hashes.txt
Phase 4: 增量和掩码攻击
john --incremental hashes.txt
john --incremental=Digits hashes.txt
john --incremental=Alnum hashes.txt
john --incremental=ASCII hashes.txt
john --mask='?d?d?d?d?d?d' hashes.txt
john --mask='?u?l?l?l?d?d?d?s' hashes.txt
Phase 5: 实用技巧
john --restore
john --status
john --fork=4 --wordlist=rockyou.txt hashes.txt
john --session=my_crack --wordlist=rockyou.txt hashes.txt
john --users=admin hashes.txt
渗透测试常用场景
| 场景 | 命令 |
|---|
| NTLM 破解 | john --format=NT --wordlist=rockyou.txt ntlm.txt |
| Kerberoasting | john --format=krb5tgs --wordlist=rockyou.txt tgs.txt |
| SSH 密钥破解 | ssh2john id_rsa > h.txt && john --wordlist=rockyou.txt h.txt |
| ZIP 密码破解 | zip2john file.zip > h.txt && john h.txt |
| Linux shadow | john --wordlist=rockyou.txt /tmp/shadow |
| 字典+规则 | john --wordlist=rockyou.txt --rules=best64 hashes.txt |