#!/bin/bash # This script performes an attempt to login to the KTHOPEN wireless lan. # If you make any improvements of the script (such as error handling), # please share them with me! / landreas@kth.se USER= PASS= if [ -z $USER ] then echo "ERROR: Please specify USER and PASS at the top of this script." exit -1; fi TMP_COOKIE_FILE=tmp_cookies.txt FORM_PAGE='https://login.kth.se/login.jsp?returnPage=https://login.sys.kth.se/login2.html&data=' LT_VALUE=$(wget --no-check-certificate \ --save-cookies $TMP_COOKIE_FILE \ --keep-session-cookies \ --output-document=- \ --quiet \ $FORM_PAGE | grep "name=\"lt\"" | cut -d\" -f6) wget --no-check-certificate \ --load-cookies $TMP_COOKIE_FILE \ --output-document=- \ --quiet \ --post-data "_eventId=submit<=$LT_VALUE&usedMethod=password&username=$USER&password=$PASS" \ $FORM_PAGE > /dev/null rm $TMP_COOKIE_FILE