x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/post-exploitation/tools/bloodhound.py.md
View on GitHub# BloodHound.py
- **Category**: Post-Exploitation / Active Directory Enumeration
- **Risk Level**: 🟡 Medium
---
## 描述
基于 Python 的 BloodHound 数据收集器(采集器),可从 Linux 枚举 Active Directory 关系,无需加入域。通过 LDAP 查询收集用户、组、计算机、会话、ACL、信任关系、容器和 GPO 数据。输出 JSON 文件,兼容 BloodHound GUI 和 BloodHound CE 的攻击路径可视化。提供与 C# SharpHound 采集器相同的收集能力,但可在 Kali 上原生运行。
## 安装
```bash
sudo apt install bloodhound.py
# 或通过 pip 安装
pip3 install bloodhound
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `-u <user>` | 用户名(格式:username[@domain])|
| `-p <password>` | 密码 |
| `-d <domain>` | 要查询的域 |
| `-dc <host>` | 覆盖查询的域控(主机名)|
| `-c <methods>` | 收集方法(逗号分隔):`Group`、`LocalAdmin`、`Session`、`Trusts`、`Default`(以上全部)、`DCOnly`(不连接计算机)、`DCOM`、`RDP`、`PSRemote`、`LoggedOn`、`Container`、`ObjectProps`、`ACL`、`All`(除 LoggedOn 外全部) |
| `--zip` | 将输出文件压缩为 ZIP 归档 |
| `-ns <server>` | 用于查询的备用名称服务器 |
| `--dns-tcp` | DNS 查询使用 TCP 而非 UDP |
| `--dns-timeout <sec>` | DNS 查询超时时间(秒,默认:3) |
| `-v` | 启用详细输出 |
| `--hashes <LM:NTLM>` | 用于认证的 NTLM 哈希 |
| `-no-pass` | 不询问密码(配合 `-k` 使用) |
| `-aesKey <hex key>` | 用于 Kerberos 认证的 AES 密钥(128 或 256 位) |
| `--disable-autogc` | 不自动选择全局编录(仅在出现错误时使用) |
| `-w <count>` | 计算机枚举的工作线程数(默认:10)|
| `--use-ldaps` | 默认使用 LDAP over TLS(端口 636)|
| `--ldap-channel-binding` | 使用 LDAP 通道绑定(强制 LDAPS) |
| `-k` | 使用 Kerberos ccache 文件 |
| `--auth-method <method>` | 认证方式:`auto`、`ntlm`、`kerberos` |
| `-gc <host>` | 覆盖查询的全局编录(主机名) |
| `--exclude-dcs` | 计算机枚举时跳过域控 |
| `--computerfile <file>` | 包含计算机 FQDN 的文件,用作白名单 |
| `--cachefile <file>` | 缓存文件(实验性) |
| `-op <prefix>` | 输出文件名前缀字符串 |
## 常用命令
```bash
# 全量收集——收集所有 AD 数据并输出为 ZIP
bloodhound-python -u jdoe -p 'P@ssw0rd' -d corp.local \
-dc dc01.corp.local -c All --zip
# DCOnly 收集——更隐蔽,仅查询域控(不向工作站发起 SMB)
bloodhound-python -u jdoe -p 'P@ssw0rd' -d corp.local \
-dc dc01.corp.local -c DCOnly --zip
# 仅收集特定数据类型
bloodhound-python -u jdoe -p 'P@ssw0rd' -d corp.local \
-dc dc01.corp.local -c Group,ACL,Trusts --zip
# 不在域网络时使用自定义 DNS 服务器
bloodhound-python -u jdoe -p 'P@ssw0rd' -d corp.local \
-dc 192.168.1.10 -ns 192.168.1.10 --zip
# 使用现有 ccache 进行 Kerberos 认证
export KRB5CCNAME=/tmp/jdoe.ccache
bloodhound-python -d corp.local -dc dc01.corp.local -c All --zip -k
# 哈希传递认证
bloodhound-python -u jdoe --hashes :NTHASH -d corp.local \
-dc dc01.corp.local -c All --zip
```
## 注意事项
1. 使用 `DCOnly` 收集方式更隐蔽——它避免向工作站发起 SMB 连接,从而减少事件日志和 EDR 告警。
2. 始终使用 `--zip` 打包输出——BloodHound GUI 和 CE 均可直接导入 ZIP 文件。
3. DNS 解析失败时(常见于实验环境或 VPN 场景),使用 `-ns` 指向域控制器的 IP 地址。
4. `All` 收集方法包含会话数据,需要对每台计算机进行 SMB 访问——这会产生大量网络流量,且可能被主机防火墙阻止。
5. 配合 `bloodhound`(GUI)或 BloodHound CE 可视化攻击路径:到域管理员的最短路径、可进行 Kerberoasting 的用户、可进行 AS-REP roasting 的账户,以及 ACL 滥用链。
---
## 官方参考
- [BloodHound.py (GitHub)](https://github.com/dirkjanm/BloodHound.py)
- [Kali bloodhound.py](https://www.kali.org/tools/bloodhound.py/)
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 |