recon-dir-scan について
recon-dir-scanは、ウェブアプリのパス、隠しファイル、APIエンドポイントを探すセキュリティテスト向けのディレクトリ・ファイル列挙スキルです。ffufやgobusterなどの利用例に加え、結果の解析、ワードリストの整理、調査結果の保存方法を扱います。
主な機能
- 01ffufとgobusterによるパス列挙
- 02再帰スキャンとステータスコードによる絞り込み
- 03拡張子、隠しファイル、バーチャルホストの探索
- 04APIエンドポイントとリクエストパラメーターの列挙
- 05スキャン結果の解析・保存・永続化
活用シーン
- 01許可された評価で隠しディレクトリやバックアップファイルを発見
- 02ウェブアプリのパスを再帰的に調査
- 03APIエンドポイントや未公開パラメーターを探索
- 04後続のレポート向けに列挙結果を保存
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ crazymarky/ pentest-skills --skill recon-dir-scanインストール後、Claude Code で/recon-dir-scanを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
assets/api-endpoints.txtcommon-dirs.txtcommon-files.txthidden-files.txtreferences/ffuf_guide.mdgobuster_guide.mdwordlist_guide.mdscripts/dir_scan_storage.pyffuf_results_parser.pymerge_wordlists.pystatus_code_analyzer.py詳細
ディレクトリとファイルの列挙
認可に関する警告
重要: 適切な認可を得ずにディレクトリをスキャンすると、侵入の試みとして検知される場合があります。必ず以下を確認してください。
- 対象アプリケーションの所有者から書面による許可を得ていること
- 認可されたテストの範囲が定義されていること
- 現地の規制を遵守していること
前提条件
システムにインストールしておく必要があるツール:
- ffuf -
go install github.com/ffuf/ffuf@latest - gobuster -
go install github.com/OJ/gobuster/v3/cmd/gobusterdir@main
任意のツール:
- feroxbuster -
cargo install feroxbuster - dirsearch -
pip install dirsearch - dirb - パッケージマネージャーからインストール
クイックスタート
ディレクトリ列挙で最もよく使われるコマンド:
高速ディレクトリスキャン(ffuf)
ffuf -w wordlist.txt -u https://target.com/FUZZ
ステータスコードを指定した再帰スキャン
ffuf -w wordlist.txt -u https://target.com/FUZZ -mc 200,301,302 -recursion
Gobuster によるクイックスキャン
gobuster dir -u https://target.com -w wordlist.txt -t 50
よくあるシナリオ
シナリオ 1:基本的なディレクトリファジング
ディレクトリやファイルを見つける必要がある場合:
ffuf -w wordlist.txt -u https://target.com/FUZZ
パラメーター:
-w wordlist.txt- ワードリストのパス-u- FUZZ キーワードを含むターゲット URL-t- スレッド数(デフォルト:40)
例:
ffuf -w /usr/share/seclists/Discovery/Web-Content/common.txt -u https://target.com/FUZZ
シナリオ 2:ステータスコードによるフィルタリング
特定の HTTP ステータスコードのみが必要な場合:
ffuf -w wordlist.txt -u https://target.com/FUZZ -mc 200,301,302,403
ステータスコードのフィルター:
| コード | 意味 |
|---|---|
| 200 | OK(有効なページ) |
| 301,302 | リダイレクト |
| 403 | 禁止(ディレクトリは存在するが、アクセスできない) |
| 401 | 認証が必要 |
否定フィルター(コードを除外):
ffuf -w wordlist.txt -u https://target.com/FUZZ -mc 200,204,301,302,307,401,403 -mc 404
シナリオ 3:再帰スキャン
検出したディレクトリを再帰的にスキャンする必要がある場合:
ffuf -w wordlist.txt -u https://target.com/FUZZ -recursion -recursion-depth 2
パラメーター:
-recursion- 再帰スキャンを有効にする-recursion-depth- 最大深度(デフォルト:0)
例:
ffuf -w wordlist.txt -u https://target.com/FUZZ -recursion -recursion-depth 3
シナリオ 4:ファイル拡張子のファジング
特定の種類のファイルを探す場合:
ffuf -w wordlist.txt -u https://target.com/FUZZ -X .txt
複数の拡張子:
ffuf -w wordlist.txt -u https://target.com/FUZZ -X .txt,.php,.bak,.old
ワードリストから拡張子を指定:
# Format: extension:wordlist
ffuf -w extensions.txt:EXT -w words.txt:FUZZ -u https://target.com/FUZZ.EXT
シナリオ 5:隠しファイルの検出
バックアップファイル、設定ファイル、隠しファイルを探す場合:
# Hidden dotfiles
ffuf -w hidden_files.txt -u https://target.com/FUZZ
# Backup files
ffuf -w wordlist.txt -u https://target.com/FUZZ -X .bak,.backup,.old,.tmp,.swp
# Config files
ffuf -w config_files.txt -u https://target.com/FUZZ
確認すべき一般的な隠しファイル:
.git
.env
.env.local
.env.backup
config.php.bak
wp-config.php.bak
.gitignore
.htaccess
シナリオ 6:仮想ホストの検出
仮想ホストのルーティングをテストする場合:
ffuf -w vhosts.txt -u https://target.com -H "Host: FUZZ.target.com"
パラメーター:
-H- カスタムヘッダーを追加- ヘッダー値の
FUZZ- ワードリストの項目に置き換えられる
例:
ffuf -w subdomains.txt -u http://192.168.1.100 -H "Host: FUZZ.example.com"
シナリオ 7:API エンドポイントの検出
API エンドポイントを列挙する場合:
ffuf -w api_endpoints.txt -u https://target.com/api/FUZZ
一般的な API パターン:
/api/v1/FUZZ
/api/v2/FUZZ
/graphql
/api/graphql
/rest/FUZZ
HTTP メソッドを指定する場合:
ffuf -w endpoints.txt -u https://target.com/api/FUZZ -X GET,POST,PUT,DELETE
シナリオ 8:パラメーターのファジング
隠れたパラメーターを見つける場合:
ffuf -w params.txt -u https://target.com/page?FUZZ=test
値のファジング:
ffuf -w values.txt -u https://target.com/page?param=FUZZ
シナリオ 9:Gobuster によるスキャン
ffuf の代わりに gobuster を使う方法:
# Basic scan
gobuster dir -u https://target.com -w wordlist.txt -t 50
# With status filtering
gobuster dir -u https://target.com -w wordlist.txt -t 50 -k --status-codes 200,301,302,403
# Recursive
gobuster dir -u https://target.com -w wordlist.txt -t 50 -r
# With extensions
gobuster dir -u https://target.com -w wordlist.txt -t 50 -x php,txt,html
シナリオ 10:Feroxbuster によるスキャン
Rust 製の最新のディレクトリスキャナー:
# Basic scan
feroxbuster -u https://target.com -w wordlist.txt
# With recursion and status codes
feroxbuster -u https://target.com -w wordlist.txt -C 404 --depth 3
# Scan multiple URLs
feroxbuster -u https://target.com -u https://target2.com -w wordlist.txt
ツール選択ガイド
| シナリオ | 推奨ツール | コマンド |
|---|---|---|
| クイックスキャン | ffuf | ffuf -w wordlist.txt -u https://target.com/FUZZ |
| 再帰スキャン | ffuf | ffuf -w wordlist.txt -u https://target.com/FUZZ -recursion |
| 大規模なワードリスト | gobuster | gobuster dir -u https://target.com -w wordlist.txt -t 100 |
| 複数のターゲット | feroxbuster | feroxbuster -u https://target.com -w wordlist.txt |
| 隠しファイル | ffuf | ffuf -w files.txt -u https://target.com/FUZZ |
| API の検出 | ffuf | ffuf -w api.txt -u https://target.com/api/FUZZ |
ツールの比較:
| ツール | 言語 | 速度 | 機能 | 最適な用途 |
|---|---|---|---|---|
| ffuf | Go | 非常に高速 | 高い柔軟性、フィルタリング | ほとんどのシナリオ |
| gobuster | Go | 高速 | シンプルで信頼性が高い | クイックスキャン |
| feroxbuster | Rust | 高速 | 複数ターゲット、再帰 | 大規模な評価 |
| dirsearch | Python | 中速 | ワードリストを内蔵 | 初心者 |
一般的なワードリスト
| ワードリスト | サイズ | 説明 | 場所 |
|---|---|---|---|
| common.txt | ~4,600 | 一般的なディレクトリ/ファイル | SecLists |
| raft-medium-directories | ~30,000 | 中程度のカバレッジ | SecLists |
| raft-large-directories | ~60,000 | 広範なカバレッジ | SecLists |
| directory-list-2.3-medium | ~220,000 | 包括的 | DirBuster |
| apache.txt | ~5,000 | Apache のデフォルト | SecLists |
| api-endpoints.txt | ~500 | API の検出 | カスタム |
SecLists のパス:
/usr/share/seclists/Discovery/Web-Content/
/usr/share/seclists/Discovery/Web-Content/api/
/usr/share/seclists/Discovery/Web-Content/raft/
高度なテクニック
レート制限
リクエストを遅くして検出を回避します:
ffuf -w wordlist.txt -u https://target.com/FUZZ -rate 100
User-Agent のローテーション
ffuf -w wordlist.txt -u https://target.com/FUZZ \
-H "User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1)"
認証
# Basic auth
ffuf -w wordlist.txt -u https://user:[email protected]/FUZZ
# Header-based auth
ffuf -w wordlist.txt -u https://target.com/FUZZ \
-H "Authorization: Bearer TOKEN"
Cookie/セッションベース
ffuf -w wordlist.txt -u https://target.com/FUZZ \
-H "Cookie: session=YOUR_SESSION_TOKEN"
出力のマッチング
レスポンスの内容でフィルタリングします:
ffuf -w wordlist.txt -u https://target.com/FUZZ \
-mr "admin" # Match response containing "admin"
ffuf -w wordlist.txt -u https://target.com/FUZZ \
-ms 1520 # Match specific response size
出力形式
結果の保存
# ffuf JSON output
ffuf -w wordlist.txt -u https://target.com/FUZZ -o results.json
# ffuf plain output
ffuf -w wordlist.txt -u https://target.com/FUZZ -o results.txt
# Gobuster output
gobuster dir -u https://target.com -w wordlist.txt -o results.txt
スキャンの再開
# ffuf resume
ffuf -w wordlist.txt -u https://target.com/FUZZ -resume-ffuf
ヒントとベストプラクティス
- 小規模から始める - まず小さなワードリストを使い、すぐに結果を得ます
- 積極的にフィルタリングする -
-mcを使ってノイズを減らします - レスポンスサイズを確認する - 同じサイズのページは誤検出を示すことがよくあります
- 手動で検証する - 興味深い結果は必ず手動で確認します
- レート制限 - 適切な遅延を設定してブロックを回避します
- ワードリストを組み合わせる - 複数のワードリストを使ってカバレッジを高めます
- パラメーターを確認する - クエリパラメーターのファジングも忘れないでください
- 403 を探す - Forbidden レスポンスから有効なパスが判明することがあります
リソース
スクリプト
scripts/ffuf_results_parser.py- ffuf の JSON 結果を解析してフィルタリングしますscripts/merge_wordlists.py- 複数のワードリストを統合し、重複を除去しますscripts/status_code_analyzer.py- レスポンスパターンを分析します
参考資料
references/ffuf_guide.md- ffuf の包括的なリファレンスreferences/gobuster_guide.md- Gobuster の使用方法に関するドキュメントreferences/wordlist_guide.md- ワードリストの選択と作成
シナリオ:ディレクトリスキャン結果の永続化
ディレクトリスキャンの結果をデータベースに永続化する場合:
# Manual entry after discovering directories
python .claude/skills/recon-dir-scan/scripts/dir_scan_storage.py \
--host-ip 192.168.1.100 \
--url "https://example.com" \
--path "/admin" \
--status 200 \
--size 1234 \
--subsystem "Web Application"
パラメーター:
--host-ip- 対象ホストの IP(必須)--url- ベース URL(必須)--path- 発見されたパス(必須)--status- HTTP ステータスコード(任意)--size- レスポンスサイズ(任意)--tool- 使用したツール(デフォルト:ffuf)--subsystem- サブシステム名(任意)
データベースの場所: ./data/results.db
関連スキル: results-storage - データのクエリ、レポートの生成
アセット
assets/common-dirs.txt- 一般的なディレクトリ名assets/common-files.txt- 一般的なファイル名assets/hidden-files.txt- 隠しファイルとバックアップファイルassets/api-endpoints.txt- 一般的な API エンドポイント