usr bin python import sys telnetlib getpass newipaddr 192 168 96 137 s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python
import sys, telnetlib, getpass
newipaddr = '192.168.96.137'
swlogin = 'root'
swpass = getpass.getpass()
tn = telnetlib.Telnet(newipaddr)
tn.read_until("username:")
tn.write(swlogin)
tn.read_until("password:")
tn.write(swpass)
tn.write("logout\n")
print tn.read_all()
DES-3526 Fast Ethernet Switch Command Line Interface
Firmware: Build 5.01.B52
Copyright(C) 2008 D-Link Corporation. All rights reserved.
username:root
password: