#!/bin/bash clear # colors # Zijn de studs aanwezig ? bilal=1.118 dimitri=0.169 dylan=1.231 chahid=0.166 robin=0.187 matthias=0.165 robrecht=0.183 #wouter=0.49 tom=0.199 sam=0.174 arno=0.171 joeri=0.136 glenn=0.114 jelle=0.202 yannick=0.185 george=0.175 kenzo=0.172 #aaron=0.186 kevin=0.182 jens=0.173 christof=0.162 function ok { echo -ne '\E[00;32m\tok\E[00;00m' let totaal+=$punten true } function nok { echo -ne '\E[47;31m\tNOK\E[00;00m' } studs=( $bilal $dimitri $dylan $chahid $robin $matthias $robrecht $tom $sam $arno $joeri $glenn $jelle $yannick $george $kenzo $kevin $jens $christof ) studnames=( bilal dimitri dylan chahid robin matthias robrecht tom sam arno joeri glenn jelle yannick george kenzo kevin jens christof ) aantal=${#studs[@]} let aantal=aantal-1; echo -e 'IP student\tSSH\tapache2\tnaam\t8472a\t8472b\t31337a\t31337b' for masjien in `seq 0 $aantal` do totaal=0 echo -n ${studs[$masjien]} ${studnames[$masjien]}':' ip=${studs[$masjien]} punten=0 ssh root@172.28.$ip exit && ok || nok punten=20 rm index.html 2>/dev/null wget -q 172.28.$ip':80' -O index.html && ok || nok punten=20 grep -ie ${studnames[$masjien]} index.html >/dev/null 2>&1 && ok || nok punten=10 rm index.html 2>/dev/null wget -q 172.28.$ip':8472' -O index.html && ok || nok punten=5 grep 8472 index.html >/dev/null 2>&1 && ok || nok punten=10 rm index.html 2>/dev/null wget -q 172.28.$ip':31337' -O index.html && ok || nok punten=5 grep 31337 index.html >/dev/null 2>&1 && ok || nok echo -e '\t' ${studnames[$masjien]}':'$totaal'ptn' done