Re: telnetlib problems
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: telnetlib problems

From: <vercingetorix52@yahoo.com>
Date: Tue Feb 28 2006 - 20:28:12 CET

I just hit upon something that seems to work...

##########################
import telnetlib
from select import select

tn = telnetlib.Telnet('192.168.100.11')
sock = tn.get_socket()

tn.read_until('login: ', 5)
select([sock], [], [], 5)
tn.write('user\n')

tn.read_until('Password: ', 5)
select([sock], [], [], 5)
tn.write('password\n')

tn.read_until('bash-2.05$ ', 5)
tn.write('ls\n')
select([sock], [], [], 5)
print tn.read_very_eager()
##########################

If anyone sees any potential problems with this, I would appreciate it.
 TIA
Received on Sun Apr 30 10:30:07 2006