子域名收集器:Subfinder

Subfinder 是一款高效的子域名收集工具,本文详细介绍了其安装、配置与使用方法,适合信息安全和渗透测试人员参考。

一、介绍

Subfinder 是一款由 ProjectDiscovery 团队开发的高效子域名收集工具,支持多种被动信息源,能够帮助信息安全从业者和渗透测试人员快速发现目标资产的子域名。本文将详细介绍 Subfinder 的安装、环境配置及常用用法

二、环境准备(安装 Golang)

Golang 官网:https://golang.google.cn/dl/

本文章以o1.21.6 为例

  1. 下载后执行程序,点击 Next fig_96401

  2. 默认是勾选的,点击 Next 即可 fig_77574

  3. 点击 Change 更改安装位置,也可以直接点击 Next fig_53782

  4. 点击 Install

    fig_12591

  5. 最后点击 Finish 完成

    fig_42374

  6. 右键电脑点击属性,点击高级系统设置 fig_99464 fig_17621 fig_78693 环境变量 fig_53561

  7. 测试输入命令

1
2
3
4
$ go version
C:\Windows\system32\cmd.exe 0 x ri所权 
C:\Users\mz>go version go version go1.21.6 windows/386 
C:\Users\mz>

三、安装 Subfinder

  1. 设置 Golang 代理
1
$ go env -w GOPROXY=https://goproxy.cn,direct 
  1. 执行命令安装
1
$ go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest 
  1. 执行完后你的C盘用户目录里,go/bin 目录下就会出现文件

    fig_78289

四、使用 Subfinder

  1. 输入命令看能否正常使用
1
2
3
4
5
6
7
8
9
$ subfinder -h 
Subtinder is a subdomin discovery tool that di scovers subdomains for websites by using passive online sources.
Usage: subfinder [flag]
Flags:
INPUT: -d,-1ist string -domain string[] domains to tind subdomains for file containing list of domains for subdomain di scovery
SOURCE: ab1e sources. d non-recursive sources recursive -B,-Bources string e exclude-sources string[] specific sources to use for discovery (-s crtsh, ithub). Use -ls to display all avai1 use only sources that can handle subdomains recursively rather than both recursive an use al1 sources for enumeration(s1ow) sources to exclude from erumeration (-es alienault, zoomyeapi)
PILTER: "natch string] -filter string[ subdomain or list of subdomain to match (file or comma separated) subdomain or 1ist of subdomain to filter (file or comma separated)
RATE-LIMIT: -r1,-rate-limit int maximm rumber of http requests to send per second (g1obal)
rls,-rate-limits value maximm rumber of http requests to send per second tor providers in keyvalue format (rls
  1. 参数详解
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Flags:
输入:
-d, -domain string[] 要查找子域名的域名
-dL, -list string 包含要进行子域名发现的域名列表的文件
来源:
-s, -sources string[] 用于发现的特定来源(-s crtsh,github)。使用 -ls 显示所有可用来源。
- 仅使用能够递归处理子域的来源(例如 subdomain.domain.tld vs domain.tld)
- 使用所有来源进行枚举(速度较慢)
-es, -exclude-sources string[] 从枚举中排除的来源(-es alienvault,zoomeyeapi)
过滤:
-m, -match string[] 要匹配的子域名或子域名列表(文件或逗号分隔)
-f, -filter string[] 要过滤的子域名或子域名列表(文件或逗号分隔)
速率限制:
-rl, -rate-limit int 每秒发送的最大HTTP请求数
-rls value 每秒为四个提供程序发送的最大HTTP请求数(以 key=value 格式,例如 rls "hackertarget=10/s,shodan=15/s")
- 用于解析的并发goroutines数(仅在 -active 模式下)(默认 10)
更新:
-up, - 更新 subfinder 到最新版本
-duc, -disable-update-check 禁用自动 subfinder 更新检查
输出:
-o, -output string 要写入输出的文件
-oJ, - 以 JSONL(ines) 格式写入输出
-oD, -output-dir string 要写入输出的目录(仅对 -dL 有效)
-cs, -collect-sources 在输出中包含所有来源(仅在 -json 模式下有效)
-oI, - 在输出中包含主机IP(仅在 -active 模式下有效)
配置:
-config string 配置文件路径(默认为 "$CONFIG/subfinder/config.yaml")
-pc, -provider-config string 提供程序配置文件路径(默认为 "$CONFIG/subfinder/provider-config.yaml")
-r string[] 逗号分隔的要使用的解析器列表
-rL, -rlist string 包含要使用的解析器列表的文件
-nW, ...