Re: telnetlib problems



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

.



Relevant Pages

  • Re: Sock it to me again
    ... to inform you that Mitch Ryder's hit record "Sock It To Me-Baby!" ... I *adore* Aretha Franklin's late-1960s Atlantic records, ... not invent the phrase "sock it to me," and I believe I have just ...
    (alt.usage.english)
  • Re: Sock it to me again
    ... to inform you that Mitch Ryder's hit record "Sock It To Me-Baby!" ... I *adore* Aretha Franklin's late-1960s Atlantic records, ... not invent the phrase "sock it to me," and I believe I have just ...
    (alt.usage.english)
  • Re: finally I understand how to kick
    ... >a technique i use to students who could not comprehend the technique is ... > the sock so that it has the most power at impact. ... the leg will hit a flat target first before the sock. ...
    (rec.martial-arts)
  • Re: Sock it to me again
    ... to inform you that Mitch Ryder's hit record "Sock It To Me-Baby!" ... I *adore* Aretha Franklin's late-1960s Atlantic records, ... not invent the phrase "sock it to me," and I believe I have just ...
    (alt.usage.english)
  • Re: DirecTVs new "Scoreguide"
    ... Sock" wrote in message ... While watching sports, hit the red button on your remote. ...
    (rec.sport.football.college)