Reliance Wireless broadband auto-login (and logout) script(s)

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)

57 thoughts on “Reliance Wireless broadband auto-login (and logout) script(s)

  1. Pingback: Reliance Wireless broadband auto-login script « Kunal Dua Scripts Rss

  2. vineeth

    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….

    Reply
  3. StarB

    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

    Reply
    1. Kumar K

      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. :-)

      Reply
      1. Kunal Post author

        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.

        Reply
        1. Srinivas K

          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.

          Reply
          1. Srinivas K

            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’.

  4. Kishore

    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.

    Reply
  5. sandeep

    it says

    Traceback (most recent call last):
    File “C:reliance.py”, line 13, in
    import urllib2, urllib, cookielib
    ImportError: No module named urllib2

    Reply
  6. Naveed Patel

    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

    Reply
  7. karan_intouch

    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

    Reply
  8. Kunal Post author

    @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.

    Reply
  9. Poweruser

    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’)

    Reply
  10. Pingback: how to overcome Reliance broadband 6 hours limit? - Broadband Forum | TechEnclave

  11. Srinivas K

    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?

    Reply
    1. Kunal Post author

      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

      Reply
      1. Srinivas K

        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.

        Reply
  12. Deepak

    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:~ #

    Reply
  13. Marc

    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.

    Reply
    1. Kunal Post author

      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.

      Reply
  14. vipin rathi

    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

    Reply
  15. Himanshu

    Should I just the login script;
    Or first run the logout script and then run the login script after 1 minute (or the duration b/w logout and login should be even more??).

    Also the interval is pretty important, i.e. I should the run script for the intervals of 1 hr, 2 hr, 4 hr, 8 hr or 16 hr. Please shed some light on that!!

    Reply
  16. Himanshu

    Should I just the login script; Or first run the logout script and then run the login script after 1 minute.

    Also the interval is pretty important, i.e. I should the run script for the intervals of 1 hr, 2 hr, 4 hr, 8 hr or 16 hr. Please shed some light on that!!

    Reply
      1. Sarang Gokhale

        i did a slight modification to the code and included the waiting time of 20hrs each time the login id successful (since my session resets every 24hrs)

        import urllib, http.cookiejar, time, subprocess

        username = ‘1111111111111111’
        password = ‘password’
        host = “209.85.231.104”

        while True:
        out = subprocess.call(“ping -n 5 %s” % host,
        stdout=None,
        stderr=None
        )
        if out == 1:
        jar = http.cookiejar.FileCookieJar(“cookies”)
        opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
        login_data = urllib.parse.urlencode({‘userId’ : username, ‘password’ : password, ‘action’ : ‘doLoginSubmit’})
        resp = opener.open(‘http://10.239.89.15/reliance/login.do’, login_data)
        print(resp)
        time.sleep(5)
        check = subprocess.call(“ping -n 1 %s” % host,
        stdout=None,
        stderr=None
        )
        if check == 0:
        time.sleep(72000)
        time.sleep(60)

        fyi the 209.85.231.104 is ip of google. i used it to check if the login is successful.

        Reply
  17. Rahul

    >>> Python Auto_login.py
    File “”, line 1
    Python Auto_login.py
    ^
    SyntaxError: invalid syntax

    I am getting an error like this when i try running this script…

    Reply
  18. vashishtha

    Hey…

    I am a new reliance broadband customer. I need this script to work but I keep facing this error:

    Traceback (most recent call last):
    File “C:Reliance-autologin.py”, line 24, in
    resp = opener.open(‘http://reliancebroadband.co.in/reliance/logout.do’, login_data)
    File “C:Python32liburllibrequest.py”, line 364, in open
    req = meth(req)
    File “C:Python32liburllibrequest.py”, line 1052, in do_request_
    raise TypeError(“POST data should be bytes”
    TypeError: POST data should be bytes or an iterable of bytes. It cannot be str.

    Please help. I am using Windows 7 with Python v3.2 (64 bit)

    Reply
  19. Shuvam

    Please could somebody upload a video somewhere with a link to show us how to use this wonderful script ??

    Reply
  20. ravi nankani

    Hi kunal ,
    first of all congrats and thanks for the wonderful script . I would however like to suggest 1 change.
    why not use import time and run time.sleep( duration ) in an infinite loop..
    That way you dont need to schedule a cron job in the system , and it will run beautifully on windows systems too .
    Just a side suggestion , but you have done the hard part :P
    cheers
    Ravi

    Reply
  21. sunitha

    Hi Kunal,

    we have requirement to autologin into Workspace is this will work ??.

    if it works how it works for windows XP i dont know about pythonscript how can i run on this ?
    could u please let me know.

    Thanks,
    Sunitha

    Reply
  22. vikrant

    dear
    can u tell me how to use this script.
    i am not from any backgroud of computer.
    pls help me
    thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>