Add password paper generator

This commit is contained in:
nemunaire 2017-02-22 04:33:23 +01:00 committed by Pierre-Olivier Mercier
parent cc3892463a
commit 60192a0a02
4 changed files with 126 additions and 0 deletions

7
password_paper/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
missfont.log
pass.aux
pass.fdb_latexmk
pass.fls
pass.log
pass.out
teams.pass

12
password_paper/Makefile Normal file
View File

@ -0,0 +1,12 @@
all: pass.pdf
.sh.tex:
sh $< < teams.pass > $@
.tex.pdf:
latexmk --xelatex ${.IMPSRC}
clean:
latexmk -c
.SUFFIXES: .sh .tex .pdf

42
password_paper/README.md Normal file
View File

@ -0,0 +1,42 @@
Password Paper
==============
These scripts generate A4 sheets filled with 2x5
## Requirements
Those scripts requires XeLaTeX and the `texlive-fonts-extra` package.
It uses the TexLive
[dingbat package](http://www.ctan.org/tex-archive/fonts/dingbat/).
The fonts used come from the
[Libertine open fonts project](http://linuxlibertine.org/) and
[Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans).
## Usage
First, you need to generate the file containing teams and passwords.
### Password file format
Passwords are given through a DSV file, using `:` as separator.
For example, a valid `teams.pass` file with 6 teams could be:
```
Abricot:hie9iJ<iexue
Cyan:ooxae^L4aeCh
Vert:ahNgei3Yoo@w
Moutarde:gua3FaiThi]a
Zinzolin:eep7Ac}eeH3a
Safre:di4eeH\ae9io
```
### Generate the PDF
Just run `make` to generate the PDf.

65
password_paper/pass.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/sh
cat <<EOF
\\documentclass[a4paper]{article}
\\usepackage[frenchb]{babel}
\\usepackage[margin=0.6cm,inner=0cm,outer=0cm]{geometry}
\\usepackage{fontspec}
\\usepackage{hyperref}
\\usepackage{xcolor}
\\usepackage{niceframe}
\\definecolor{grey}{rgb}{0.15, 0.15, 0.15}
\\hypersetup{
colorlinks = true,
urlcolor = grey,
linkcolor = grey,
}
\\setmainfont[Ligatures=TeX,Numbers={OldStyle,Proportional}]{Linux Libertine O}
\\setsansfont[Ligatures=TeX,Numbers={OldStyle,Proportional}]{Linux Biolinum O}
\\setmonofont{FantasqueSansMono-Regular.otf}
\\newcommand{\\zz}[3]{\\begin{minipage}{.48\\textwidth}
\\curlyframe{
\\centering
{\\sffamily\\huge Bienvenue au challenge forensic EPITA~!}\\\\
\\vspace{0.7em}
Vous trouverez sur la clef USB le nécessaire pour vous authentifier
auprès de notre serveur.\\\\
\\vspace{0.45em}
Votre équipe : #1 -- \\emph{#2}\\\\
Mot de passe : \\texttt{#3}\\\\
\\vspace{0.4em}
\\url{https://fic.srs.epita.fr/}
}
\\end{minipage}
}
\\begin{document}
EOF
ID=0
while read LINE
do
ID=$(($ID + 1))
NAME=$(echo $LINE | cut -d : -f 1 | sed 's/\\/\\textbackslash{}/g;s/&/\\&/g;s/%/\\%/g;s/\$/\\$/g;s/#/\\#/g;s/_/ /g;s/{/\\{/g;s/}/\\}/g;s/~/\\textasciitilde{}/g;s/\^/\\textasciicircum{}/g')
PASS=$(echo $LINE | cut -d : -f 2- | sed 's/\\/\\textbackslash{}/g;s/&/\\&/g;s/%/\\%/g;s/\$/\\$/g;s/#/\\#/g;s/_/\\_/g;s/{/\\{/g;s/}/\\}/g;s/~/\\textasciitilde{}/g;s/\^/\\textasciicircum{}/g')
echo "\\zz{$ID}{$NAME}{$PASS}"
if [ $(($ID % 2)) = 0 ]
then
echo
fi
done
cat <<EOF
\\end{document}
EOF