CTFd / ctfcli

ctfcli is a tool to manage Capture The Flag events and challenges
https://ctfd.io/
Apache License 2.0
165 stars 66 forks source link

Healthcheck Implementation #151

Open ColdHeat opened 1 month ago

ColdHeat commented 1 month ago

I believe our healthcheck implemtnation is currently lacking so just writing some notes on improving it.

I believe ctfcli should treat a solve script as a kind of template. Possibly a Jinja template and populate specific variables and then run the script.

For example we could have something like:

#!/usr/bin/python3
connect("{{ host }}", {{ port }})

ctfcli will render this to a temporary file and then execute it.

ColdHeat commented 1 month ago

Likely, if the healthcheck file ends in .jinja

We can render it to the same folder with the extension removed and then execute the script.

So for example:

healthcheck: solve.py.jinja

This points to a solution script expecting jinja variables. It gets templated by ctfcli, then written to solve.py and then executed via subprocess.

ColdHeat commented 1 month ago

Although likely it might just make more sense to just keep it reading as argument variables...