Skip to content

CTFBridge

CTFBridge is your all-in-one Python toolkit for automating Capture The Flag (CTF) workflows β€” whether you're farming flags, building bots, or writing automation tools.

⚑ What You Can Do

  • 🧩 Fetch challenges, metadata, files, and services
  • 🚩 Submit flags
  • πŸ† Access scoreboards, rankings, and team info
  • πŸ” Manage sessions (login, API tokens, persistence)
  • πŸ€– Build bots, auto-solvers, or monitoring tools with async-first design

✨ Why CTFBridge?

  • βœ… One API for all major platforms β€” CTFd, rCTF, HTB, and more
  • 🧠 Smart auto-detection β€” just give a URL, and we handle the rest
  • 🧩 Challenge enrichment β€” attachments, services and more built in
  • πŸ”„ Persistent sessions β€” save & resume your session state
  • πŸ”Œ Extensible design β€” plug in your own clients or parsers
  • πŸš€ Made for automation β€” fully async and script-friendly

πŸ’» Installation

Install CTFBridge via pip:

pip install ctfbridge

πŸš€ Quickstart Example

Here's a basic example demonstrating how to authenticate, interact with challenges, submit a flag, and view the scoreboard:

import asyncio

from ctfbridge import create_client


async def main():
    # Connect and authenticate
    client = await create_client("https://demo.ctfd.io")
    await client.auth.login(username="admin", password="password")

    # Get challenges
    challenges = await client.challenges.get_all()
    for chal in challenges:
        print(f"[{chal.category}] {chal.name} ({chal.value} points)")

    # Submit a flag
    await client.challenges.submit(challenge_id=1, flag="CTF{flag}")

    # View the scoreboard
    scoreboard = await client.scoreboard.get_top(5)
    for entry in scoreboard:
        print(f"[+] {entry.rank}. {entry.name} - {entry.score} points")


if __name__ == "__main__":
    asyncio.run(main())

πŸ“š Next Steps