I'm trying to use a python script to access an embedded computer
running linux and connected via a crossover ethernet cable using the
following script...
....and I realize the username and password is not realistic... I'm
still in "proof of concept" stage here :)
############### ##########
import telnetlib
tn = telnetlib.Telne t('192.168.100. 11')
tn.read_until(' login: ', 5)
tn.write('user\ n')
tn.read_until(' Password: ', 5)
tn.write('passw ord\n')
tn.read_until(' bash-2.05$ ', 5)
tn.write('ls\n' )
print tn.read_very_ea ger()
############### ##########
As a script, this doesn't work. However, if I execute the same
commands interactively, it works fine. If I insert some time delays as
follows...
############### ##########
import telnetlib
import time
tn = telnetlib.Telne t('192.168.100. 11')
tn.read_until(' login: ', 5)
time.sleep(2)
tn.write('user\ n')
tn.read_until(' Password: ', 5)
time.sleep(2)
tn.write('passw ord\n')
tn.read_until(' bash-2.05$ ', 5)
tn.write('ls\n' )
time.sleep(2)
print tn.read_very_ea ger()
############### ##########
....and it works fine. Can anyone tell me what's going on here? TIA
running linux and connected via a crossover ethernet cable using the
following script...
....and I realize the username and password is not realistic... I'm
still in "proof of concept" stage here :)
############### ##########
import telnetlib
tn = telnetlib.Telne t('192.168.100. 11')
tn.read_until(' login: ', 5)
tn.write('user\ n')
tn.read_until(' Password: ', 5)
tn.write('passw ord\n')
tn.read_until(' bash-2.05$ ', 5)
tn.write('ls\n' )
print tn.read_very_ea ger()
############### ##########
As a script, this doesn't work. However, if I execute the same
commands interactively, it works fine. If I insert some time delays as
follows...
############### ##########
import telnetlib
import time
tn = telnetlib.Telne t('192.168.100. 11')
tn.read_until(' login: ', 5)
time.sleep(2)
tn.write('user\ n')
tn.read_until(' Password: ', 5)
time.sleep(2)
tn.write('passw ord\n')
tn.read_until(' bash-2.05$ ', 5)
tn.write('ls\n' )
time.sleep(2)
print tn.read_very_ea ger()
############### ##########
....and it works fine. Can anyone tell me what's going on here? TIA
Comment