Trivial over the network with Docker and Python

Ïn MundoHackerDay one of the miscellaneous challenges that we proposed was a little trivial where the players should obtain a certain number of correct answers to get the flag.

This idea surged from the trivial on the Pragyan CTF where you may reply to 50 random questions related to India. In that case each player got a set of 50 questions that didn’t change so you could just do trial and error, I decided to be a little bit bad and in this case the questions set is random each time.

Before somebody starts calling me names let me say that we where a little bit “lazy” as we only wrote 15 questions and you just needed to answer 10 so, I wasn’t that bad hehe

You can obtain the image directly from just doing:

docker pull kalrong/trivial

In case you may prefer to test it locally or check the sources you can go to the github repository where I have it stored and from where the build is automatically triggered in hub.docker:

In case you try it with Docker remember to map the container’s port in case you want somebody else to connect.

This is the help of the trivial:

usage: [-h] [-p PORT] [-q QUESTIONS] [-l LOG] [-f FLAG]
                  [-a ANSWERS]

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  Specify which port to be used. Default: 8100
  -q QUESTIONS, --questions QUESTIONS
                        File containing the questions for the trivial.
                        Default: /root/questions
  -l LOG, --log LOG     Folder where the logs will be saved. Defauld: ./log/
  -f FLAG, --flag FLAG  Flag given at the end of the game to the winners.
                        Default: flag{Tr1v14L-RuL3z}
  -a ANSWERS, --answers ANSWERS
                        Number of correct answers before the flag is given.
                        Default: 1

Bot, the docker image and the repository, contain a file with an example questions so you can test it. In case that you run it directly on your machine note that by default the questions file is in /root , this is because I didn’t want to mess around in docker.As you can see in the help the trivial is quite configurable, you can change the port, the log path, questions path, the flag, etcI didn’t have time yet to add the option on how verbose the server is, right now it will give you real-time information in the shell and also create a log file for each ip. The idea is to be able to control what people is doing and see if there are problems with certain questions or, in the worst case, ban somebody.

Hope you enjoy this little tool and don’t forget to leave your suggestions, questions or problems you may find, they will be welcome.

See you around!

This entry was posted in docker, python, tools. Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.