Trés utiles pour consulter les vidéo de grand mère a la plage sur mégavideo sans avoir de problème avec la limite de temps.

Je pense que cela peut intéresser d'autre personne donc je partage.
Voici donc le script en question :
Code : Tout sélectionner
#!/usr/bin/python
import os, sys
import getpass
import telnetlib
import commands
import gtk, os
CMD = "zenity --info --text '\n Votre adresse Ip vient de changer.'"
HOST = "192.168.1.1"
user = "root"
password = "1234"
tn = telnetlib.Telnet(HOST)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.read_until(b"[root @ home]$")
tn.write(b"sndcp\n")
tn.read_until(b"[root @ sndcp]$")
tn.write(b"pppoestop 0\n")
tn.read_until(b"[root @ sndcp]$")
tn.write(b"pppoestart 0\n")
tn.read_until(b"[root @ sndcp]$")
tn.write(b"exit\n")
tn.read_until(b"[root @ home]$")
tn.write(b"exit\n")
os.system(CMD)
Les valeurs de 'user' et 'password' sont ceux par defaut de la box (en telnet).
EDIT : NE FONCTIONNE APPAREMENT PAS AVEC LES LIVEBOX SAGEM.
Voici un lien pour identifier sa livebox : Identifier le modele de votre livebox