Finally I've started using Alliance broadband through Wi-Fi and ditched super slow, very costly Airtel 2G internet, though 2.83 Km straight line distance from the AP and the "line of sight" is blocked with thousands of trees.
P.S- Alliance broadband is a local ISP/WISP, popular in eastern parts of India, specially West Bengal.There is a little obstacle with Alliance broadband, you already know that if you are an existing user, everyone have to login to a web based login portal to actually use the internet.
Some time it's not possible to open a browser at all, like login from a router, and I don't want to always open a browser just for login purpose, so decided to do it with the command line.
The script for Alliance broadband auto login
I'm using the wget command for maximum portability, as wget is preinstalled in almost every UNIX like systems, even embedded inside busybox, anyway other HTTP clients like cURL could be used too.
In my case the login URL is https://10.254.254.8/0/up/ , posibbly it's same for everyone.
UPDATE: Login URL now changed to 10.254.254.39/0/up/ , both HTTP and HTTPS login works. Change the login URL to 10.254.254.39/0/up/ from 10.254.254.8/0/up/ in the script, if needed.
#!/bin/sh wget -q --no-check-certificate \ -A "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" \ --post-data="login=1&user=USR_NAME&pass=PASS" \ "https://10.254.254.8/0/up/" -O - > /dev/null
Don't forget to replece the USR_NAME and PASS with your username and password respectively.
I'hv saved this script as alliance_login, save it as whatever name you want and make it executable.
chmod +x alliance_login
And execute it to login the broadband account.
The scripts should work in any UNIX like system, including Android phones and wifi router running OpenWrt or dd-wrt. Tested with my OpenWrt router, which is running 24x7 to download torrents.
Login process works with the both HTTPS and HTTP, but I prefer to use the https one. Changing the user agent is not mandatory, but sometime it takes longer with the default user agent.
Add the auto login script to crontab
Yo may want to add this script to crontab to run automatically after every 10 minuite to keep yourself logged in.
crontab -e to edit the cron job entries and add the line bellw there.
*/10 * * * * /usr/bin/alliance_login > /dev/null 2>&1
I'hv moved the script to
/usr/bin folder, it seems more convinient, you could save it wherever you want, just change the path according to yours.
There are many Cron job apps for Android, use any of them in case you are planning to use it with Android.
So how did I find this method?
Alliance bradband login page, https://10.254.254.8/0/up provides an auto login application for windows, IPConnectInstaller.exe.
Little bit of reverse engineering this exe file revealed exactly what I was looking for.
Here how I did this,
IPConnectInstaller.exe: PE32 executable (GUI) Intel 80386, for MS Windows, RAR self-extracting archive
So it's a RAR archive, lets de-compress it.
mkdir -p ~/ip_connector unrar e IPConnectInstaller.exe ~/ip_connector/ cd ~/ip_connector/ file Connector.exe
Connector.exe: PE32 executable (GUI) Intel 80386, for MS Windows, UPX compressed
So the binary is compressed with upx, lets de-compress it again,
upx -d Connector.exe
Now extarct the exe file with 7zip linux command,
7z e Connector.exe
There is a file CODE, which contains information related to the login process, let's extarct the strings from this file.
The output is very long, so I'm not copy pasting it here, but here you could find some hint about what the Connector.exe does.
And finally, this information was enough to write the alliance broadband auto login script.
Hope now you can login to the account without opening a browser and enjoyed this guide as well. Don't forget to share your thoughts, and let me know if something is not working.