x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/password/tools/john.md
View on GitHub# John the Ripper
- **Category**: Password Attacks / Offline Hash Cracking
- **Risk Level**: 🟢 Low
---
## 描述
John the Ripper,经典哈希破解工具,擅长处理 Linux shadow 文件和各类加密文件(ZIP/PDF/RAR/SSH Key 等)。内置规则引擎,可智能生成密码变体。CPU 运行,与 GPU 加速的 hashcat 互补。
## 安装
```bash
sudo apt install john
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `--wordlist=FILE` | 字典模式,从 FILE 或 stdin 读取密码 |
| `--format=TYPE` | 强制指定哈希类型 |
| `--rules` | 启用单词变形规则 |
| `--rules=RULE` | 启用指定段的单词变形规则 |
| `--show` | 显示已破解的密码 |
| `--list=formats` | 列出功能(详见 --list=help)|
| `--incremental` | 递增模式(使用指定段)|
| `--mask=MASK` | 掩码模式 |
| `--restore` | 恢复中断的会话 |
| `--session=NAME` | 为新会话指定名称 |
| `--pot=FILE` | 使用的 pot 文件 |
## 常用命令
```bash
# 破解 Linux shadow 文件
john /etc/shadow
john --wordlist=/usr/share/wordlists/rockyou.txt /etc/shadow
# 合并 passwd + shadow(提高成功率)
unshadow /etc/passwd /etc/shadow > /tmp/combined.txt
john /tmp/combined.txt --wordlist=/usr/share/wordlists/rockyou.txt
# 显示已破解的密码
john --show /tmp/combined.txt
# 指定哈希格式
john --format=NT hash.txt # NTLM(Windows)
john --format=md5crypt hash.txt # Linux MD5 crypt
john --format=bcrypt hash.txt # bcrypt
john --format=Raw-SHA256 hash.txt # SHA-256(原始,无盐)
john --format=netntlmv2 hash.txt # NetNTLMv2(Responder 捕获)
# 提示:如果 john 自动检测格式错误,请始终显式指定 --format
# 查看支持的格式
john --list=formats | grep -i ntlm
# 规则攻击(生成密码变体)
john --wordlist=wordlist.txt --rules hash.txt
john --wordlist=wordlist.txt --rules=Extra hash.txt
# 各类文件密码破解(需先提取哈希)
# 注意:在 Kali 上这些工具属于 john-the-ripper 扩展包
zip2john encrypted.zip > zip_hash.txt && john zip_hash.txt
pdf2john.pl encrypted.pdf > pdf_hash.txt && john pdf_hash.txt
# rar2john 用于 RAR 文件(可能需要 john-extra 中的 rar2john)
rar2john encrypted.rar > rar_hash.txt && john rar_hash.txt
# ssh2john 用于 SSH 私钥(有密码保护的)
ssh2john id_rsa > ssh_hash.txt && john ssh_hash.txt --wordlist=wordlist.txt
# 暴力破解
john --incremental hash.txt
# 恢复中断的任务
john --restore=session_name
```
## 注意事项
1. 破解前先用 `hashid` 或 `john --list=formats | grep -i <type>` 确认哈希类型。
2. John 的递增模式(`--incremental`)尝试所有字符组合——速度极慢,仅作最后手段。
3. 常见哈希类型的 GPU 加速破解请使用 hashcat——John 基于 CPU,作为特殊格式破解的补充。
4. `--rules` 标志应用规则变异(大小写变换、字符替换等),可显著扩展字典覆盖范围。
5. `john --show <hashfile>` 显示已从 John 哈希池文件中破解的结果——中断会话后运行此命令恢复进度。
---
## 官方参考
- [John the Ripper (GitHub)](https://github.com/openwall/john)
- [John the Ripper 官网](https://www.openwall.com/john/)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |