Automate Login to Tikona Broadband(Python on Windows)

Thanks Marcus
It worked. Batch file worked with gateway 10.116.119.156
But another problem is there.
When I switch off the Tikona CPE and switch on the again, It take 5-7 minutes to detect the gateway as 10.116.119.156.
Sometimes I need to enable/diable/enable lan adaptor many times.
Sometimes I need to again switch off/on the CPE power.
It , sometimes , tool 10-20 minutes to get proper gateway after due error & trial.
What is this phenomenon?
Are u experiencing such events i.e. hit and trial reconnection issues.?
I attached the lan adaptor status before detection of CPE by laptop i.e.
After 3-4 minutes of switching off/on CPE power.

Regards

That is an issue with Tikona.In fact your ping speed of 1.7 s is very bad.

I faced this issue with Tikona one month back when the CPE took 15-20 mins to connect to the AP only after which the ip was assigned to the router.
I had to raise this issue to Tikona umpteen number of times before which my speed was fixed. I get averages of 40-50ms (10.23.64.1) now.

There is no workaround for that issue from our side.
 
Thanks Marcus for your time and kind heart to help.
BTW we have to face TIKONA till good,fast & cheap ISP with Fiber backbone
appears here in Gurgaon.
We are still waiting ..

Best Wishes.
Sandeep
 
C:\windows\system32>C:\Python27\Python.exe C:\Python27\Tikona.py -u 111XXXXXXX
>>> Trying to connect to login page..
>>> Opening Login Page Succeeded
>>> Powered by Inventum
>>> Redirecting to login.do
>>> Submitting Username And Password..
>>> Got Response For Credentials Entry
Traceback (most recent call last):
File "C:\Python27\Tikona.py", line 65, in <module>
main()
File "C:\Python27\Tikona.py", line 59, in main
Login(options.user,password)
File "C:\Python27\Tikona.py", line 25, in Login
br["username"] = username
File "build\bdist.win32\egg\mechanize\_form.py", line 2780, in __setitem__
File "build\bdist.win32\egg\mechanize\_form.py", line 3101, in find_control
File "build\bdist.win32\egg\mechanize\_form.py", line 3185, in _find_control
mechanize._form.ControlNotFoundError: no control matching name 'username'

This is what i got after running the Tikona.py file as ur instructions. Plz help and tell me whats wrong. I am a noob in Python.
 
C:\windows\system32>C:\Python27\Python.exe C:\Python27\Tikona.py -u 111XXXXXXX
>>> Trying to connect to login page..
>>> Opening Login Page Succeeded
>>> Powered by Inventum
>>> Redirecting to login.do
>>> Submitting Username And Password..
>>> Got Response For Credentials Entry
Traceback (most recent call last):
File "C:\Python27\Tikona.py", line 65, in <module>
main()
File "C:\Python27\Tikona.py", line 59, in main
Login(options.user,password)
File "C:\Python27\Tikona.py", line 25, in Login
br["username"] = username
File "build\bdist.win32\egg\mechanize\_form.py", line 2780, in __setitem__
File "build\bdist.win32\egg\mechanize\_form.py", line 3101, in find_control
File "build\bdist.win32\egg\mechanize\_form.py", line 3185, in _find_control
mechanize._form.ControlNotFoundError: no control matching name 'username'

This is what i got after running the Tikona.py file as ur instructions. Plz help and tell me whats wrong. I am a noob in Python.
This happens if you are already logged in.:):)

The Batch file ensures that the Tikona.py file is not triggered in case you are already logged in.
 
You can do this for auto login...

Get wget for Windows from here
http://gnuwin32.sourceforge.net/packages/wget.htm

Create this batch file(Replace User And Password as per your needs)

:START
@ECHO OFF
CLS
ECHO Waiting...
PING -n 60 127.0.0.1 > NUL
:AGAIN
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto START
ECHO Not Working!
ECHO.
ECHO Logging Back in...
E:\WGET\WGET -qO- --post-data="username=USER%40hathway.com&password=PASSWORD" "http://203.212.193.61/bsp/login.do?action=doLoginSubmit&flowId=UserLogin"
ECHO Checking Internet...
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto AGAIN
GOTO START

Hi,

Can you please write WGET for Tikona login. I am noob and want to use it in router. What I need is to join this....
'https://login.tikona.in/userportal/login.do?requesturi=http://1.254.254.254/&act=null' ....with username + password and then execute all together in single command from router.

Thanks.
 
Hi,

Can you please write WGET for Tikona login. I am noob and want to use it in router. What I need is to join this....
'https://login.tikona.in/userportal/login.do?requesturi=http://1.254.254.254/&act=null' ....with username + password and then execute all together in single command from router.

Thanks.
What is the router model you use.AFAIK stock firmwares provided by most companies do not have provisions for running Python scripts from them.

Python can be installed on DDWRT custom firmware which might or might not be available for your router model.

Are you sure you want to go all that way?

Once you play around with the router firmware you lose warranty and I wouldn't suggest DDWRT experiments on your router without quite a bit of prep.
 
What is the router model you use.AFAIK stock firmwares provided by most companies do not have provisions for running Python scripts from them.

Python can be installed on DDWRT custom firmware which might or might not be available for your router model.

Are you sure you want to go all that way?

Once you play around with the router firmware you lose warranty and I wouldn't suggest DDWRT experiments on your router without quite a bit of prep.

Thanks for your reply.

I have Linksys WRT54G and already have installed ddwrt on it, but it doesn't have enough memory to install Python. So can't use your tikona script.
Instead i can run WGET command.

So wanted to know if its possible to add username and password to this link..'https://login.tikona.in/userportal/login.do?requesturi=http://1.254.254.254/&act=null'... so that on executing this link it gets logged in without any intervene from my side.
 
@Marcus Fenix Thanks for your effort and time. Like many I'm one of the unlucky guy to have Tikona connection with no other choices in my area after Reliance ditching me by closing their CDMA services. And now I'm into these frustrating web portal login issues and apart from that I'm lucky so far without major outages/speed issues. Will pray to god to keep up this way for long time:tonguewink: coz we all know in India praying to god is the only belief we can be true to some extent rather than believing in Indian telcos and their CS team.

I'm using OpenWrt 15.05.1 firmware on imported european brand router. Desperately need some kind of script to automate the process and not sure about python on OpenWrt but generally it does allow cron job scripts.

Please help me with this.

Regards :)
 
@Marcus Fenix Thanks for your effort and time. Like many I'm one of the unlucky guy to have Tikona connection with no other choices in my area after Reliance ditching me by closing their CDMA services. And now I'm into these frustrating web portal login issues and apart from that I'm lucky so far without major outages/speed issues. Will pray to god to keep up this way for long time:tonguewink: coz we all know in India praying to god is the only belief we can be true to some extent rather than believing in Indian telcos and their CS team.

I'm using OpenWrt 15.05.1 firmware on imported european brand router. Desperately need some kind of script to automate the process and not sure about python on OpenWrt but generally it does allow cron job scripts.

Please help me with this.

Regards :)
Sorry on that front dude as I tried the same thing on my OpenWRT Netgear WNDR4300 but I didn't have enough space to install the full version of Python(50 MB approx.) on the onboard chip which is needed for the mechanize library.
 
Sorry on that front dude as I tried the same thing on my OpenWRT Netgear WNDR4300 but I didn't have enough space to install the full version of Python(50 MB approx.) on the onboard chip which is needed for the mechanize library.
Thanks for the prompt reply. If installing python is the only concern then it shouldn't be a problem for me because I can install python-light to d-ram or python-full to overlay partition. If possible do you wanna give me a hand while I try ?

Check this wiki page and go thru Chaos version guide https://wiki.openwrt.org/doc/software/python


Please let me know. Thnx[emoji3]
 
Ok..
So can you install Mechanize after installing Python and then execute the Python script from my side with your userid and password.If yes then I guess we can dispose of the internet connectivity checks I am doing in the batch script and directly execute the Python script from crontab after a sleep interval of say 1 min.

The only issue will be that the python script will throw an error in case the user is already logged in to Tikona but I guess we can ignore that.

If you want the entire logic check then you will have to replicate the batch file in UNIX shell but it will be the easy part of the job.
 
Ok..
So can you install Mechanize after installing Python and then execute the Python script from my side with your userid and password.If yes then I guess we can dispose of the internet connectivity checks I am doing in the batch script and directly execute the Python script from crontab after a sleep interval of say 1 min.

The only issue will be that the python script will throw an error in case the user is already logged in to Tikona but I guess we can ignore that.

If you want the entire logic check then you will have to replicate the batch file in UNIX shell but it will be the easy part of the job.

Wow thanks dude for showing your interest but think that's too fast for me. I'm not a coder at any time in my life but always did well implementing using how to guides with bit of common sense. Common sense meaning in using syntax or interpreting errors using Google.Do you use whatsapp or telegram at all so that we can start doing it using live conversations.

But all you've to do is just guide in brief steps and I'll pickup from them.

Whichever is comfortable for you I'm happy to follow that. Please let me know your thoughts.
 
@Marcus Fenix Quick update... I've tested your script on Macbook and looks like its not working. TBH it didn't take much time on installations because OSX comes with pre-installed python 2.7 and all I've to do was just one command away to install mechanize.
Code:
sudo esay_install mechanize

I've got the terminal output please check the link below and let me know. Thnx :)

http://pasted.co/1608de52
 
@Marcus Fenix Quick update... I've tested your script on Macbook and looks like its not working. TBH it didn't take much time on installations because OSX comes with pre-installed python 2.7 and all I've to do was just one command away to install mechanize.
Code:
sudo esay_install mechanize

I've got the terminal output please check the link below and let me know. Thnx :)

http://pasted.co/1608de52
Can you run the python script after logging out from Tikona broadband.As far as I remember urllib2.URLError is thrown if you are executing the python script while you are logged in the Tikona network.
 
Can you run the python script after logging out from Tikona broadband.As far as I remember urllib2.URLError is thrown if you are executing the python script while you are logged in the Tikona network.

Of course lol :smiley: with bit of common sense I did log out and run the script. Is there anything I had to clear my browsing history(like cache/cookies) and do it? Does your script consider any specific browser agent or it just run using defaults?
 
Of course lol :smiley: with bit of common sense I did log out and run the script. Is there anything I had to clear my browsing history(like cache/cookies) and do it? Does your script consider any specific browser agent or it just run using defaults?
Can you check whether there are any unprintable characters in the python script since the code is pasted in a Word document created in Windows.

I have done the end of line conversion for my script in the text file below.Rename to .py and please check.I don't have any idea about Mac OSX and it will be mighty difficult for me to troubleshoot.The Python script is okay as others have used the script without any modifications albeit on Windows/Ubuntu.
 

Attachments

  • Tikona.txt
    2 KB · Views: 485
@Marcus Fenix No code is missing in both the DOCX and TXT files, all are same.I've found the line which was giving terminal error and it was this
Code:
response  = br.open('https://login.tikona.in')

For some unknown reasons https was not working and I changed it to http, got the output as shown in the below link. Think this is the one to expect, I've confirmed it myself by manually using browser and was logged in.

http://pasted.co/6efc58d0
 
@Marcus Fenix Now that we've got the script working and its time to try on OpenWrt. I'm not exactly sure about the steps to go but with my little knowledge think as follows..

1. Install python-full on OpenWrt
2. Install Mechanize
3. Copy the Tikona.py script to root or /usr/bin (not sure) folder of the router
4. Add the script path to crontab to make it executable after boot process.

Please check the steps and correct me If I'm wrong.

PS: Got one doubt, does it have to be python-full or light and basic versions will work?.

Thank you :)
 
Back
Top