Simon Westphahl

Wi-Fi Login Script

By Simon Westphahl on June 20, 2010

I’m using Ubuntu as my primary operating systems, but this should work on most Linux/Unix systems. If you are running Ubuntu you have to install the following packages: zenity, libnotify-bin, curl.

#!/bin/bash
# Usage: $./hs-wifi-login <username>
# Author: Simon Westphahl <westphahl@gmail.com>
# Required: zenity, libnotify, curl

if test -z "$1"
    then exit
else
    USERNAME=$1
fi

if ! PASSWORD=$(zenity --entry --title "Login to HS Wi-Fi" \
                --text "Enter password for user $USERNAME" --hide-text)
    then exit
fi
if !(curl -d "user=$USERNAME&password=$PASSWORD&cmd=authenticate&Login=Log+In" \
     https://securelogin.arubanetworks.com/cgi-bin/login)
    then notify-send -i error "Could not log in to HS Wi-Fi with user $USERNAME"
else
    notify-send -i checkbox \
        "Succesfully logged in to HS Wi-Fi with user $USERNAME"
fi

Comments