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

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

Unknown said...

Need a solution for my iPad and iPhone that move in and out of the home

neo said...

@Neel
I am not much fan of apple and hate its iPad for all restrictions it tries to put on user. So I dont know if the Ipad or Ipods are supporting python yet.
I know it is supported on Android and we can write a script for Android.

But with its all annoying restrictions I don't think Apple will provide python scripting to us. Let me know if you have some info about scripting python in iOS (ipad os).

Srinivas Laxman said...

Hey Neo, I am facing lot of frustruation with auto login for ISP. Can you provide script/app for auto login from Android App.

Srinivas Laxman said...
This comment has been removed by the author.
neo said...

Hi Srinivas,
I am not getting proper libraries for the Qpython which has sl4a python for android. Not in a mood to debug those libraries. Not getting time for that. So will try to find qpython library similar to mechanize and if successfull will post on blog.
regards
nEo

Tatva said...

I tried running the script but nothing happens after i double-click on it. I am unaccustomed to scripts/codes. Can you please help me making an autologin script that would run every 5/10 minutes?