#1
|
|||
|
|||
[script][Livebox Sagem] Changement IP (Windows, GNU/Linux et MacOS)
Salut à tous,
en utilisant ce post j'ai cherché une solution de changement d'ip pour la livebox de sagem pour toutes les plateformes. Je me suis donc tourné vers le python, un langage de programmation interprété et fonctionnant sur la plupart des plates-formes informatiques. En premier lieu, téléchargez et installez l'interpreteur **External links are only visible to Support Staff**Python 2.6.5 pour votre plateforme (pour les personnes sous GNU/Linux utilisez votre gestionnaire de dépôts). Ensuite créez un fichier et coller le code suivant Code:
import getpass import sys import telnetlib HOST = "192.168.1.1" user = "root" password = "1234" tn = telnetlib.Telnet(HOST) tn.read_until("login: ") tn.write(user + "\n") tn.read_until("Password: ") tn.write(password + "\n") tn.read_until("[root @ home]$") tn.write("sndcp\n") tn.read_until("[root @ sndcp]$") tn.write("pppoestop 0\n") tn.read_until("[root @ sndcp]$") tn.write("pppoestart 0\n") tn.read_until("[root @ sndcp]$") tn.write("exit\n") tn.read_until("[root @ home]$") tn.write("exit\n") Dans JDownloader, allez dans 'Préférences'->'Reconnexion'->'En lot' coller la ligne suivante dans la zone 'Script par lot' pour Windows Code:
C:\Python26\python.exe "lechemindemonfichier\lenomdemonfichier.py" pour GNU/Linux et MacOS Code:
python "lechemindemonfichier/lenomdemonfichier.py" Faites "Renouveler IP" et ça devrait fonctionner en quelques secondes. Le script marche sous mon Windows XP SP3 et mon ArchLinux pour ceux qui ont déjà la version 3.1.2 de Python ce script devrait fonctionner (je ne l'ai pas encore testé) Code:
import getpass import telnetlib 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") |
Thread Tools | |
Display Modes | |
|
|