Created
December 4, 2014 14:44
-
-
Save thejh/ade91a2d19131368325a to your computer and use it in GitHub Desktop.
RUB LAK automatic login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while true; do | |
errorstr="$(ping -c1 -n -w1 8.8.8.8 2>&1 | grep '100% packet loss')" | |
if [ "$errorstr" != '' ]; then | |
echo -n 'reconnecting... ' | |
./uni_reauth.sh | |
else | |
echo 'still ok' | |
fi | |
sleep 1 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
loginid="USERNAME" | |
# password in base64 so that it's not directly readable when you open the file. stupid, I know. | |
password="$(echo 'PASSWORD_IN_BASE64' | base64 -d)" | |
loginpage="$(curl -s -S https://login.rz.ruhr-uni-bochum.de/cgi-bin/start)" | |
code="$(echo "$loginpage" | grep '<input type=hidden name="code"' | cut -d'"' -f4)" | |
ipaddr="$(echo "$loginpage" | grep '<input type="ipaddr" name="ipaddr" ' | cut -d'"' -f8)" | |
curlresp="$(echo password="$password" | curl -s -S https://login.rz.ruhr-uni-bochum.de/cgi-bin/laklogin \ | |
-d code="$code" \ | |
-d loginid="$loginid" -d ipaddr="$ipaddr" -d action=Login \ | |
-d '@-' -d ShowTraffic=0)" | |
echo "$curlresp" | grep '<small><small>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment