Skip to main content

CTFd challenge downloader and organizer

Project description

CTFd Downloader

CTFd インスタンスから課題情報と添付ファイルを自動取得・整理する Python ツールです。

機能

  • Token 認証またはユーザ名/パスワード認証による CTFd API へのアクセス
  • 課題一覧・詳細情報の取得
  • 添付ファイルの自動ダウンロード
  • challenges/<Category>/<Challenge Name>/ の構造で整理保存
  • メタデータ(JSON)と README(Markdown)の自動生成
  • 並列ダウンロードとリトライ機能
  • ロギングとエラーハンドリング

インストール

pip install ctfd-dl

設定

  1. config.example.yamlconfig.yaml にコピー
  2. config.yaml を編集して CTFd インスタンスの情報を設定
base_url: "https://ctf.example.com"
api_token: "your_api_token_here"  # 推奨
# または
username: "your_username"
password: "your_password"
output_dir: "./challenges"
concurrency: 4

または環境変数を使用:

export CTFD_BASE_URL="https://ctf.example.com"
export CTFD_API_TOKEN="your_api_token_here"

使用方法

パッケージをインストールすると、ctfd-dl コマンドが利用可能になります。

# 基本的な使用
ctfd-dl --config config.yaml

# コマンドライン引数で設定を上書き
ctfd-dl --base-url https://ctf.example.com --token YOUR_TOKEN --output ./my_challenges

# メタデータのみ取得(ファイルダウンロードをスキップ)
ctfd-dl --skip-download

# 詳細ログを出力
ctfd-dl --verbose

出力構造

challenges/
└─ <Category>/
   └─ <Challenge Name>/
      ├─ files/
      │  ├─ attached1.zip
      │  └─ script.py
      ├─ metadata.json
      └─ README.md

注意事項

  • 法的注意: 他者運営の CTFd インスタンスにアクセスする場合は、必ず運営者の許可を得てください。
  • セキュリティ: ダウンロードした実行ファイルは直接実行せず、適切な環境で解析してください。
  • サーバ負荷: 並列ダウンロード数(concurrency)を適切に設定し、サーバに負荷をかけないようにしてください。

ライセンス

MIT License

作者

tikisan (GitHub: @tikipiya)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctfd_dl-1.0.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ctfd_dl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ctfd_dl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ctfd_dl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94d39a41305285f205dffc25984f06d2d62a0a1f5283f6dcdfc86fab3fcb14c5
MD5 90c10a2883b7911c732086dfeeb0e089
BLAKE2b-256 8b616a58240464fffaa879bb9d87c9b9f9ceabad0c66be68ad01d17985c05139

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page