重要说明:截至2024年底,Censys 不再向免费账户提供 API 访问权限。
这是一个利用 Censys Search 中存储的证书透明度日志来枚举子域名的工具。它应能返回任何曾由公开 CA 签发过 SSL 证书的子域名。
看它如何运行:
$ python censys-subdomain-finder.py github.com
[*] 正在 Censys 中搜索 github.com 的子域名
[*] 在大约 1.7 秒内找到 42 个 github.com 的唯一子域名
- hq.github.com
- talks.github.com
- cla.github.com
- github.com
- cloud.github.com
- enterprise.github.com
- help.github.com
- collector-cdn.github.com
- central.github.com
- smtp.github.com
- cas.octodemo.github.com
- schrauger.github.com
- jobs.github.com
- classroom.github.com
- dodgeball.github.com
- visualstudio.github.com
- branch.github.com
- www.github.com
- edu.github.com
- education.github.com
- import.github.com
- styleguide.github.com
- community.github.com
- server.github.com
- mac-installer.github.com
- registry.github.com
- f.cloud.github.com
- offer.github.com
- helpnext.github.com
- foo.github.com
- porter.github.com
- id.github.com
- atom-installer.github.com
- review-lab.github.com
- vpn-ca.iad.github.com
- maintainers.github.com
- raw.github.com
- status.github.com
- camo.github.com
- support.enterprise.github.com
- stg.github.com
- rs.github.com
在 https://search.censys.io/register 注册一个(免费)账户
访问 https://search.censys.io/account,并设置两个环境变量,分别填入你的 API ID 和 API 密钥:
export CENSYS_API_ID=...
export CENSYS_API_SECRET=...
或者,您可以使用 .env 文件来持久化存储这些值,方便多次使用:
cp .env.template .env
然后编辑 .env 文件,设置 CENSYS_API_ID 和 CENSYS_API_SECRET 的值。
克隆仓库:
git clone https://github.com/christophetd/censys-subdomain-finder.git
在虚拟环境中安装依赖:
cd censys-subdomain-finder
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
示例用法:
python censys-subdomain-finder.py example.com
将子域名列表输出到文本文件:
python censys-subdomain-finder.py example.com -o subdomains.txt
用法: censys-subdomain-finder.py [-h] [-o OUTPUT_FILE]
[--censys-api-id CENSYS_API_ID]
[--censys-api-secret CENSYS_API_SECRET]
domain
位置参数:
domain 要扫描的域名
可选参数:
-h, --help 显示此帮助信息并退出
-o OUTPUT_FILE, --output OUTPUT_FILE
将子域名列表输出到的文件(默认: None)
--censys-api-id CENSYS_API_ID
Censys API ID。也可以使用 CENSYS_API_ID 环境变量定义(默认: None)
--censys-api-secret CENSYS_API_SECRET
Censys API 密钥。也可以使用 CENSYS_API_SECRET 环境变量定义(默认: None)
应在 Python 3.7+ 上运行。
Censys API 的速率限制为每 5 分钟窗口内 120 次查询。每次调用此工具恰好向 Censys 发起一次 API 调用。
欢迎提交问题或在 Twitter 上 @christophetd 提出建议或意见。