challenge: New script to display its own progression in CLI
This commit is contained in:
parent
b594a05416
commit
057993203b
@ -103,6 +103,9 @@ files:
|
||||
|
||||
exec login $@
|
||||
mode: "0755"
|
||||
- path: bin/progression
|
||||
source: pkg/challenge/progression.sh
|
||||
mode: "0755"
|
||||
- path: bin/wg-adlin
|
||||
contents: |
|
||||
#!/bin/sh
|
||||
|
36
pkg/challenge/progression.sh
Executable file
36
pkg/challenge/progression.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
# /proc/cmdline parser (from Gentoo Wiki)
|
||||
cmdline() {
|
||||
local value
|
||||
value=" $(cat /proc/cmdline) "
|
||||
value="${value##* $1=}"
|
||||
value="${value%% *}"
|
||||
[ "$value" != "" ] && echo "$value"
|
||||
}
|
||||
|
||||
PROGRESSION=$(curl -s -f "http://172.23.0.1/api/students/$(cmdline adlin.login)/progress")
|
||||
|
||||
[ $? -ne 0 ] && {
|
||||
echo "Vous ne semblez pas connecté.e. Passez au moins la première étape pour afficher votre progression."
|
||||
exit
|
||||
}
|
||||
|
||||
for CHID in 0 1 2 3 4 5 10 11 12 6 7 8 9
|
||||
do
|
||||
[ $(echo "${PROGRESSION}" | jq -r ".\"${CHID}\".time") != "null" ] && echo -ne " \e[42;30;01m " || echo -ne " \e[41;01m "
|
||||
case $CHID in
|
||||
0) echo -n "rooted";;
|
||||
6) echo -n "Hidden bonus";;
|
||||
7) echo -n "ICMP bonus";;
|
||||
8) echo -n "Disk bonus";;
|
||||
9) echo -n "Email bonus";;
|
||||
10) echo -n "WG tunnel up";;
|
||||
11) echo -n "SSH key shared";;
|
||||
12) echo -n "The end";;
|
||||
*) echo -n "Step $CHID";;
|
||||
esac
|
||||
echo -en " \e[0m "
|
||||
done
|
||||
|
||||
echo
|
@ -519,6 +519,15 @@ files:
|
||||
proxy_set_header X-Forwarded-By 172.23.0.1;
|
||||
proxy_redirect off;
|
||||
}
|
||||
location /api/students/ {
|
||||
proxy_pass https://82.64.31.248;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name adlin.nemunai.re;
|
||||
proxy_set_header Host adlin.nemunai.re;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-By 172.23.0.1;
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
||||
}
|
||||
mode: "0440"
|
||||
|
@ -185,6 +185,9 @@ Pouvez-vous vous connecter ?
|
||||
|
||||
# VALEUR RENVOYÉE
|
||||
|
||||
Une fois le premier palier passé, utilisez le programme **progression(1)** pour
|
||||
avoir un aperçu de votre avancement.
|
||||
|
||||
Votre niveau d'avancement dans ce premier TP permet d'établir la première note
|
||||
de ce cours. Les autres notes seront établies sur vos réponses à des questions
|
||||
de cours entre les sessions ainsi que sur les deux projets que l'on commencera
|
||||
|
Reference in New Issue
Block a user