Auto connect Alliance Broadband

Standard

Alliance Broadband a known ISP having web based authentication and sharing IP Connector tool for window users only, made my life difficult. It was mandatory to start X and then a browser to complete the authentication even I wanted to just upgrade the box. And that challenge is nicely handled by Linux itself.

The ISP provides URL http://10.254.254.63/0/up/ to visit and Fiddler chrome extension clearly shows the login & logout form used by the authentication process.

Equivalent curl based Login and Logout are

curl -sS -X POST -d "login=LOGIN&user="${USER}"&pass="${PASSWD}"" "${AuthURL}"
curl  -sS -X POST -d "logout" "${AuthURL}"

As the URL is also working over SSL, curl -k can be used to trust the  certificate. Below is a minimal script witch takes argument 1 to connect and 0 to disconnect with ISP as well as indicate presence/absence of Internet, based on ping check.

#!/bin/bash
AuthURL="https://10.254.254.63/0/up/"
USER=your_alliance_user
PASSWD=your_alliance_password

if [ $# -eq 0 ] || [ $1 -gt 1 ]
then
echo "usage $0 1 -> connect ; $0 0 -> disconnect"
exit 1
elif [ $1 -eq 1 ]
then
curl -ksS -X POST -d "login=LOGIN&user="${USER}"&pass="${PASSWD}"" "${AuthURL}" | grep -i incorrect
elif [ $1 -eq 0 ]
then
curl -ksS -X POST -d "logout" "${AuthURL}"
fi

ping -c 3 -w 3 gmail.com > /dev/null 2>&1 && echo "Internet available"  || echo "No Internet"

Thanks to Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s