Hack The Box CTF Writeup Template
This repository contains a template/example for my Hack The Box writeups. Below you'll find some information on the required tools and general workflow for generating the writeups. I also write about it on my blog here, which has some details about also posting the markdown on Jekyll.
Installation on Ubuntu
Note: If you use Debian or Mint it may work but your mileage here might vary.
- Install Latex via
sudo apt-get install texlive.
- Install Pandoc via
sudo apt-get install pandoc.
- Install the Pandoc Latex Template
- Download the latest version of the Eisvogel template from the release page.
- Extract the
tar.gzarchive and open the folder.
- Create a pandoc templates folder if it doesn't exist at
- Move the template
eisvogel.texto your pandoc templates folder and rename the file to
- Make sure you have PDFtk installed via
sudo apt-get install pdftk.
Initially I publish my writeups as a password protected pdf, the password set to the root flag for the box. After the box is retired, I post the writeup on my Jekyll site.
Here's the directory structure for my writeup template.
HTB_Writeup-TEMPLATE │ HTB_Writeup-TEMPLATE-d0n601.md │ └───pdf │ │ HTB_Writeup-TEMPLATE-d0n601.pdf │ │ │ └───protected │ │ HTB_Writeup-TEMPLATE-d0n601.pdf │ └───images │ │ badge.png │ │ someotherimage.png │ │ ...
Markdown for pdf
In order to generate a pdf from markdown using pandoc we must format the header correctly. The header for my template is as follows.
--- title: "Hack The Box - BOX NAME HERE" author: Ryan Kozak date: "2019-08-11" subject: "CTF Writeup Template" keywords: [HTB, CTF, Hack The Box, Security] lang: "en" titlepage: true titlepage-text-color: "FFFFFF" titlepage-color: "0c0d0e" titlepage-rule-color: "8ac53e" logo: "./images/badge.png" logo-width: 350 ...
Once the writeup is complete, or you're just looking to build it to see how it's looking as a pdf, issue the following command from your writeup directory.
pandoc --latex-engine=xelatex ./HTB_Writeup-TEMPLATE-d0n601.md -o ./pdf/HTB_Writeup-TEMPLATE-d0n601.pdf --from markdown --template eisvogel --listings
Password Protect pdf
Once the writeup is complete and ready to publish, it should be protected with the root flag so it doesn't violate Hack The Box rules, allow people to cheat, and generally spoil the fun.
To password protect the pdf I use
pdftk. From the root folder of the writup directory issue the following command.
pdftk ./pdf/HTB_Writeup-TEMPLATE-d0n601.pdf output ./pdf/protected/HTB_Writeup-TEMPLATE-d0n601.pdf user_pw v5gw5zkh8rr3vmye7p4ka
Now a password protected pdf will appear in the