¿Cómo Acceder y resetear el router Zyxel P-660HW-D1 desde Python?
Éste es un ejemplo sencillo en Python, el cual efectúa un acceso Telnet al Router Zyxel P-660HW-D1 y su posterior reseteo:
#!/usr/bin/python
import getpass
import sys
import telnetlibHOST = “192.168.4.1”
PASS = “1234”tn = telnetlib.Telnet(HOST)
tn.set_debuglevel(1)
tn.read_until(“Password: “)
tn.write(PASS + “n”)# System maintenance
tn.write(“24n”)# Diagnostic
tn.write(“4n”)# Reset xDSL
tn.write(“1n”)# Reboot System
#tn.write(“21n”)
La misma secuencia que se realizaría desde la consola de texto trasladada a código.