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.
Contents
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.
./alliance_login
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.
Use 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,
file IPConnectInstaller.exe
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.
strings CODE
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.
Conclusion
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.
Debabrata Mandal says
Guys, just email alliance asking them to enable "always logged in or auto login" for yr ID.
WARGames says
Arnab,
The login url in my case was 10.10.254.54/0/up
Hosted over http:// not https://
I tried using your script (with those modified url, id, pass etc.) on rasperry pi, running on Raspbian.
Unfortunately, it didn't work.
In my humble opinion, a better script idea would be to ping Google DNS on 8.8.8.8 or 8.8.4.4 at an interval of say 30 sec. If you are logged in with alliance, only then the ping will work. An unsuccessful ping will mean either you are disconnected or logged out.
If you are disconnected, you cant ping the alliance gateway (In my case 172.18.1xx.xx), if you are logged out you can still ping this IP successfully.
So, a more intelligent script can try to ping Google DNS, if fails would ping alliance gateway IP, if successful would execute the login sequence.
Arnab Satapathi says
Thanks for the feedback.
That's a better approach to solve the issue.
I'll add those extra steps to the script.
Avidipta Sen Sharma says
Arnab,
Did you have time to work on this concept?
Arnab Satapathi says
Unfortunately no, I'll update you with the same, however you can use this approach like below.
if $(ping -q -c2 8.8.8.8 > /dev/null 2>&1) ;
then exit 1;
else ###run your script###;
fi
Avidipta Sen Sharma says
Arnab,
Thanks for all your hardwork.
But, that's script was a bit too basic...
I guess, this would be somewhat a better approach. I would love to see, if you have any feedback/suggestions to improve on it.
# START BELOW THIS LINE
if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
echo "Internet connectivity is all set!"
else
#echo "IPv4 is down"
if ping -q -c 1 -W 1 172.18.xxx.xxx >/dev/null; then
echo "Connectivity is up, you were logged out. Logging you in..."
wget --post-data='login=1&user=USER_NAME&pass=PASSWORD' \
"http://10.254.254.xxx/0/up/" -O - > /dev/null
else
read x x i x< /dev/null; then
echo "Cable or Alliance connectivity is down..."
else
echo "Router is down...Go check it!"
fi
fi
fi
# END ABOVE THIS LINE
[Note: 172.18.xxx.xxx is your Gateway IP, 10.254.254.xxx is your login page IP, and don't forget to put your username and passwords in USER_NAME and PASSWORD fields]
Save this script. Make it executable using
sudo chmod +x login
You are done!
Now trigger the process using the command ./login
*******
This script can be auto-triggered by using another script in the same directory as following:
# START BELOW THIS LINE
#!/bin/bash
while :; do
nohup ./login >/dev/null
sleep 30
done
# END ABOVE THIS LINE
Save this with the filename trigger
Make this executable with
sudo chmod +x trigger
Now, use the command ./trigger to see the magic happening.
This trigger can be set to autorun on boot. That will quell all the login worries once and for all.
Arnab, I hope you will make it even better.
Didn't have time to explain the steps in details. Sorry for that.
Arnab Satapathi says
Undoubtedly this is a much better script.
However I'd prefer to add a cron entry to run the script, one minute interval.
Avidipta Sen Sharma says
Okay, Arnab.
here are more on autorun. There are three ways. (pick any one/pick the one that works for your system)
1. Crontab
2. Set as an autorun service
3. Desktop shortcut method
1. Crontab
[easiest, in my opinion. Hope, Arnab agrees too]
Open command prompt
Type in: crontab -e
If editor selection is prompted, select anyone
Crontab console will be launched.
Add one last line:
@reboot ./trigger
save and exit.
2. Autorun service
Follow the method:
https://raspberrypi.stackexchange.com/a/74407
3. Desktop shortcut
Follow the method:
https://raspberrypi.stackexchange.com/a/44926
You are done!
Your linux/Raspberry Pi will take care of all your login-related woes.
Arnab Satapathi says
Yeah, or even a systemd service.
Like this one, https://www.pcsuggest.com/show-notification-play-sound-low-battery-linux/#Creating_a_systemd_service_file_to_run_the_above_script
Without the Xsession checking part of course.
Aman says
hey....is the login url changed again coz i am unable to get to the login page...Can u plzz help?
Arnab Satapathi says
Not for me, the log in URL is same.
Alekh Kumar says
Arnab I need some help how can I contact you?.
Jairam says
When i tried to using your unix code for login Alliance Broadband and getting this error
pi@rapberrypi:~/Documents $ ./alliance_login
./alliance_login: 4: ./alliance_login: --post-data=login=1&user=myusername&pass=mypassword: not found
Arnab Satapathi says
Hi Jairam,
Seems like you've forgot to add the backslash
\
at the end of the third line.Akash says
Arnob don't change your Website....
Arnab says
OKK boss.
Surojit says
Arnab I always open your site. it is very good to solve my problem...
Arnab says
Thanks 😀
Anupam says
True, even now a days I always login from my Phone's browser and close that page instantly after login. But the internet remains on for a particular time limit (though I never checked that timeout value) even when I start using other devices like desktop or laptop.
Arnab says
That's why I need this auto login script, 😀 running it at interval of 10 minuite on router, scheduled via cron .
tony says
can u please share ,how to do it on windows for other ISP such as balajionline ,hireach ,etc.
how to make auto login for ever on router.
it is loginig out offen...
pllss pls pls help me
Arnab Satapathi says
Send me the details of your broadband connection.
Anupam says
Good work Arnab, I was following your blog from past few months when I switched to Linux after a long break. I found this very interesting as I was looking for same kinda stuff for a long time. But I gave up long back and that time there was 24OnineClient instead of IP Connector.
I was wondering how the connection remains alive without any keep alive or UDP data packets, which I think IP Connector is doing. But you may have seen that part as well. Could you tell me a bit about that in short.
BTW I'm going to reverse the IP Connector tonight and will get in touch with you if I find something missing.
Arnab says
Hi Anupam, nice to meet you 🙂
I've never found any keep alive TCP/UDP connection with the netstat command, even connected directly to alliance's gigabit switch via a Ethernet cable, can't say anything about UDP data packet.
Another thing I've noticed, login from any device, disconnect the first device and access the internet from another device, no repeated login required, so I'm not sure how it's keeping the connection intact.
It'll be great to get some feedback from you after reversing the IP connector, best of luck.