mcpField
R
recon-dir-scan

recon-dir-scan

github.com/crazymarkyセキュリティ34976 回インストール21 週間前に更新
リポジトリ

recon-dir-scan について

recon-dir-scanは、ウェブアプリのパス、隠しファイル、APIエンドポイントを探すセキュリティテスト向けのディレクトリ・ファイル列挙スキルです。ffufやgobusterなどの利用例に加え、結果の解析、ワードリストの整理、調査結果の保存方法を扱います。

主な機能

  1. 01ffufとgobusterによるパス列挙
  2. 02再帰スキャンとステータスコードによる絞り込み
  3. 03拡張子、隠しファイル、バーチャルホストの探索
  4. 04APIエンドポイントとリクエストパラメーターの列挙
  5. 05スキャン結果の解析・保存・永続化

活用シーン

  1. 01許可された評価で隠しディレクトリやバックアップファイルを発見
  2. 02ウェブアプリのパスを再帰的に調査
  3. 03APIエンドポイントや未公開パラメーターを探索
  4. 04後続のレポート向けに列挙結果を保存

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/crazymarky/pentest-skills --skill recon-dir-scan

インストール後、Claude Code で/recon-dir-scanを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

assets/
api-endpoints.txt
common-dirs.txt
common-files.txt
hidden-files.txt
references/
ffuf_guide.md
gobuster_guide.md
wordlist_guide.md
scripts/
dir_scan_storage.py
ffuf_results_parser.py
merge_wordlists.py
status_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

ステータスコードのフィルター:

コード意味
200OK(有効なページ)
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

ツール選択ガイド

シナリオ推奨ツールコマンド
クイックスキャンffufffuf -w wordlist.txt -u https://target.com/FUZZ
再帰スキャンffufffuf -w wordlist.txt -u https://target.com/FUZZ -recursion
大規模なワードリストgobustergobuster dir -u https://target.com -w wordlist.txt -t 100
複数のターゲットferoxbusterferoxbuster -u https://target.com -w wordlist.txt
隠しファイルffufffuf -w files.txt -u https://target.com/FUZZ
API の検出ffufffuf -w api.txt -u https://target.com/api/FUZZ

ツールの比較:

ツール言語速度機能最適な用途
ffufGo非常に高速高い柔軟性、フィルタリングほとんどのシナリオ
gobusterGo高速シンプルで信頼性が高いクイックスキャン
feroxbusterRust高速複数ターゲット、再帰大規模な評価
dirsearchPython中速ワードリストを内蔵初心者

一般的なワードリスト

ワードリストサイズ説明場所
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,000Apache のデフォルトSecLists
api-endpoints.txt~500API の検出カスタム

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

ヒントとベストプラクティス

  1. 小規模から始める - まず小さなワードリストを使い、すぐに結果を得ます
  2. 積極的にフィルタリングする - -mc を使ってノイズを減らします
  3. レスポンスサイズを確認する - 同じサイズのページは誤検出を示すことがよくあります
  4. 手動で検証する - 興味深い結果は必ず手動で確認します
  5. レート制限 - 適切な遅延を設定してブロックを回避します
  6. ワードリストを組み合わせる - 複数のワードリストを使ってカバレッジを高めます
  7. パラメーターを確認する - クエリパラメーターのファジングも忘れないでください
  8. 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 エンドポイント

コメント