| name | password-cracking |
| description | 密码爆破工具链 — hashcat, John, Hydra, Medusa, CeWL, crunch |
| version | 1.0.0 |
| author | Hermes Agent |
| license | MIT |
| metadata | {"hermes":{"tags":["password","cracking","hashcat","john","brute-force","dictionary","hash","wifi","network"]}} |
密码爆破工具链
核心工具一览
| 工具 | 用途 | 特点 |
|---|
| hashcat | GPU密码破解 | 最快,400+哈希类型 |
| John the Ripper | CPU密码破解 | 格式最多 |
| Hydra | 网络协议爆破 | SSH/FTP/HTTP/RDP等 |
| Medusa | 网络协议爆破 | 并发更高 |
| Ncrack | 网络认证爆破 | Nmap团队出品 |
| CeWL | 自定义字典生成 | 爬取网站生成词典 |
| crunch | 暴力字典生成 | 按规则生成组合 |
| maskprocessor | 掩码字典生成 | hashcat配套 |
| RainbowCrack | 彩虹表破解 | 时间换空间 |
| hashid | 哈希类型识别 | 自动判断格式 |
| nth | 哈希类型识别 | 更智能的识别器 |
1. hashcat — GPU破解之王
安装
sudo apt install hashcat
git clone https://github.com/hashcat/hashcat.git
cd hashcat && make -j$(nproc) && sudo make install
哈希模式速查
0 MD5
100 SHA1
1000 NTLM
1400 SHA256
1700 SHA512
3000 LM
3200 bcrypt ($2*)
2500 WPA/WPA2
22000 WPA-PBKDF2-PMKID+EAPOL
5600 NetNTLMv2
13100 Kerberos 5 TGS-REP
18200 Kerberos 5 AS-REP
10 md5($pass.$salt)
20 md5($salt.$pass)
1410 sha256($pass.$salt)
1710 sha512($salt.$pass)
# v7.1新增模式
34200 KeePass4 (KDBX4)
sm3crypt / $sm3$ SM3 (Unix/中国国密)
94200 BLAKE2b-256
28100 Windows Hello PIN/Password
9600 MS Office 2013
攻击模式
hashcat -m 0 -a 0 hash.txt wordlist.txt
hashcat -m 0 -a 3 hash.txt ?l?l?l?l?l?l?l?l
hashcat -m 0 -a 1 hash.txt wordlist1.txt wordlist2.txt
hashcat -m 0 -a 0 -r rules/best64.rule hash.txt wordlist.txt
hashcat -m 0 -a 3 hash.txt ?a?a?a?a?a?a
hashcat --session=my --restore
掩码字符集
?l = abcdefghijklmnopqrstuvwxyz
?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ
?d = 0123456789
?s = 特殊符号
?a = ?l?u?d?s
?b = 0x00-0xff
WPA/WPA2破解
airmon-ng start wlan0
airodump-ng wlan0mon
aireplay-ng -0 5 -a <BSSID> -c <CLIENT> wlan0mon
hashcat -m 22000 -a 0 capture.hc22000 wordlist.txt
NTLM/NetNTLM
hashcat -m 1000 -a 0 ntlm_hash.txt wordlist.txt
hashcat -m 5600 -a 0 netntlmv2.txt wordlist.txt
实用技巧
hashcat -m 0 hash.txt wordlist.txt --show
hashcat -m 0 hash.txt wordlist.txt -o cracked.txt
hashcat -m 0 hash.txt wordlist.txt --status
hashcat -m 0 hash.txt wordlist.txt --hwmon-temp-abort=90
2. John the Ripper — 格式之王
安装
sudo apt install john
git clone https://github.com/openwall/john.git -b bleeding-jumbo
cd john/src && ./configure && make -s clean && make -sj4
基本用法
john hash.txt
john --format=md5 hash.txt
john --wordlist=rockyou.txt hash.txt
john --wordlist=rockyou.txt --rules hash.txt
john --incremental hash.txt
john --show hash.txt
john --list=formats | grep -i md5
常用格式
md5crypt / sha512crypt / bcrypt / nt / lm
raw-md5 / raw-sha256 / raw-sha512
mssql / oracle11 / wpa
破解Linux密码
sudo unshadow /etc/passwd /etc/shadow > linux_hashes.txt
john --wordlist=/usr/share/wordlists/rockyou.txt linux_hashes.txt
破解Windows密码
secretsdump.py LOCAL -sam SAM -system SYSTEM
john --format=nt ntlm_hashes.txt
3. Hydra — 网络协议爆破
安装
sudo apt install hydra
sudo apt install -y git build-essential libssl-dev libssh-dev libidn11-dev libpcre3-dev libmysqlclient-dev libpq-dev
git clone https://github.com/vanhauser-thc/thc-hydra.git
cd thc-hydra && ./configure && make -j$(nproc) && sudo make install
基本用法
hydra -l admin -P passwords.txt ssh://192.168.1.100
hydra -l admin -P passwords.txt ftp://192.168.1.100
hydra -l admin -P passwords.txt 192.168.1.100 http-post-form \
"/login:username=^USER^&password=^PASS^:Login Failed"
hydra -l administrator -P passwords.txt rdp://192.168.1.100
hydra -l root -P passwords.txt 192.168.1.100 mysql
hydra -L users.txt -P passwords.txt -M targets.txt ssh
hydra -l admin -P passwords.txt -t 4 ssh://192.168.1.100
hydra -R
HTTP表单模板
hydra -l admin -P passwords.txt target http-post-form \
"/login:username=^USER^&password=^PASS^:Invalid credentials"
hydra -l admin -P passwords.txt target http-post-form \
'/api/login:{"username":"^USER^","password":"^PASS^"}:F=401'
hydra -l admin -P passwords.txt target http-post-form \
"/login:username=^USER^&password=^PASS^:H=Cookie: session=abc:F=Failed"
4. 字典生成工具
CeWL — 网站爬取
sudo apt install cewl
cewl https://target.com -d 2 -m 5 -w wordlist.txt
cewl https://target.com -d 2 -m 5 -e --email_file emails.txt
crunch — 暴力字典
sudo apt install crunch
crunch 8 8 0123456789 -o digits.txt
crunch 6 8 abcdefghijklmnopqrstuvwxyz -o alpha.txt
crunch 10 10 -t @@@@%%%%%% -o pattern.txt
maskprocessor
git clone https://hashcat.net/maskprocessor/
cd maskprocessor/src && make
./mp64 ?d?d?d?d?d?d?d?d > digits.txt
./mp64 -1 ?l?d ?1?1?1?1?1?1
5. 哈希识别
pip install hashid name-that-hash
hashid '$2a$10$...'
hashid '5f4dcc3b5aa765d61d8327deb882cf99'
nth -t '$2a$10$...'
6. 破解流程
1. 识别hash类型 (hashid / nth)
2. 选择工具 (hashcat GPU优先)
3. 字典攻击 (rockyou.txt + 规则)
4. 掩码暴力 (?d?d?d?d?d?d 6位数字)
5. 组合攻击 (字典1 x 字典2)
6. 纯暴力 (最后手段)
常用字典
/usr/share/wordlists/rockyou.txt.gz
SecLists/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt
SecLists/Passwords/Common-Credentials/best1050.txt
SecLists/Usernames/top-usernames-shortlist.txt
常用规则
rules/best64.rule
rules/toggles1.rule
rules/d3ad0ne.rule
rules/dive.rule
--rules=best64
--rules=jumbo
7. 高级技巧
掩码组合
hashcat -m 0 -a 3 hash.txt ?l?l?l?l?d?d?d?d
hashcat -m 0 -a 3 hash.txt 'P@ss?d?d?d'
hashcat -m 0 -a 3 -1 ?l?u -2 ?l?d hash.txt ?1?2?2?2?2?2
分布式破解
split -l 1000 hash.txt hash_part_
cat hash_part_*.potfile | sort -u > all_cracked.txt
Pitfalls
- hashcat模式选错 — 用hashid/nth先识别
- 字典太小 — rockyou.txt是起点不是终点
- 不用规则 — 规则放大字典效果10-100倍
- GPU过热 — 加 --hwmon-temp-abort=90
- 忘记--show — 跑完不看结果白跑
- Hydra被ban — 加 -t 4 限速
- hashcat不能用sudo — GPU驱动权限用普通用户
- WPA握手包不完整 — 确保四次握手完整
- bcrypt极慢 — 正常设计
8. 新增工具
BruteSpray — Nmap结果自动爆破
pip install brutespray
brutespray -f nmap.xml -U users.txt -P passwords.txt
brutespray -f nmap.gnmap --threads 5
Flask-Unsign — Flask密钥破解
pip install flask-unsign
flask-unsign --unsign --cookie 'session_cookie_here'
flask-unsign --wordlist wordlist.txt --unsign --cookie 'session_cookie_here'
flask-unsign --sign --cookie '{"user":"admin"}' --secret 'discovered_key'