helviojunior/enumdns
GitHub: helviojunior/enumdns
模块化 DNS 侦察工具,集主机枚举、BloodHound 数据解析和域名威胁分析于一体,用于发现和评估 DNS 资产安全风险。
Stars: 21 | Forks: 7
# EnumDNS
EnumDNS 是一款模块化的 DNS 侦察工具,能够从多种来源(包括字典、BloodHound 文件和 Active Directory 环境)解析主机。
可用模块:
1. 暴力破解
2. 枚举 DNS 记录(CNAME、A、AAAA、NS 等)
3. 从 txt 文件解析 DNS 主机
4. 从 BloodHound 文件(.zip 或 .json)解析 DNS 主机
5. **威胁分析** - 针对域名抢注、同形异义词攻击和恶意域名检测的高级域名安全分析
## 主要功能
- [x] 执行暴力 DNS 枚举以发现主机名
- [x] 支持自定义 DNS 后缀列表
- [x] 自动识别云提供商服务
- [x] 获取多种 DNS 记录类型(例如 CNAME、A、AAAA)
- [x] 解析每个主机区域的 **SOA** 并将每条记录链接到该区域(按区域缓存)
- [x] 枚举所有域控制器的名称和 IP(在 Active Directory 环境中)
- [x] 支持 SOCKS(socks4/socks5)代理
- [x] 具备 8 种检测技术的**威胁分析**(域名抢注、比特抢注、同形异义词攻击等)
- [x] **全面的测试覆盖率**(威胁分析模块覆盖率达 98.4%)
- [x] 其他高级功能和增强特性
## 获取最新版本
请在此处查看如何通过你的操作系统流程获取最新版本:[INSTALL.md](https://github.com/helviojunior/enumdns/blob/main/INSTALL.md)
# 使用方法
```
$ enumdns -h
______ ____ _ _______
/ ____/___ __ ______ ___ / __ \/ | / / ___/
/ __/ / __ \/ / / / __ '__ \/ / / / |/ /\__ \
/ /___/ / / / /_/ / / / / / / /_/ / /| /___/ /
/_____/_/ /_/\__,_/_/ /_/ /_/_____/_/ |_//____/
Usage:
enumdns [command]
Examples:
- enumdns recon -d test.com -o enumdns.txt
- enumdns recon -d test.com --write-jsonl
- enumdns recon -L domains.txt --write-db
- enumdns brute -d test.com -w /tmp/wordlist.txt -o enumdns.txt
- enumdns brute -d test.com -w /tmp/wordlist.txt --write-jsonl
- enumdns brute -L domains.txt -w /tmp/wordlist.txt --write-db
- enumdns resolve bloodhound -L /tmp/bloodhound_computers.json -o enumdns.txt
- enumdns resolve bloodhound -L /tmp/bloodhound_files.zip --write-jsonl
- enumdns resolve bloodhound -L /tmp/bloodhound_computers.json --write-db
- enumdns resolve file -L /tmp/host_list.txt -o enumdns.txt
- enumdns resolve file -L /tmp/host_list.txt --write-jsonl
- enumdns resolve file -L /tmp/host_list.txt --write-db
- enumdns threat-analysis -d example.com --all-techniques -o threats.txt
- enumdns threat-analysis -d example.com --typosquatting --homographic --write-db
- enumdns threat-analysis -L domains.txt --all-techniques --max-variations 5000 --write-jsonl
Available Commands:
brute Perform brute-force enumeration
help Help about any command
recon Perform recon enumeration
report Work with enumdns reports
threat-analysis Advanced domain threat analysis for typosquatting and malicious domains
version Get the enumdns version
Flags:
-D, --debug-log Enable debug logging
-h, --help help for enumdns
-X, --proxy string Proxy to pass traffic through: (e.g., socks4://user:pass@proxy_host:1080
-q, --quiet Silence (almost all) logging
-o, --write-text-file string The file to write Text lines to
Use "enumdns [command] --help" for more information about a command.
```
## 免责声明
本工具仅用于教育目的,或仅供在您已获得明确/合法授权的环境中使用。
## 威胁分析模块
`threat-analysis` 模块提供高级的域名安全分析,以检测可能被用于攻击您组织的恶意域名。该模块实现了多种技术来识别可疑域名:
### 可用技术
- **域名抢注**:检测存在键盘相邻错误的域名(例如用 `goggle.com` 代替 `google.com`)
- **比特抢注**:识别由单比特翻转错误产生的域名
- **同形异义词攻击**:检测与 ASCII 字符外观相似的 Unicode 字符(例如带有西里尔字母 'р' 的 `рaypal.com`)
- **字符插入/删除**:查找添加或删除了字符的域名
- **字符换位**:检测相邻字符互换的情况
- **TLD 变体**:分析可疑的 TLD(.tk、.ml、.ga 等)
- **子域名模式**:识别诸如 "secure-"、"login-"、"verify-" 的钓鱼模式
### 范围与标志
- 范围:变体发生在可注册域名(PSL)上。左侧的子域名将被保留。
- `microsoft.com` → 变化部分为 `microsoft.*`
- `recife.pe.gov.br` → 变化部分为 `pe.gov.br` 并添加后缀 `gov.br`(`recife` 保持不变)。
- 后缀焦点:`gov.br` 包含后缀伪装(例如 `g0v.br`、同形异义词),且不会修改子域名。
- TLD 替换:使用真实后缀与 `--target-tlds` 的并集(默认包含 `com.br, net.br, org.br`)。
- 去重输出:文本写入器会避免重复行;使用 `--emit-candidates` 可打印生成的候选内容(包括 NX)。
新增/高级标志:
- `--span-last3`:针对最后 3 个标签进行操作(从右向左突变第 3 个标签,保留最后 2 个作为后缀),适用于复杂情况。
- `--focus-suffix=`:强调特定于后缀的技术(例如 `gov.br`)。
- `--emit-candidates`:在探测之前将所有生成的候选内容写入输出。
- `--brand-combo`:添加品牌前缀/后缀模式。
### 快速示例
```
# 使用所有 techniques 进行基础威胁分析
enumdns threat-analysis -d yourcompany.com --all-techniques
# 仅使用特定 techniques
enumdns threat-analysis -d yourcompany.com --typosquatting --homographic
# 从 file 分析多个 domains
enumdns threat-analysis -L company-domains.txt --all-techniques --write-db
# 使用自定义 limits 进行高负载分析
enumdns threat-analysis -d example.com --all-techniques --max-variations 10000
# 输出到不同 formats
enumdns threat-analysis -d example.com --all-techniques --write-jsonl --write-csv
# 使用 candidates 重点关注 gov.br(包括 NX)
enumdns threat-analysis -d recife.pe.gov.br --all-techniques --focus-suffix=gov.br --emit-candidates -o gov-br.txt
# 使用更广泛的 TLD swaps 的 com.br
enumdns threat-analysis -d yeslinux.com.br --all-techniques --target-tlds com,net,org,co,info,io,com.br,net.br,org.br
```
### 安全功能
- **风险评分**:每个域名都会根据多个指标获得一个威胁分数(0.0-1.0)
- **威胁指标**:自动识别可疑模式
- **速率限制**:可配置的限制,以防止使 DNS 服务器过载
- **代理支持**:与 SOCKS 代理配合使用以进行隐蔽分析
有关详细文档,请参阅 [documentation.md](documentation.md#análise-de-ameaças-threat-analysis---guia-detalhado)。
## SOA 解析
在每种枚举模式(`recon`、`brute` 以及 `resolve` 子命令)下,EnumDNS 都会
解析每个主机所属区域的 **Start Of Authority (SOA)** 记录,并将每条解析出的记录链接到该 SOA。
SOA 作为专用对象存储(表 `soa` / Elasticsearch 索引 `-soa`),
其中包含区域顶点、主权威名称服务器 (MNAME)、负责邮箱 (RNAME)、序列号以及
刷新/重试/过期/最小 TTL 计时器。每个 `Result` 都带有一个指向其区域顶点的 `soa` 列,
因此该链接会在每种输出格式(DB、CSV、JSON、Elastic)中保留。
### 经过优化且具备缓存感知的查找
SOA 解析由内存缓存支持,因此无论您枚举该区域中的多少主机,
一个区域的 SOA **最多只查询一次**:
- 对于诸如 `a.b.c.example.com` 的主机,EnumDNS 会首先针对该主机
及其父域名检查缓存,从最具体到最不具体
(`a.b.c.example.com` → `b.c.example.com` → `c.example.com` → `example.com`),并在
到达裸 TLD 之前停止。
- 在缓存命中时,会重用缓存的 SOA 对象,**无需进行 DNS 查询**。
- 在缓存未命中时,会发送一次 SOA 查询;权威答复会揭示真实的
区域顶点(例如 `example.com`),随后该顶点将被缓存,供该区域的所有后续主机使用。
这使得在大型字典上进行枚举时依然保持快速,同时仍能将每条记录归因于其权威区域。
## 免责声明
本工具仅供教育目的使用,或仅限在您已获得明确/合法授权的环境中使用。
标签:EVTX分析, Linux安全, Terraform 安全, 日志审计