
⚡ Censysの証明書透過ログを使用してサブドメイン列挙を実行します。
重要な注意: 2024年後半現在、Censys は無料アカウントへのAPIアクセスを提供しなくなりました。
これは、Censys Search に保存された証明書公開鍵ログを使用してサブドメインを列挙するツールです。公開CAによってSSL証明書が発行されたことのあるすべてのサブドメインを返します。
動作例:
$ python censys-subdomain-finder.py github.com
[*] Censys で github.com のサブドメインを検索中
[*] 約1.7秒で github.com の42のユニークなサブドメインを発見
- 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 シークレットを2つの環境変数に設定します:
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
usage: censys-subdomain-finder.py [-h] [-o OUTPUT_FILE]
[--censys-api-id CENSYS_API_ID]
[--censys-api-secret CENSYS_API_SECRET]
domain
positional arguments:
domain スキャンするドメイン
optional arguments:
-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クエリのレート制限があります。このツールを1回呼び出すごとに、Censys に対して1回のAPIコールが行われます。
提案やコメントがあれば、Issue を開く か、@christophetd にツイート してください。