Re: telnetlib problems
- From: vercingetorix52@xxxxxxxxx
- Date: 28 Feb 2006 11:28:12 -0800
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
.
- References:
- telnetlib problems
- From: vercingetorix52
- telnetlib problems
- Prev by Date: Re: PEP 354: Enumerations in Python
- Next by Date: Thread Question
- Previous by thread: telnetlib problems
- Next by thread: Threading - will threads run in parallel?
- Index(es):
Relevant Pages
|