Asianet dataline internet autoconnect script

In my hostel, we use asianet dataline internet connection. The connection is established through a webpage authentication and it needs to keep that webpage always open in the browser to get the stable connection. Once we login and releave that page, after five minutes it will require a re-login. Its a real hurdle to keep a page open in the browser for internet authentication.

I just analyzed the http requests from that page and automated using the curl utility.

Here is the script it feel, it would be useful for many.


customer=CNXXXX password=XXXXXX

if [ -n “ifconfig | grep -A 1 wlan0 | grep "inet addr"” ]; then

curl –data “auth_user=$customer&auth_pass=$password&accept=Login” &> /dev/null

echo “Connected :)”

while true do sleep 300 curl –data “alive=y&un=$customer” &> /dev/null ;



echo “Wifi not connected”;



Copy down the above script in a text file and rename to

[email protected]:~$ chmod a+x [email protected]:~$ ./ Connected :) </code>

This script has an initial check for ethernet interface. Here it is given Wifi interface, wlan0. If you use a LAN for connection change wlan0 to eth0 and the message as well :)