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/hydra.md
View on GitHub# Hydra
- **Category**: Password Attacks / Online Password Brute-Force
- **Risk Level**: 🔴 High
---
## 描述
支持 50+ 协议的多线程在线密码爆破工具,是渗透测试中在线爆破的首选工具。支持 SSH、FTP、HTTP 表单、RDP、SMB、MySQL、SMTP 等几乎所有常见认证协议。
## 安装
```bash
sudo apt install hydra
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `-l USER` | 使用指定用户名登录(或 -L FILE 加载多个) |
| `-L FILE` | 用户名列表文件 |
| `-p PASS` | 尝试指定密码(或 -P FILE 加载多个) |
| `-P FILE` | 密码列表文件 |
| `-C FILE` | 冒号分隔的 "login:pass" 格式,替代 -L/-P |
| `-t N` | 每目标并行连接数(默认:16) |
| `-T N` | 总并行连接数(用于 -M 模式,默认:64) |
| `-s PORT` | 服务使用非默认端口时在此指定 |
| `-f` | 找到登录凭据后退出(-M 模式:-f 按主机,-F 全局) |
| `-F` | 找到任意有效密码后停止所有 |
| `-v / -V` | 详细模式 / 显示每次尝试的用户名+密码 |
| `-o FILE` | 将找到的凭据写入文件而非标准输出 |
| `-e nsr` | 尝试 "n" 空密码、"s" 用户名作密码、"r" 反转用户名 |
| `-I` | 忽略已有的恢复文件(不等待 10 秒) |
| `-w N` | 等待响应的超时时间(默认:32) |
| `-W N` | 每线程连接间等待时间(秒) |
## 常用命令
```bash
# SSH 爆破(单用户)
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.100
# SSH 爆破(多用户)
hydra -L users.txt -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.100 -t 4
# FTP 爆破
hydra -l admin -P wordlist.txt ftp://192.168.1.100
# RDP 爆破
hydra -l administrator -P wordlist.txt rdp://192.168.1.100
# SMB 爆破
hydra -l administrator -P wordlist.txt smb://192.168.1.100
# MySQL 爆破
hydra -l root -P wordlist.txt mysql://192.168.1.100
# HTTP GET Basic Auth
hydra -l admin -P wordlist.txt http-get://target.com/admin/
# HTTP POST 表单爆破(最重要!)
hydra -l admin -P wordlist.txt target.com http-post-form \
"/login:username=^USER^&password=^PASS^:Invalid credentials"
# 格式:"/path:POST_body:失败标志"
# ⚠️ 失败标志必须匹配登录失败响应正文中的文本
# 运行前请用 Burp Suite 或 curl 确认确切的失败提示信息
# HTTPS 表单爆破
hydra -l admin -P wordlist.txt target.com https-post-form \
"/login:user=^USER^&pass=^PASS^:Login failed"
# 带 Cookie 的爆破(H=Cookie 是自定义请求头的正确语法)
hydra -l admin -P wordlist.txt target.com http-post-form \
"/login:user=^USER^&pass=^PASS^:Invalid:H=Cookie: csrf=abc123"
# 限速防账户锁定(重要!)
hydra -l admin -P wordlist.txt ssh://192.168.1.100 -t 1 -W 5
# 保存结果
hydra -l root -P wordlist.txt ssh://192.168.1.100 -o /tmp/hydra_results.txt
# 从组合文件爆破
hydra -C /usr/share/wordlists/metasploit/http_default_pass.txt http-get://192.168.1.100/
# SMTP 爆破
hydra -l user@target.com -P wordlist.txt smtp://mail.target.com
# VNC 爆破(只需密码)
hydra -P wordlist.txt vnc://192.168.1.100
```
## 注意事项
1. 爆破前先用 `enum4linux` 检查密码策略(账户锁定阈值)。
2. `-t 1 -W 5` 可显著降低账户锁定风险——在生产环境中务必限速。
3. HTTP 表单爆破需要正确识别失败标志——可用 Burp Suite 抓包确认确切的失败提示信息。
4. 某些服务(如 SSH)有内置频率限制——`-t` 保持较低值(4 或以下)以避免触发。
5. 针对 RDP 目标,使用 `crowbar` 而非 hydra——hydra 的 RDP 支持不稳定,crowbar 专为此而生。
6. 输出解读:`[<port>][<proto>] host: <ip> login: <user> password: <pass>` 表示找到有效凭据——立即记录并测试范围内其他服务。`[ERROR] target does not support password authentication` 表示服务禁用了密码认证(如 SSH 仅密钥)——尝试密钥认证或转向其他服务。`[STATUS] <n> attempts completed` 且无成功表示字典已耗尽——尝试其他字典或切换到基于规则的攻击。`[WARNING] target is limiting connections` 表示已触发速率限制——将 `-t` 减少到 1,增加 `-W` 到 5 秒以上。`[ERROR] could not connect to target` 且所有尝试失败表示网络问题或服务不可达——用 `ping` 和 `nc` 检查可达性。
---
## 官方参考
- [THC-Hydra (GitHub)](https://github.com/vanhauser-thc/thc-hydra)
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 |