É
Éñ¸¸
hello every expert,
When I use telnetlib to send a command, I meet some troubles, I have read
some documents about telnetlib and modify many times, but the script
doesn't work all the time. I want to know why.
My script is following:
#!/usr/bin/python
#
import telnetlib
t = telnetlib.Telnet()
t.open('192.168.1.1',port=23)
t.set_debuglevel(2)
t.read_until("login: ")
t.write('administrator' + '\r\n')
t.read_until("password: ")
t.write('abc123' + '\r\n')
t.read_until(">$")
t.write('dir' + '\r\n')
t.write('exit' + '\r\n')
print t.read_all()
Thanks and best regards
W
When I use telnetlib to send a command, I meet some troubles, I have read
some documents about telnetlib and modify many times, but the script
doesn't work all the time. I want to know why.
My script is following:
#!/usr/bin/python
#
import telnetlib
t = telnetlib.Telnet()
t.open('192.168.1.1',port=23)
t.set_debuglevel(2)
t.read_until("login: ")
t.write('administrator' + '\r\n')
t.read_until("password: ")
t.write('abc123' + '\r\n')
t.read_until(">$")
t.write('dir' + '\r\n')
t.write('exit' + '\r\n')
print t.read_all()
Thanks and best regards
W