Tuesday, September 20, 2011

Automate irritating ISP login

Well recently my ISP updated their systems and made compulsory web login before giving access to any other site. I found this very frustrating and didnt liked it. Every time I start my modem I have to login to this ISP web login form.
So I just think to automate this process, I wrote a small python script to automate this login process. So as per my convenience I can put it in auto-run after login or whatever I want. Since I am lazy programmer I searched for a library which gave me easy manipulation of web forms. So I found mechanize module for python doing things which were necessary for this script. (Dont ask me why python , I dont want to start unother python Vs xyz Language fight. I like python very much so python :-) )

For easy usage of script I will briefly describe 5 parameters which are needed to be set one time before using this script.

loginURL = "http://login.example.com" # URL to Login form of ISP site

Here you have to put URL of the login page where the login form is shown

loginID = "myUserName" # ISP user name
loginPassword = "mYp4ssw0rd" # ISP Password

Quiet self explanatory : Username and password

loginFormName = "loginForm"

On the login page of the ISP site, check the html code for
tag put the name of the form in this location


successString = """NOW ACTIVATING YOUR SERVICES"""

Do a manual login and check the first page shown after login and copy any string from that page which is shown every time you login. This is used to check whether the login was successfull.

Comments are welcome.

Download script here
PythonScript ISPlogin.py

4 comments:

Thanks said...

Neo, how do you run this script? Is it possible to put it in the 'start-up' folder so that it automatically runs. And does it provide an error message if the login is not successful. Thanks

neo said...

Yes it is possible to put script in startup. If you install python properly and you are able to run script by double clicking it in the windows explorer or just by giving script name in linux, you can put that in startup.

If script is successful it will give success message and exit. If unsuccessful login it will give message about problem occured while login and wait for Key press to exit.

Anonymous said...

Is it possible to have this put into the router itself? I have a Cisco RVS4000 Gigabit Router and an  AirPortExtreme.

neo said...

I don't think the router would support python script.