usr bin python import sys telnetlib getpass newipaddr 192 168 swlogin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python
import sys, telnetlib, getpass
newipaddr = '192.168.1.2'
swlogin = 'root'
swpass = getpass.getpass()
tn = telnetlib.Telnet(newipaddr)
tn.read_until("login:")
tn.write(swlogin+'\n')
tn.read_until("Password:")
tn.write(swpass+'\n')
tn.write("ls\n")
tn.write("exit\n")
print tn.read_all()
penpen@miyuki:~$ python govno.py
Password:
ls
exit
BusyBox v0.61.pre (2006.05.21-17:30+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls
bin etc proc usr var.tar
dev lib sbin var
# exit