ctf

CTFD Server -- ctfd-cli bulk challenge import


I've built a script that automates the building of a CTFd sever and I've installed the ctfd-cli. I am a bit confused on how exactly I can import all of my challenges into the CTFd server. This was my workflow:

I have a csv with all of the columns possible for a challenge. Each row is a challenge. I created a script called 'csv2yaml.py' which converts those challenges into one yaml with what was described in the format needed for the challenges under challenge specifications. I am getting a massive error when I try the following:

docker exec ${CONTAINER_PREFIX}-ctfd-1 bash -c "cd /opt/ctfcli_project && ctf challenge add /CTFd/embedded_CTFd && ctf challenge install /CTFd/embedded_CTFd"

that location is where my challenge.yml is. I think I'm confused on this part. Is every challenge supposed to have its own yaml or can I have them all in one yaml file? If so, then is it a formatting issue? If not, How can I possibly go by importing all of my challenges then? Am I to create a directory for every challenge with the challenge name, then have a subdirectory 'Files' and a 'challenge.yml' for each challenge? If that is so, what would the workflow be? Do I have to add that challenge directory to the config file under [challenges] and then import each directory individually? Or can I have one primary directory named "Challenges" and then have the subdirectories for every challenge? Any help would be greatly appreciated.


Solution

  • Based on the challenge specification you have linked, it appears that every challenge must be in its own .yaml file.

    This file represents the base specification of your challenge.

    You may have formatting issues as well.

    You can also skip this parsing step and upload your CSV directly via the CTFd interface. I recommend that you double-check your challenges CSV file against the provided template.