ctf-term - A production-ready, cross-platform terminal CTF engine with both CLI and TUI interfaces. Features local SQLite storage, importable challenge packs (YAML), salted-hash flag verification, hint penalties, and live leaderboards.
Created by: Sherin Joseph Roy β’ Co-Founder & Head of Products at DeepMost AI
pip install ctf-termPyPI Package: https://pypi.org/project/ctf-term/
GitHub Repository: https://github.com/Sherin-SEF-AI/CTF-Term
Documentation: See README.md
π‘ Install:
pip install ctf-termβ’ PyPI: https://pypi.org/project/ctf-term/
- π― Clean CLI with all essential CTF commands
- π₯οΈ Beautiful TUI built with Textual for keyboard-first navigation
- π Secure flag verification using SHA256 salted hashes
- π¦ Pack System - import challenges from YAML files
- π Advanced Leaderboard with hint penalties and first blood bonuses
- π©Έ First Blood - 10% bonus points for being the first solver
- πΎ Local Storage - SQLite database with proper indexes
- π¨ Rich Output - beautiful terminal tables and formatting
- π Themes - dark and light modes (TUI)
- β‘ Fast - optimized for low-end machines
- π§ͺ Tested - comprehensive test suite
- π Challenge Stats - tracking solves, hints, and performance
Recommended - Using pipx (isolated environment):
pipx install ctf-termAlternative - Using pip:
pip install ctf-termFrom source:
git clone https://github.com/Sherin-SEF-AI/CTF-Term.git
cd CTF-Term
pip install -e .# Initialize the app
ctf init
# Import a challenge pack
ctf import-pack ~/.ctf/packs/sample.yml
# List challenges
ctf list
ctf list --category crypto
# Show challenge details
ctf show rot13-hello
# Get a hint (view-only, no penalty yet)
ctf hint alice rot13-hello
# Submit a flag
ctf submit alice rot13-hello flag{flap}
# View leaderboard
ctf scoreboard
# Generate flag hash for pack authors
ctf make-flag-hash "flag{example}" "salt"# Launch the interactive TUI
ctf tuiKeyboard Shortcuts:
?/F1- Help/- Search challengesc- Filter by categoryu- Switch/create userEnter- Open challenges- Submit flagh- Show hintg- Go to scoreboardt- Toggle themeEsc- Go back / Close dialogsq- Quit
pack: My CTF Pack
version: 1
challenges:
- id: unique-challenge-id
title: Challenge Title
category: crypto # crypto, pwn, web, forensics, misc
description: |
This is the challenge description.
Can be multi-line markdown.
points: 100
salt: "unique-salt-per-challenge"
flag_hash: "sha256(salt:flag)"
hint: "Optional hint text"
hint_penalty: 20# Method 1: Use the CLI tool
ctf make-flag-hash "flag{my_flag}" "my_salt"
# Method 2: Manual calculation
python3 -c "import hashlib; print(hashlib.sha256(b'my_salt:flag{my_flag}').hexdigest())"For local testing, you can use flag_plain which will be automatically hashed:
challenges:
- id: test-challenge
title: Test Challenge
category: misc
description: "Test description"
points: 50
salt: "s1"
flag_plain: "flag{test}" # Dev only - never commit this!
hint: "This is a hint"
hint_penalty: 10flag_plain to version control!
ctf-term/
βββ src/ctfterm/
β βββ __init__.py
β βββ cli.py # CLI commands
β βββ db.py # Database operations
β βββ model.py # Data models
β βββ packs.py # Pack import/export
β βββ security.py # Flag verification
β βββ paths.py # Path resolution
β βββ settings.py # Settings management
β βββ __main__.py # Python module entrypoint
β βββ tui/ # TUI implementation
β β βββ app.py
β β βββ router.py
β β βββ styles.tcss
β β βββ views/
β β βββ widgets/
β βββ services/ # Business logic
β βββ challenges.py
β βββ users.py
β βββ scoreboard.py
β βββ flags.py
βββ tests/ # Test suite
βββ examples/ # Sample packs
βββ pyproject.toml
- Flags are never stored in plaintext
- Verification uses
SHA256(salt:flag)only - Database stores
saltandflag_hash - No network calls - completely offline
- No dynamic code execution
git clone <repo>
cd ctf-term
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e ".[dev]"pytest
pytest --cov=src/ctfterm --cov-report=htmlruff check src/ tests/
black src/ tests/Co-Founder & Head of Products at DeepMost AI
Sherin is an AI entrepreneur and product leader specializing in enterprise AI systems that connect data, automation, and intelligence. With expertise in scalable, human-centered AI solutions, he focuses on bridging research and application to solve real-world challenges.
- π Portfolio: sherinjosephroy.link
- πΌ LinkedIn: linkedin.com/in/sherin-roy-deepmost
- π¦ X (Twitter): @SherinSEF
- π Mastodon: @sherinjoesphroy
- π» GitHub: github.com/Sherin-SEF-AI
- π§ Contact: sherinjosephroy.link/contact
DeepMost AI builds enterprise AI systems that help organizations think, decide, and grow through intelligent automation and data-driven solutions.
MIT License - see LICENSE file
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Ensure all tests pass
- Submit a pull request
Built with:
Available on PyPI: https://pypi.org/project/ctf-term/