Skip to main content

A tool for managing CTF challenges and challenge repositories using the OpenChallSpec

Project description

challtools

challtools is a tool that manages CTF challenges and challenge repositories using the OpenChallSpec challenge format.

Installation

To install or upgrade challtools, use pip:

pip3 install --upgrade challtools

Usage

Initialization

challtools can initialize a directory with a challenge template for you. To get a template PHP challenge simply run:

$ challtools init php 
Directory initialized!
$ tree

├── challenge.yml
└── container
    ├── Dockerfile
    └── index.php

1 directory, 3 files

Validating

challtools includes an OpenChallSpec validator. To validate that a challenge complies with the spec, run challtools validate in the challenge directory:

$ challtools validate
No issues raised.
Validation succeeded. No issues detected!

Building

challtools can build docker containers and run build scripts defined in the challenge config for you. Running challtools build with a container defined in the configuration will build that container:

$ challtools build
Flag: example{this_is_the_flag}
Processing container default...
Interpreting "container" as an image build directory
Building image...
Challenge built successfully!

Any solution containers will also be built in the same way.

challtools can also run custom build scripts, defined by adding something like this to the challenge config:

custom:
  build_script: build.sh

This will run the build.sh file before any containers are built with the flag as a command line argument, allowing the flag to be inserted programmatically into the challenge. This eliminates any flag mismatches arising from the flag being defined in multiple places.

Starting

challtools can start challenges for you. This is done by running challtools start in the challenge directory, with the optional -b flag to rebuild containers:

$ challtools start
Started container default
Services:
nc 127.0.0.1 50000

Solving

If a challenge solution is defined, challtools can verify that the challenge is solvable by automatically solving it. It does this by first building the challenge, starting it, starting the solution docker container and checking for if it outputs a flag. This is done using challtools solve:

$ challtools solve
Started container default
Solving...
example{this_is_the_flag}

Challenge solved successfully!

Other

challtools includes many other useful commands:

$ challtools --help
usage: challtools [-h] {allchalls,validate,build,start,solve,compose,ensureid,push,init,spoilerfree} ...

A tool for managing CTF challenges and challenge repositories using the OpenChallSpec

positional arguments:
  {allchalls,validate,build,start,solve,compose,ensureid,push,init,spoilerfree}
    allchalls           Runs a different command on every challenge in this ctf
    validate            Validates a challenge to make sure it's defined properly
    build               Builds a challenge by running its build script and building docker images
    start               Starts a challenge by running its docker images
    solve               Starts a challenge by running its docker images, and procedes to solve it using the solution container
    compose             Writes a compose.yml file to the challenge directory which can be used to run all challenge services
    ensureid            Checks if a challenge has a challenge ID, and if not, generates and adds one
    push                Push a challenge to the ctf platform
    init                Initialize a directory with template challenge files
    spoilerfree         Pretty print challenge information available for participants, for test solving

options:
  -h, --help            show this help message and exit

Autocompletion

challtools supports shell autocomplete through argcomplete. To use it, either activate global completion or enable it manually for bash, zsh or fish (remember to replace my-awesome-script with challtools).

Project details


Download files

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

Source Distribution

challtools-0.5.2.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

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

challtools-0.5.2-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

File details

Details for the file challtools-0.5.2.tar.gz.

File metadata

  • Download URL: challtools-0.5.2.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for challtools-0.5.2.tar.gz
Algorithm Hash digest
SHA256 aed6a5d1144e0e5ce13d3625c7e50aca9a7b724c3a11c34f9671c1417e20ef6d
MD5 3edcf7e49d86d8639f202bd0fcb25094
BLAKE2b-256 61a25e0d3433ad7d6e5ffb8c8622f9f500658e341afbafa4a6dd77b179276ed8

See more details on using hashes here.

File details

Details for the file challtools-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: challtools-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 44.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for challtools-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e49639d851cbf6c6c1a3045e28733ec6b2cf437ac0c589919338324bf2e6c12a
MD5 36d12ab02118736b61ae1c6ba0a245db
BLAKE2b-256 294ba46ab23a3df550185ed0422deccb70946276e78da4a6883384ea7b911d51

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