Skip to main content

Challenge Structure for ctfcli

CTFd does not impose any specific challenge structure. You are free to organize your challenges however you wish. However, we at CTFd have a specific challenge structure that we like to use.

This is also the primary challenge structure that we use as part of ctfcli.

From ctfcli you can also generate a similar project structure with ctf challenge new.

challenge/
├── challenge.yml
├── docker-compose.yml
├── Dockerfile
├── README.md
├── dist/
│   └── distributed.exe
├── src/
│   ├── requirements.txt
│   ├── serve.sh
│   └── server.py
└── writeup/
└── WRITEUP.md
  • challenge.yml

    This file specifies the data that will be sent to CTFd to control things like the challenge name, value, etc. It is probably the most important file to provide as it also specifies what files, connections, etc. you would like users to be able to see.

    You can use the base challenge specification yaml as a template: https://github.com/CTFd/ctfcli/blob/master/ctfcli/spec/challenge-example.yml.

  • Dockerfile

    The Dockerfile specifies the server component for a given challenge.

  • docker-compose.yml

    At this time, a docker-compose.yml file (or compose.yml) is not directly used by CTFd. However, it may be useful for local development. In the future we may create a dedicated challenge infrastructure specification document.

  • README.md

    The README specifies any kind of documentation that you'd like to provide with your challenge. CTFd itself doesn't make use of it but other software (like Github) will render the README alongside your challenge.

  • writeup/WRITEUP.md

    The WRITEUP document is where you will write out the process of solving your challenge. In addition within the writeup folder you should include any images/files/documents that help with your challenge. You can link to these files from your WRITEUP markdown file.

  • src/

    Within the src folder we typically store all the source code for our challenge. This lets us keep it organized to a single folder instead of having lots of file littering our top directory.

  • dist/

    Within the dist folder we typically store any files that are going to be distributed to participants. This lets us clearly see that the files here are meant to be shared. However, it is important to note that files in the dist folder must still be referenced from the challenge.yml file.