Import challenges from Markdown
See original GitHub issueWe are in the process of making a lot of challenges, and would be hosting the same CTF in different locations. One option is to add all the challenges to an instance, and then clone/backup the database before use.
However, it would be cool to be able to import challenges from Markdown files. In my opinion it makes more sense to keep the challenges in a challenges
directory as markdown files (so we can use Git to manage them).
YAML frontmatter would be a good option, as you could write the challenge text in markdown, and then have a YAML section on top with title, slug, value, flags/flagRegex and such. The only problem would be to add files… But I guess having a “Import from markdown” button on the New Challenge page would work to prefill things from the markdown file, and then add the files you want yourself. [1]
[1] https://github.com/eyeseast/python-frontmatter
Does that sound like a good idea?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (8 by maintainers)
Top GitHub Comments
Sorry for the late response!
It’s been moved to here! https://github.com/tamuctf/ctfd-portable-challenges-plugin
Let me know if it’s not immediately obvious how to use them. The aim is to have them be usable by anyone, so if you can’t figure it out I want to fix them!
Also I made it for v1.0.0, and it may not work with the newest formats. I don’t know because I’ve been temporarily away from this project since may while I’ve been transitioning in living situations.
I actually recently fished a couple scripts to do just this. It currently supports YAML import and export. They are a part of my teams WIP fork of CTFd, TAMUctf.
To use these script go ahead and download, import-chal.py and export-chal.py and put them in the base of your CTFd repo. (They work elsewhere, but are preconfigured to work there without passing in any args)
Call
./export-chal.py
to take all the challeneges and files from your DB and put it into a YAML file and directory. Call./import-chal.py
to put all those challeneges back. The YAML file follows the this spec.I’d appreciate any feedback or issues you find with the script, and I’m on the CTFd.io slack channel if your ever want to chat!