Change your 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.

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)

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

def connect(host, passwd):
    "connect to the internet."
    data = {'ACTION_CONNECT': 'Po<span>&</span>#322;<span>&</span>#261;cz'}
    return send(data, host, passwd)</pre>
You can use this functions like this.
<pre>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', '')
            disconnect(host, passwd)
            connect(host, passwd)
        except urllib2.HTTPError, e:
            if e.code == 401:
                print 'wrong password'
                print 'Error: %s' % e.args
        except urllib2.URLError, e:
            print 'Error: %s' % ' '.join(e.args)
            print "password successfuly changed"

You could use this progam like this: -h <your host> -p <your password>

Default host is and default password is admin

Published by


I'm a web developer from Poland with a focus on JavaScript.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s