Most of the Reliance Wireline Broadband User/Customer know how it feels when connecting to the internet with the Login Page which keeps asking Username and Password everytime they connect to Internet and some users feel annoyed when the connection becomes Idle when it is not used and the connection gets logged out. I also felt annoyed of this. On searching the Internet, I came to know of that a python script is written by Kunal Dua, and is found at http://www.kunaldua.com/blog/?p=330 initially and it was further improved by Anoop John, founder of Zyxware Technologies.
It is released as a freeware.
Since this is Free Software, feel free to use, modify and distribute the script.
The script is as below.
#!/usr/bin/env python
# encoding: utf-8
"""
# Reliance Login Script for Python 2.x v1.0
#
# Copyright (c) 2009 Kunal Dua, http://www.kunaldua.com/blog/?p=330
# Copyright (c) 2012 Anoop John, http://www.zyxware.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
"""
import urllib2, urllib, cookielib, time, re, sys
username = 'reliance username'
password = 'reliance password'
'''You don't normally have to edit anything below this line'''
debug = False
check_interval = 600
if ((len(sys.argv) > 2) and (sys.argv[2] == '-d')): debug = True
def get_url(url, data=None, timeout=60, opener=None):
'''get_url accepts a URL string and return the server response code, response headers, and contents of the file'''
'''ref: http://pythonfilter.com/blog/changing-or-spoofing-your-user-agent-python.html'''
req_headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; U; ru; rv:5.0.1.6) Gecko/20110501 Firefox/5.0.1 Firefox/5.0.1'
}
request = urllib2.Request(url, headers=req_headers)
if not opener:
jar = cookielib.FileCookieJar("cookies")
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
response = opener.open(request, data)
code = response.code
headers = response.headers
html = response.read()
return code, headers, html, opener
def is_internet_on():
'''test if the machine is connected to the internet'''
if debug: print "Testing"
try:
code, headers, html, opener = get_url('http://74.125.113.99', timeout=10)
if debug: print html
if re.search('google.com', html):
return True
else:
return False
except:
if debug: print "Error"
return False
return False
def internet_connect():
'''try to connect to the internet'''
code, headers, html, cur_opener = get_url("http://10.239.89.15/reliance/startportal_isg.do", timeout=10)
if debug: print html
login_data = urllib.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'})
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/login.do', data=login_data, opener=cur_opener)
if debug: print html
def internet_disconnect():
'''try to disconnect from the internet'''
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/login.do', timeout=10)
if debug: print html
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/logout.do', opener=cur_opener)
if debug: print html
def internet_keep_alive():
'''login and keep the connection live'''
while True:
if not is_internet_on():
internet_connect()
if debug: print "Not connected"
else:
if debug: print "Connected"
pass
time.sleep(check_interval)
def print_usage():
print "Reliance Netconnect AutoLogin"
print "-----------------------------"
print "usage:" + sys.argv[0] + " [login|logout]\n"
print "If there are no arguments it runs in an infinite loop and will try to remain connected to the internet."
keep_alive = True
if (len(sys.argv) > 1):
op = sys.argv[1]
if op == 'login':
internet_connect()
keep_alive = False
elif op == 'logout':
internet_disconnect()
keep_alive = False
elif op == 'keep-alive':
keep_alive = True
pass
else:
print_usage()
keep_alive = False
''' default action without any arguments - keep alive'''
if keep_alive:
internet_keep_alive();
This script can easily be downloaded here: Click Here
On clicking the above, some users might be asked by the browser where to save the file, if so please save it to the desired location.
If it just displays a page with the script, don't worry, go to File -> Save As option and save it to the desired location without changing the extension.
I recommend you to download this script from the above URL rather than coping and pasting, because it might cause some syntax problem and python interpreter is gonna throw a syntax error.
Once you are ready with the script downloaded, you can now download the Python Interpreter.
This script is compatible with Python version 2.x, so you have choose the correct version before downloading.
Linux users have python pre-installed with the OS, so you just have to check with the version of python installed.
In order to do that, go to Terminal or Konsole and issue the following command after # or $, in my case it is root@kali i.e., user@domain
[Note the command is case-sensitive and you need to use the command as shown below]
python -V
or
python --version
E.g.
root@kali:~# python -V
Python 2.7.3
root@kali:~# python --version
Python 2.7.3
On newer versions of linux, Python 3.x comes preinstalled, you can additionally install Python 2.x using the Package Manager that comes with the appropriate distribution of Linux.
Windows users can download the python interpreter from here:
https://www.python.org/downloads/windows/
At this time of writing this article, Python 2.7.8 is the latest.
You can install it on the default location, i.e., C:\Python27
After installation of Python interpreter, you can copy the above downloaded script to the C:\Python27
Open the script using IDLE or Notepad by right clicking on the file.
The only thing to edit the script is to replace the "username" with the username/id and "password" with the password provided. This line is found under import line
Please note, after editing the username and password, those two lines should look as below
username = '3xxxxxxxxx2'
password = 'password'.
The username and password should be withing the single quotes " ' ".
You can save this script.
Before running this script, please make sure you are logged out of the reliance broadband using the login page by going to http://www.reliancebroadband.co.in or http://10.239.89.15
After doing that, make sure you are in C:\Python27
Hold "Shift" key on the keyboard and right click on the empty space, Select "Open command window from here".
In the command prompt you can find this
C:\Python27>
You have three options,
In order to just login, You need to type "python reliance-login.py login" without quotes, i.e.,
C:\Python27>python reliance-login.py login
In order to just logout, You need to type "python reliance-login.py logout" without quotes, i.e.,
C:\Python27>python reliance-login.py logout
In order to login and keep the connection alive even when not used, You need to type "python reliance-login.py" without quotes, i.e.,
C:\Python27>python reliance-login.py
There are some situation where the connection gets logout due to connection drop and several other reasons, but this script is somehow reliable than just pinging some address, this much number of times in this much number of minutes.
In order to keep the connection alive, you need to keep the PC running this script active and powered on.
There is also an another way to keep the connection active without any PC but with the help of wireless router itself, I will test it and post soon.
It is released as a freeware.
Since this is Free Software, feel free to use, modify and distribute the script.
The script is as below.
#!/usr/bin/env python
# encoding: utf-8
"""
# Reliance Login Script for Python 2.x v1.0
#
# Copyright (c) 2009 Kunal Dua, http://www.kunaldua.com/blog/?p=330
# Copyright (c) 2012 Anoop John, http://www.zyxware.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
"""
import urllib2, urllib, cookielib, time, re, sys
username = 'reliance username'
password = 'reliance password'
'''You don't normally have to edit anything below this line'''
debug = False
check_interval = 600
if ((len(sys.argv) > 2) and (sys.argv[2] == '-d')): debug = True
def get_url(url, data=None, timeout=60, opener=None):
'''get_url accepts a URL string and return the server response code, response headers, and contents of the file'''
'''ref: http://pythonfilter.com/blog/changing-or-spoofing-your-user-agent-python.html'''
req_headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; U; ru; rv:5.0.1.6) Gecko/20110501 Firefox/5.0.1 Firefox/5.0.1'
}
request = urllib2.Request(url, headers=req_headers)
if not opener:
jar = cookielib.FileCookieJar("cookies")
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
response = opener.open(request, data)
code = response.code
headers = response.headers
html = response.read()
return code, headers, html, opener
def is_internet_on():
'''test if the machine is connected to the internet'''
if debug: print "Testing"
try:
code, headers, html, opener = get_url('http://74.125.113.99', timeout=10)
if debug: print html
if re.search('google.com', html):
return True
else:
return False
except:
if debug: print "Error"
return False
return False
def internet_connect():
'''try to connect to the internet'''
code, headers, html, cur_opener = get_url("http://10.239.89.15/reliance/startportal_isg.do", timeout=10)
if debug: print html
login_data = urllib.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'})
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/login.do', data=login_data, opener=cur_opener)
if debug: print html
def internet_disconnect():
'''try to disconnect from the internet'''
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/login.do', timeout=10)
if debug: print html
code, headers, html, cur_opener = get_url('http://10.239.89.15/reliance/logout.do', opener=cur_opener)
if debug: print html
def internet_keep_alive():
'''login and keep the connection live'''
while True:
if not is_internet_on():
internet_connect()
if debug: print "Not connected"
else:
if debug: print "Connected"
pass
time.sleep(check_interval)
def print_usage():
print "Reliance Netconnect AutoLogin"
print "-----------------------------"
print "usage:" + sys.argv[0] + " [login|logout]\n"
print "If there are no arguments it runs in an infinite loop and will try to remain connected to the internet."
keep_alive = True
if (len(sys.argv) > 1):
op = sys.argv[1]
if op == 'login':
internet_connect()
keep_alive = False
elif op == 'logout':
internet_disconnect()
keep_alive = False
elif op == 'keep-alive':
keep_alive = True
pass
else:
print_usage()
keep_alive = False
''' default action without any arguments - keep alive'''
if keep_alive:
internet_keep_alive();
This script can easily be downloaded here: Click Here
On clicking the above, some users might be asked by the browser where to save the file, if so please save it to the desired location.
If it just displays a page with the script, don't worry, go to File -> Save As option and save it to the desired location without changing the extension.
I recommend you to download this script from the above URL rather than coping and pasting, because it might cause some syntax problem and python interpreter is gonna throw a syntax error.
Once you are ready with the script downloaded, you can now download the Python Interpreter.
This script is compatible with Python version 2.x, so you have choose the correct version before downloading.
Linux users have python pre-installed with the OS, so you just have to check with the version of python installed.
In order to do that, go to Terminal or Konsole and issue the following command after # or $, in my case it is root@kali i.e., user@domain
[Note the command is case-sensitive and you need to use the command as shown below]
python -V
or
python --version
E.g.
root@kali:~# python -V
Python 2.7.3
root@kali:~# python --version
Python 2.7.3
On newer versions of linux, Python 3.x comes preinstalled, you can additionally install Python 2.x using the Package Manager that comes with the appropriate distribution of Linux.
Windows users can download the python interpreter from here:
https://www.python.org/downloads/windows/
At this time of writing this article, Python 2.7.8 is the latest.
You can install it on the default location, i.e., C:\Python27
After installation of Python interpreter, you can copy the above downloaded script to the C:\Python27
Open the script using IDLE or Notepad by right clicking on the file.
The only thing to edit the script is to replace the "username" with the username/id and "password" with the password provided. This line is found under import line
Please note, after editing the username and password, those two lines should look as below
username = '3xxxxxxxxx2'
password = 'password'.
The username and password should be withing the single quotes " ' ".
You can save this script.
Before running this script, please make sure you are logged out of the reliance broadband using the login page by going to http://www.reliancebroadband.co.in or http://10.239.89.15
After doing that, make sure you are in C:\Python27
Hold "Shift" key on the keyboard and right click on the empty space, Select "Open command window from here".
In the command prompt you can find this
C:\Python27>
You have three options,
In order to just login, You need to type "python reliance-login.py login" without quotes, i.e.,
C:\Python27>python reliance-login.py login
In order to just logout, You need to type "python reliance-login.py logout" without quotes, i.e.,
C:\Python27>python reliance-login.py logout
In order to login and keep the connection alive even when not used, You need to type "python reliance-login.py" without quotes, i.e.,
C:\Python27>python reliance-login.py
There are some situation where the connection gets logout due to connection drop and several other reasons, but this script is somehow reliable than just pinging some address, this much number of times in this much number of minutes.
In order to keep the connection alive, you need to keep the PC running this script active and powered on.
There is also an another way to keep the connection active without any PC but with the help of wireless router itself, I will test it and post soon.