The old “curl” based method stopped working yesterday when Reliance got a new login page as well as a new backend. It seems Reliance is now also looking at Cookies during authentication. Here’s a little Python script that you can execute to automate the process.
If you don’t know what Python is, you better stick to browser based authentication :-)
Needless to say, you can schedule this script as a cron/ launchd job to run periodically and keep you logged in. That’s how I use it, which is why the script doesn’t output anything to prevent unnecessary log “pollution”.
Login Script for Python 2.x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/usr/bin/env python # encoding: utf-8 """ Reliance Login Script for Python 2.x v1.0 Created by Kunal Dua on 2009-12-18 http://www.kunaldua.com/blog/?p=330 This program is free software; you may redistribute it and/or modify it under the same terms as Python itself. """ import urllib2, urllib, cookielib username = '1111111111111111' #replace the text within quotes with your username password = 'password' #replace the text within quotes with your password jar = cookielib.FileCookieJar("cookies") opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar)) response = opener.open("http://10.239.89.15/reliance/startportal_isg.do") login_data = urllib.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'}) resp = opener.open('http://10.239.89.15/reliance/login.do', login_data) |
Update: Logout Script for Python 2.x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/env python # encoding: utf-8 """ Reliance Logout Script v1.0 Created by Kunal Dua on 2009-12-22 http://www.kunaldua.com/blog/?p=323 This program is free software; you may redistribute it and/or modify it under the same terms as Python itself. """ import urllib2, cookielib jar = cookielib.FileCookieJar("cookies") opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar)) response = opener.open("http://10.239.89.15/reliance/login.do", timeout=2) resp = opener.open('http://10.239.89.15/reliance/logout.do') |
Update: Login Script for Python 3.x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/usr/bin/env python # encoding: utf-8 """ Reliance Login Script for Python 3.0 v1.0 Created by Kunal Dua on 2009-12-30 http://www.kunaldua.com/blog/?p=323 This program is free software; you may redistribute it and/or modify it under the same terms as Python itself. """ import urllib, http.cookiejar username = '1111111111111111' #replace the text within quotes with your username password = 'password' #replace the text within quotes with your password jar = http.cookiejar.FileCookieJar("cookies") opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar)) response = opener.open("http://10.239.89.15/reliance/startportal_isg.do") login_data = urllib.parse.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'}) resp = opener.open('http://10.239.89.15/reliance/login.do', login_data) |
[...] the original post: Reliance Wireless broadband auto-login script « Kunal Dua By admin | category: blog script | tags: business, chronicles, created, env-python, [...]
Hi Kunal,
The script works perfectly fine.
Thanks a lot.
Do you mind if I post your script(giving you due credits) on my site?
As long as you include the comments of the script and link back to this site it’s fine.
Thanks a lot… ;D
I tried to run it with .html extension after filling in my user id and password.still its not working.Can u please provide with html based script
hai kunal…
i dont know anythin abt python…i early used a html based page to permanent login…could u plz give html based script for permanent login….
Excellent!!! Works like a charm. Is there a script to logout? Thanks soo much
Hey mate,
I would like to thank you again for this wonderful script. I’m adding it [URL="http://www.indiabroadband.net/reliance-broadband/5173-reliance-broadnet-permanent-login-system-download-3.html"]here[/URL] for the benefit of other users in the community. I’ve kept the whole script as-is. Hope you don’t mind. Thanks again. :)
P.S. A script to logout would be just great to automate the whole process… but only if its not too much of a hassle. Thanks again
Added the logout script.
Thanks for the python script, but you can use the curl as well. You need to make the following changes to the curl method as shown below:
1. Add cookie support
2. Add referrer (not necessary, but makes it spoof any smart ass looking out for people bypassing browsers at Reliance end)
curl -A “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 GTB6 (.NET CLR 3.5.30729)” -e http : / / w w w . reliancebroadband . co . in/reliance/login.do -b relcookie -d “userId=YOUR_USER_ID_HERE&password=YOUR_PASSWORD_HERE” “http : / / w w w . reliancebroadband . co . in / reliance/login.do?action=doLoginSubmit” –connect-timeout 15 –max-time 20 –retry 2 –retry-delay 5
Remove the spaces in the URL above.
Let me know if it worked for you. It works fine with me. :-)
Thanks Kumar. You can of course use curl/ wget – I used Python cause I am more familiar with it .
I’ll add the curl + wget approaches to the post for anyone who’d prefer that.
Just wanted to point out that there are a couple of small errors in the curl command above, specifically with the dashes in front of the 2 retrys. It should read:
curl -A “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 GTB6 (.NET CLR 3.5.30729)” -e http : / / www . reliancebroadband . co . in / reliance / login . do -b relcookie “http : / / www . reliancebroadband . co . in / reliance / logout.do” –connect-time 15 –max-time 20
FYI, I’m on a MacBook Pro running Snow Leopard.
Oops. I accidentally posted the logout script instead of the login script. Anyway, now I see what’s going on. The comments system here is converting 2 dashes (i.e. – -) into a single long dash (i.e. –). To get the curl command for login to work, put 2 dashes in front of ‘connect-timeout’, ‘max-time” and the 2 ‘retry’ s instead of the single long dashes that you see. To get the logout script to work, put 2 dashes instead of the single long dash in front of ‘connect-time’ and ‘max-time’.
Kunal Can you please explain step by step procedure to run this script ..i have installed python software but i still cant make out how to execute your login and logout script…
Please explain step by step so that other users can also follow it.
Your Script works fine on Windows Xp, but its not working on Vista…can you please check the problem
I WANT RELIANCE LOGOUT PAGE
it says
Traceback (most recent call last):
File “C:\reliance.py”, line 13, in
import urllib2, urllib, cookielib
ImportError: No module named urllib2
can sum1 plz giv a step by step explanation of how this works. plz. wud b gr8 help.
thanks in advance.
Hey Kunal,
urllib2 and cookielib don’t exist in latest python version.
I figured out that urllib.request is to be used instead of urllib2 or urllib. Tried copying cookielib.py as well, but the dependency goes on increasing.
Can you port this to 3.1.1 please
Added a script for Python 3.x
Those having troubles like “Cannot find urliib2″ or other problems should try the Python 3.x version.
Hey Thanks… Thanks… a lot script Working fine and cron working also Thank u very much …
great scripts.
Minor modifications:
better to use reliancebroadband.co.in instead of ip address.
Also in logout script
resp = opener.open(‘http://reliancebroadband.co.in/reliance/logout.do’)
is sufficient
@Karan
The IP works better for people who use non Reliance DNS e.g. Open DNS – since the hostname won’t resolve in that case without logging in. Of course this means that the script will need to be updated in case Reliance makes any internal changes.
As for the logout script, as per my testing, if there’s a long gap between login and logout scripts, just visiting the logout page doesn’t always work. Hence the extra step.
Cheers.
It worked for me thanks…
:)
And here is the modified logout script for 3.x.
Note: modified the above given logout script for 2.X.
:D
#!/usr/bin/env python
# encoding: utf-8
“”"
Reliance Logout Script v1.0
Created by Kunal Dua on 2009-12-22
http://www.kunaldua.com/blog/?p=323
This program is free software; you may redistribute it and/or
modify it under the same terms as Python itself.
“”"
import urllib, http.cookiejar
jar = http.cookiejar.FileCookieJar(“cookies”)
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
response = opener.open(“http://10.239.89.15/reliance/login.do”, timeout=2)
resp = opener.open(‘http://10.239.89.15/reliance/logout.do’)
Thanks, it worked now
[...] encoding: utf-8 """ Reliance Login Script v1.0 Created by Kunal Dua on 2009-12-18. Reliance Wireless broadband auto-login (and logout) script(s) Kunal Dua This program is free software; you may redistribute it and/or modify it under the same terms as [...]
I guess it has stopped working once again
It’s working for me.
will it work for any WEBSITE if i Just change the URL?
Hi Kunal,
First off, thanks for providing the Python scripts! My question is do you personally use the Logout script? Wouldn’t just running the Login python script every few minutes using cron work, without touching the Logout script at all?
You are correct. I don’t really use the logout script since I have scheduled the login script as a launcd agent that runs periodically. That’s why I didn’t even write the logout script until someone requested for it.
I do sometimes find myself using it now, to manually “refresh” the session via this shell script:
logout.py
sleep 10 # the logout takes some time to affect
login.py
What makes you choose to “refresh” the session?
Also, how often does your launchd agent run? I’m using cron (only because I don’t know how to use launchd) and have it run every 3 minutes at the moment. Is there an advantage to using launchd over cron?
Sorry if my questions seem obvious to you but I have very little UNIX knowledge, and whatever I’ve learnt has come from web research today, based on my need for autologin for Reliance Wimax. Having said that, I do have a bit of a geek background, and I love learning new stuff.
Getting the Foll. error:
root@ipcop:~ # ./reliance_connect.py
Traceback (most recent call last):
File “./reliance_connect.py”, line 13, in ?
import urllib2, urllib, cookielib
File “/usr/lib/python2.3/urllib2.py”, line 91, in ?
ImportError: No module named ftplib
root@ipcop:~ #
the python version 2.3.4 does not have cookielib :(
kunal,
it wud be great if u gave a step by step guide to ur python script.
i am a ubuntu 9.10 newbie.
thanks
Hi Kunal,
thanks for sharing this script.
it really helpful to me.
Thanks…….
–
Hemant
Thx bro works great….
Does this type of authentication still work? I was trying it until the Reliance login server crashed at 11 PM yesterday and it didn’t seem to help.
Don’t mind but……….
How is a regular user with no scripting knowledge supposed to use this??????
Don’t mind, but I mentioned that if you don’t have any knowledge of Python/ scripting, this probably isn’t for you. In any case, just google for this and you’ll find some kind folks with time to spare at Indian Broadband Forum, also give “noob friendly” instructions on how to set this up. Take a look.
Yes I sure read that…..
And never mind coz I somehow got it to work
Thanks for the script.
I install python 2.6.5 and paste the code in notepad and save it as vipin.py Now when i run python shell and type python vipin.py so it shows syntex error please tell me what should i do now
Excellent work Kunal! Thanks a lot!