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/hashcat.md
View on GitHub# hashcat
- **Category**: Password Attacks / Offline Hash Cracking
- **Risk Level**: 🟢 Low
---
## 描述
世界最快的 GPU 加速哈希破解工具,支持 450+ 哈希类型,提供字典攻击、规则攻击、掩码攻击(暴力破解)、混合攻击等多种模式。需要具备 GPU 才能发挥最佳性能,CPU 也可运行但速度慢。
## 安装
```bash
sudo apt install hashcat
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `-I` | 显示系统/环境/后端 API 信息 |
| `-m N` | 哈希类型(见下方类型表,否则自动检测)|
| `-a N` | 攻击模式(见下方参考)|
| `-o FILE` | 定义已恢复哈希的输出文件 |
| `--show` | 将哈希列表与 potfile 比较,显示已破解的哈希 |
| `--left` | 显示未破解的哈希 |
| `-r FILE` | 规则文件(对字典中每个词应用多条规则)|
| `--force` | 忽略警告 |
| `-w N` | 启用指定的工作负载配置 |
| `--status` | 启用状态屏幕自动更新 |
| `--increment` | 掩码递增模式 |
| `--increment-min N` | 从 N 开始掩码递增 |
| `--increment-max N` | 在 N 停止掩码递增 |
### 常用哈希类型(-m 参数)
| 值 | 类型 | 典型场景 |
|----|------|---------|
| 0 | MD5 | 通用 |
| 100 | SHA1 | 通用 |
| 1400 | SHA2-256 | 通用 |
| 1000 | NTLM | Windows 密码哈希 |
| 3000 | LM | 老版 Windows |
| 5600 | NetNTLMv2 | Responder 捕获 |
| 5500 | NetNTLMv1 | 老版 Windows |
| 13100 | Kerberos TGS | Kerberoasting |
| 18200 | Kerberos AS-REP | AS-REP Roasting |
| 3200 | bcrypt | Linux/Web 密码 |
| 1800 | sha512crypt | Linux shadow |
| 500 | md5crypt | Linux shadow(旧)|
| 400 | phpass | WordPress/Joomla/phpBB3(MD5)|
| 1600 | Apache MD5 | Apache .htpasswd(apr1)|
| 22000 | WPA-PBKDF2-PMKID+EAPOL | WPA/WPA2 无线破解 |
| 8900 | scrypt | 加密货币钱包 / Web 应用 |
| 34000 | Argon2 | 现代密码存储(hashcat 6.2.6+)|
## 常用命令
```bash
# 如需解压字典(Kali 2023+ 已预解压 rockyou.txt)
sudo gunzip /usr/share/wordlists/rockyou.txt.gz # 仅当 .gz 存在且 .txt 不存在时执行
# 字典攻击(最常用)
hashcat -m 1000 hashes.txt /usr/share/wordlists/rockyou.txt # NTLM
hashcat -m 5600 hashes.txt /usr/share/wordlists/rockyou.txt # NetNTLMv2
hashcat -m 0 hashes.txt /usr/share/wordlists/rockyou.txt # MD5
# 规则攻击(变体生成,比纯字典效果好得多)
hashcat -m 0 -a 0 hashes.txt wordlist.txt -r /usr/share/hashcat/rules/best64.rule
hashcat -m 0 -a 0 hashes.txt wordlist.txt -r /usr/share/hashcat/rules/rockyou-30000.rule
# 注意:可以串联多个 -r 参数(规则从左到右依次应用):
# hashcat -m 0 -a 0 hashes.txt wordlist.txt -r rule1.rule -r rule2.rule
# 掩码攻击(暴力破解特定格式)
# 字符集:?l=小写 ?u=大写 ?d=数字 ?s=特殊 ?a=所有
hashcat -m 0 -a 3 hashes.txt ?u?l?l?l?d?d?d?d # 1大写+3小写+4数字
hashcat -m 0 -a 3 hashes.txt ?d?d?d?d?d?d # 6位纯数字
hashcat -m 0 -a 3 hashes.txt Password?d?d?d?d # Password + 4位数字
# 递增长度掩码
hashcat -m 0 -a 3 hashes.txt --increment --increment-min 6 --increment-max 8 ?l?l?l?l?l?l?l?l
# Kerberoasting 哈希破解
hashcat -m 13100 kerberoast_hashes.txt /usr/share/wordlists/rockyou.txt
# AS-REP Roasting 哈希破解
hashcat -m 18200 asrep_hashes.txt /usr/share/wordlists/rockyou.txt
# WPA/WPA2 握手包破解(PMKID+EAPOL)
hashcat -m 22000 capture.hc22000 /usr/share/wordlists/rockyou.txt
# 显示已破解结果
hashcat -m 1000 hashes.txt --show
# CPU 模式运行(无 GPU 时)
# 无 GPU 运行时必须加 --force,用于抑制"No devices found"错误
hashcat -m 0 hashes.txt wordlist.txt --force
# 高性能模式
hashcat -m 0 -a 0 hashes.txt wordlist.txt -w 3
```
### 常用规则文件
```bash
ls /usr/share/hashcat/rules/
# best64.rule - 64 条最佳规则,快速实用
# rockyou-30000.rule - 30000 条规则,覆盖更广
# dive.rule - 深度规则(慢但覆盖广)
# d3ad0ne.rule - 经典规则集
```
## 注意事项
1. CPU 运行时(无 GPU)必须加 `--force`——否则 hashcat 会因"No devices found"退出。
2. 使用 `-o cracked.txt` 保存破解结果,稍后用 `hashcat --show` 查看。
3. 规则攻击(`-a 0 -r best64.rule`)远比纯字典攻击有效——始终添加规则文件。
4. GPU 驱动问题是最常见的失败原因——确保 GPU 驱动已安装并保持最新。
5. 机器专用于破解时使用 `-w 3`(高负载)以获得最快速度;保留系统可用性时使用 `-w 1`。
---
## 官方参考
- [Hashcat Wiki](https://hashcat.net/wiki/)
- [Hashcat (GitHub)](https://github.com/hashcat/hashcat)
- [Hashcat 官网](https://hashcat.net/hashcat/)
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 |