From 8268fed28c978cc7c82c301b677c87bf31f05ca0 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Tue, 20 Feb 2018 13:04:37 +0100 Subject: [PATCH] Make token generator script --- challenge/Dockerfile | 2 + challenge/bin/adlin | 93 ++++++++++++++++++++++++++++++++++++++++++++ subject/adlin.6.md | 38 +++++++++--------- 3 files changed, 113 insertions(+), 20 deletions(-) create mode 100755 challenge/bin/adlin diff --git a/challenge/Dockerfile b/challenge/Dockerfile index 2324ea8..a10bf6c 100644 --- a/challenge/Dockerfile +++ b/challenge/Dockerfile @@ -57,5 +57,7 @@ FROM scratch COPY --from=mirror /out/ / COPY init /init +COPY bin/ /bin/ COPY etc/ /etc/ COPY lib/ /lib/ +COPY sbin/ /sbin/ diff --git a/challenge/bin/adlin b/challenge/bin/adlin new file mode 100755 index 0000000..d1ffa00 --- /dev/null +++ b/challenge/bin/adlin @@ -0,0 +1,93 @@ +#!/bin/sh + +# FUNCTIONS ########################################################### + +# script usage +usage() { + >&2 cat <&2 cat <&2 + exit 2 + ;; + token5) + HDATA=$(dig +short +time=1 +tries=0 adlin.nemunai.re $2 | sed 's/"//g') || { + echo "Try again! Your resolver settings seems not good :(" >&2 + exit 3 + } + echo $HDATA | grep "not here" 2> /dev/null && exit 3 + ;; + *) + echo "Invalid argument: $1" >&2 + usage + exit 1 + ;; +esac + +token_format "${1#token}" "$(token_generator ${1#token} ${HDATA} ${DATA})" ${DATA} diff --git a/subject/adlin.6.md b/subject/adlin.6.md index 81f4c37..e173cde 100644 --- a/subject/adlin.6.md +++ b/subject/adlin.6.md @@ -5,8 +5,6 @@ header: ADvanced LINux administration footer: EPITA SRS 2019 author: Écrit par Pierre-Olivier *nemunaire* Mercier <**nemunaire+adlin@nemunai.re**> date: 2018-02-21 -hyphenate: true -pandoc-version: true ... # NOM @@ -35,61 +33,61 @@ Outrepasser la phase de connexion et devenir **root** sur le système. ## STAGE 1 -**adlin token1 | curl -d @- https://172.23.0.1/challenge1** +**adlin token1 | curl -d @- http://172.23.0.1/challenge** Voir aussi: **modprobe**(8), **fbi**(1), **ip**(8), **ip-link**(8), **ip-address**(8) ## STAGE 2 -**adlin token2 | curl -d @- https://172.23.200.1/challenge2** +**adlin token2 | curl -d @- http://172.23.200.1/challenge** Voir aussi: **ip-route**(8), **crontab**(1) -## STAGE 3 (bonus) +## STAGE 3 -**cat token3 | curl -d @- https://172.23.200.1/challenge3** - -Voir aussi: **mount**(8) - - -## STAGE 4 - -**token4 | curl -d @- https://172.23.200.1/challenge4** +**adlin token3 | curl -d @- https://172.23.200.1/challenge** Voir aussi: **ntpd**(1) -## STAGE 4 +## STAGE 4 (bonus) -**dig** *token4* **| curl -d @- https://172.23.200.1/challenge4** +**cat token4 | curl -d @- https://172.23.200.1/challenge** -Voir aussi: **resolv.conf**(5), **dig**(1) +Voir aussi: **mount**(8) ## STAGE 5 -**adlin toke5 | curl -d @- https://adlin.nemunai.re/challenge5** +**dig** *token5* **| curl -d @- https://172.23.200.1/challenge** + +Voir aussi: **resolv.conf**(5), **dig**(1) + + +## STAGE 6 + +**adlin token6 | curl -d @- https://adlin.nemunai.re/challenge** Voir aussi: **ip-link**(8), **udhcpc**(1), **traceroute**(8), **tcpdump**(1), **sysctl**(8) -## STAGE 6 +## STAGE 7 **mail** [*OPTIONS*] **adlin@nemunai.re** Voir aussi: **dig**(1), **mail**(1) -## STAGE 7 +## STAGE 8 **cat ~/.ssh/***id_ssh* **| curl -d @- https://adlin.nemunai.re/sshkey** Voir aussi: **ssh-keygen**(1) -## STAGE 8 +## STAGE 9 **ssh -p** *23000* **root@adlin.nemunai.re**