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:
π 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¶
- See more advanced examples in the Usage Guide.
- Check which platforms are supported on the Supported Platforms page.
- Browse the complete API Reference.