Posts Tagged livebox

Get you livebox router IP Adres

Here is bash on alias for get IP adress of your livebox router. (tested on Ubuntu GNU/Linux)

alias livebox-ip='tmp=`mktemp`;curl -u admin:<your password> --silent --url http://192.168.1.1/internetservices.html -o $tmp; grep -E "var v_Adrs_IP[^=]*=" $tmp | cut -d"\"" -f2 ; rm $tmp'

You must have installed curl. Note that you must change your livebox password.

, ,

Leave a comment

Change you IP with livebox

If you have livebox wireless router you could easily change you dynamic IP. It is handy if you download files from rapidshare. Here is the python code. It was tested on polish livebox. You could download code from here.

#!/usr/bin/python
import base64
import  urllib2
import urllib

def send(data, host, passwd):
    "send request to livebox SubmitInternetService."
    action = 'http://%s/SubmitInternetService' % host
    req = urllib2.Request(action, urllib.urlencode(data))
    passwd = base64.b64encode('%s:%s' % ('admin', passwd))
    req.add_header('Authorization',  'Basic %s' % passwd)
    request = urllib2.urlopen(req)
    return request.read()

def disconnect(host, passwd):
    "disconnect from internet."
    data = {'ACTION_DISCONNECT': 'Roz&#322;&#261;cz'}
    return send(data, host, passwd)

def connect(host, passwd):
    "connect to the internet."
    data = {'ACTION_CONNECT': 'Po&#322;&#261;cz'}
    return send(data, host, passwd)

You can use this functions like this.

if __name__ == '__main__':
    from sys import argv
    opts, rest = getopt(argv[1:], 'p:h:')
    opts = dict(opts)
    if len(rest) == 0:
        passwd = opts.get('-p', 'admin')
        host = opts.get('-h', '192.168.1.1')
        try:
            disconnect(host, passwd)
            connect(host, passwd)
        except urllib2.HTTPError, e:
            if e.code == 401:
                print 'wrong password'
            else:
                print 'Error: %s' % e.args
            exit(1)
        except urllib2.URLError, e:
            print 'Error: %s' % ' '.join(e.args)
        else:
            print "password successfuly changed"

You could use this progam like this:

change_ip.py -h <your host> -p <your password>

Default host is 192.168.1.1 and default password is admin

Programming Blogs - Blog Catalog Blog Directory

, ,

Leave a comment

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: