ACT Broadband Portal Auto Login [Python]

Folks,
As you know the default login page for ACT portal (only ACT Broadband subscribers) is quite pesky and it never saves the password which you issue always. So it becomes quite irritating process to issue the credentials each time you want to unlock your internet connection. Here is a script which would automate the process for you. You just need to pass your username and password in the appropriate places and the script is good to go.

Just notice how the HTTP request is crafted in the script. You just need to pass your userid and password in the appropriate places and you are all set. However, you need to have httplib2 module before running the script. Otherwise you can navigate through my GitLab repository here.

Below is the same code if you want to refer:

#!/usr/bin/env python
try:
    import requests, argparse
except ImportError, msg:
    print msg
    exit(-1)

def main():
    parser = argparse.ArgumentParser(description="ACT Web Portal Logger options", usage='%(prog)s [options]')
    parser.add_argument("-u", dest="user", help="ACT UserID", type=int)
    parser.add_argument("-p", dest="password", help="ACT Login password", type=str)
    parser.add_argument("--version", action="version", version="ACT Portal Logger v1.1")

    results = parser.parse_args()

    loginData   = {"act_username" : results.user, "act_password" : results.password}
    url         = "http://portal.acttv.in"
    headData    = { \
            "Host"              :   "portal.acttv.in", \
            "User-Agent"        :   "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/36.0.1985.125", \
            "Referer"           :   "http://portal.acttv.in/", \
            "Content-Type"      :   "application/x-www-form-urlencoded", \
            "Connection"        :   "keep-alive", \
            "Accept-Encoding"   :   "gzip,deflate,sdch", \
            "Origin"            :   "http://portal.acttv.in"
            }

    if not (results.user and results.password):
        parser.print_help()

    # Initialize the login routine 
    if (results.user and results.password):
        print '[+] UserID:\t', results.user
        print '[+] Password:\t', results.password
        initQuery = requests.get(url, headers=headData)
        if (initQuery.status_code == 200 and initQuery.text.find('You have invalid network configuration')) > -1:
            print '[-] Error: Network outside of ACT perimeter. Sorry, can\'t login.'
            exit(-1)

        if (initQuery.status_code == 200 and initQuery.text.find('ACTBroadbandOfficial')) > -1:
            print '[*] Valid ACT Login page found!'
            print '[*] Logging in to the ACT Portal...'
            loginQuery = requests.post(url, headers=headData, data=loginData)
            if (loginQuery.status_code == 200 and loginQuery.headers["transfer-encoding"] == "chunked" and loginQuery.text.find('You are logged in as<br') > -1):
                print '[*] Logged in successfully to ACT portal!'
                print '[*] Enjoy ...'
            else:
                print '[-] Unknown error encountered...'

if __name__ == '__main__':
    main()

Hope it helps somebody in anyways! ;)

Enjoy!
XyluX

Apr 21st, 2012 | Posted in Programming
  1. Prasad
    Jun 22nd, 2014 at 19:02 | #1

    Hi,

    Its not working now.

    Looks like the URL got changed.

    Any updates ?

    Thanks in advance.

    • XyluX
      Aug 12th, 2014 at 15:48 | #2

      Prasad, could you please tell which one is not working exactly? The Python script file URL (the GitHub repo) or the ACT Portal Login URL? Please clarify. :)

    • XyluX
      Aug 12th, 2014 at 15:52 | #3

      I have fixed the GitHub Python code URL though. Let me know if it solved your problem anyways.

  2. Hemanth
    May 21st, 2014 at 23:03 | #4

    Hey Guys,

    Is this script still working? Can some one please help? I am on a MAC, i get the following error :-
    line 1

    ^
    SyntaxError: invalid syntax

    • XyluX
      Aug 12th, 2014 at 15:43 | #5

      Just check what is your Python version. It should be 2.x (2.7 preferred though).

  3. XyluX
    May 25th, 2012 at 12:16 | #6

    Joydeep,
    I am glad that the script helped you out!! :)

  4. Joydeep
    May 24th, 2012 at 08:06 | #7

    Joydeep :
    Hi XyluX
    As suggested I installed Python 2.7.3. But then while installing httplib2 module I got the following error
    SyntaxError: (‘invalid syntax’, (‘D:\\Python27\\Lib\\site-packages\\httplib2\\__init__.py’, 343, 31, ” print(‘%s:’ % h, end=’ ‘, file=self._fp)\n”))
    And while running the script I’m getting the error as below
    File “D:\Python27\lib\site-packages\httplib2\__init__.py”, line 343
    print(‘%s:’ % h, end=’ ‘, file=self._fp)
    Please advise.
    Thanks
    Joydeep

    hey found the solution here
    http://code.google.com/p/httplib2/issues/detail?id=172

    removed everything and reinstalled again and it seems to work now..thanks a lot for the script Sujit :)

  5. Joydeep
    May 24th, 2012 at 01:30 | #8

    Hi XyluX
    As suggested I installed Python 2.7.3. But then while installing httplib2 module I got the following error

    SyntaxError: (‘invalid syntax’, (‘D:\\Python27\\Lib\\site-packages\\httplib2\\__init__.py’, 343, 31, ” print(‘%s:’ % h, end=’ ‘, file=self._fp)\n”))

    And while running the script I’m getting the error as below

    File “D:\Python27\lib\site-packages\httplib2\__init__.py”, line 343
    print(‘%s:’ % h, end=’ ‘, file=self._fp)

    Please advise.

    Thanks
    Joydeep

  6. XyluX
    May 23rd, 2012 at 14:04 | #9

    Joydeep,
    For Python v3.x series *print* statement is considered as a function and you need to pass arguments to the print function otherwise it won’t work. But in Python v2.x versions the approach is slightly different. That’s why you are coming up with an Invalid syntax error.

    FYI, I have tested my program with Python v2.5 and Python v2.7 and it works without any issues.

    You better install Python v2.5 or Python v2.7, install httplib2 module and run this script. It should definitely work! :) Let me know if still you are having any issues.

    – XyluX

  7. Joydeep
    May 23rd, 2012 at 12:12 | #10

    This is giving me an invalid syntax at the following line.

    print ‘\xaf [Err] httplib2 Module not found!’

    I am using Python 3.2.3 64bit and have installed the httplib2 module 0.7.4. Please advise how to use this script or the python and httplib2 versions that you have tested this with.

    Thanks.
    Joydeep

Leave a comment

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

Current ye@r *