JDownloader Community - Appwork GmbH
 

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 30.04.2010, 15:43
personne146
Guest
 
Posts: n/a
Wink [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")
Changez l'extension du fichier en .py

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"
en remplaçant "lechemindemonfichier\lenomdemonfichier.py" par le chemin complet vers le fichier ("C:\Python26\python.exe" est le chemin par défaut de l'interpréteur Python)

pour GNU/Linux et MacOS
Code:
python "lechemindemonfichier/lenomdemonfichier.py"
en remplaçant "lechemindemonfichier/lenomdemonfichier.py" par le chemin complet vers le fichier

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 19:20.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.