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<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', '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