Skip to content
Heroes-Cyber-SecurityPublic

About

Infrastructure-agnostic and DX-first CTF flag server suitable for both Jeopardy and AnD formats

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

77 Commits

Folders and files

Repository files navigation

Trout

Infrastructure-agnostic and DX-first CTF dynamic flag server for
Jeopardy and AnD formats

Features

  • Dynamic Leetspeak Flags — deterministic per-user flag generation via leetspeak character transformation (no hash suffixes)
  • Netcat QnA Server — per-challenge TCP listeners with sequential Q&A flow
  • CTFd Integration — token-based identity assignment and webhook event subscription
  • Discord Notifications — webhook relay for flag generation and solve events
  • Admin Web UI — server-rendered dashboard with challenge CRUD, CTFd config, and Discord settings
  • Internal HTTP API — challenge authors fetch user-specific flags on the internal network
  • Custom CTF Server API — standardized /api/v1/submissions endpoint for non-CTFd platforms
  • SQLite Config — all configuration stored in a single SQLite file

Quick Start

# Build
go build -o trout .

# Run
TROUT_ADMIN_PASSWORD=changeme TROUT_INTERNAL_API_KEY=changeme ./trout --db trout.db

CLI Flags

Flag Default Description
--db trout.db Path to SQLite database
--http-addr :8080 Address for admin UI and webhooks
--internal-addr 127.0.0.1:9125 Address for internal flag API

Environment Variables

Variable Required Description
TROUT_ADMIN_PASSWORD Yes Admin UI password; also derives the DB encryption key and flag pepper
TROUT_INTERNAL_API_KEY Yes Auth key for the internal flag API (/internal/flag)

Architecture

External Network          Internal Network
───────────────           ────────────────
Admin Browser             CTFd / Custom CTF Server
    │                              │
    ▼                              ▼
:8080/admin/*              :8080/ctfd/webhook
(Basic Auth)               :8080/api/v1/submissions

                           Challenge Containers
                                  │
                                  ▼
                            :9125/internal/flag

Players → :{port}/tcp (netcat QnA → flag)

Netcat Flow

  1. Connect to challenge port
  2. Answer sequential questions
  3. Provide CTFd token (or skip for anonymous)
  4. Receive deterministic leetspeak-transformed flag

CTFd Integration

  • Enterprise: CTFd sends webhooks to /ctfd/webhook endpoint
  • Open-Source: Requires installing the Trout plugin (see docs/ctfd-plugin-spec.md)
  • No CTFd: Custom CTF servers can POST to /api/v1/submissions

Internal API

Challenge authors fetch flags for users on the internal network. The challenge_id is the numeric CTFd challenge ID (as a string):

curl http://127.0.0.1:9125/internal/flag?user_id=42\&challenge_id=7

About

Infrastructure-agnostic and DX-first CTF flag server suitable for both Jeopardy and AnD formats

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages