Skip to content
Thomas Gerot edited this page Apr 2, 2017 · 1 revision

The Structure

Our write-ups repositories use a well refined structure for organizing write-ups by their points and categories. We also use a strict structure for our write-ups files to make the content easily readable.

CTF Directories

For a given year (e.g. 2017) a directory is placed in the repository's root directory (e.g. write-ups-2017). Each CTF has it's own directory named using the event name and year (e.g. breakin-ctf-2017') where the events name uses hyphens instead of spaces. Inside this directory is a folder for each challenge category (e.g. forensics or web) as used in the competition. This folder must be created by the user (as shown below).

CTF README's

Also under the CTF's directory is a head README.md file which contains information about the event such as links to the competition page, the scoreboard, competition description, and more importantly, links to all of challenges. Depending if the write-up has a locally written write-up in the repository, links to external write-ups, or challenges without any known write-ups, labeled as either Completed, External only, or Missing respectively. This file will be generated by the script.

Categories and Challenges

Inside of the category folders lie individual challenges in their own directories (e.g. mission-improbable-20) which also is always lowercase, and uses hyphens including the challenge's point value on the end of the directory name. Inside this directory is a README.md file containing write-ups, challenge information, and external write-ups links. All files needed to replicate the challenge should be placed in the same directory.

Challenge Write-ups

The README.md files for each challenge contain information about the category, point value, solves, description, as well as a local write-up (if available), and various links to other blogs and websites where competitors post their own write-ups. Most challenges have a decent quantity of links, but lack a local write-up (write some if you can!) both of which can be tracked in the repository's main README.md with the coverage badges.


Generating a CTF write-ups directory

Note: It is highly recommended you use a UNIX-based shell for this process, however it isn't that difficult through Windows' command prompt or even the OS GUI.

The following instructions will use the 2017 repository and picoCTF competition for examples. Substitute your year and CTF for your own.

  1. Clone the write-ups repository for your specific year.
git clone https://github.com/ctfs/write-ups-2017
  1. Navigate to the write-ups directory.
cd write-ups-2017
  1. Verify your CTF is not already in the repository
ls -l | grep "pico"
  1. Create a directory for your CTF write-ups (if there are spaces in the event name, replace with hyphens)
mkdir picoctf-2017
  1. Navigate into the created directory
cd picoctf-2017
  1. Create folders for each challenge category
mkdir web-exploitation cryptography forensics misc reverse-engineering
  1. Navigate into the first category you would like to begin adding challenges to
cd forensics
  1. Create directories for each challenge (include the point value)
mkdir digital-camouflage-50 special-user-agent-50
  1. Place challenge files (files you download from the challenge's description) in the respective challenge's directory (use GUI or wget to download and move challenge files)

  2. Also in the challenge's directory, create a file called info (no file extension) that contain's the problem's description. This can also be done using the OS's GUI.

echo "Join our IRC channel to find the flag!" > info
  1. Repeat process for each challenge in the competition.

  2. Navigate to the parent of the write-ups directory (when you type ls the write-ups repository should appear in the directory).

  3. Clone the write-ups-tools package

git clone https://github.com/ctfs/write-ups-tools
  1. Navigate into the cloned repository.
cd write-ups-tools
  1. Run ctfgen.py with Python and supply it the parameters (in order) Path to your CTF's directory, name of files containing desscription (in your case should just be info), and CTF event name (With original capitalization and spacing; it goes at the top of files in the directory).
python ctfgen.py ../write-ups-2017/picoctf-2017 info "picoCTF 2017"
  1. Navigate back to your CTF's directory, and into any challenge's directory
cd ../../write-ups-2017/picoctf-2017/forensics/digital-camouflage-50
  1. Verify a README.md file exists
ls -l | grep "README"
  1. Navigate to the head of your CTF's directory (e.g. write-ups-2017/picoctf-2017)
cd ../../
  1. Remove all the info files in your CTF
find . -name "info" -delete