#!/bin/bash #Script to connect to gasthof wifi #Pull random webpage to get login page # DNS must point to gasthof network, request must be by name # Resolves, then HTTP request gets 303 'See Other' #Extract magic token, then send login+token to 192.168.2.1:1000/fgtauth? # Do it in a tmp dir to stop collecting index.html's tmp=$(mktemp -d) cd $tmp echo "nameserver 213.33.99.70" > /etc/resolv.conf wget http://wookware.org/ magic=$(cat index.html | tail -1 | sed 's/^.*magic" value="//' | sed 's/".*//') wget -o /dev/null --post-data="username=Gast&password=GASTSECRET&magic=$magic" http://192.168.2.1:1000/ rm -f index.html rm -f index.html.* cd .. rmdir $tmp