telnetlib

telnetlib python example

青春壹個敷衍的年華 提交于 2019-11-27 01:25:00
问题 So I'm trying this really simple example given by the python docs: import getpass import sys import telnetlib HOST = "<HOST_IP>" user = raw_input("Enter your remote account: ") password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until("login: ") tn.write(user + "\n") if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("ls\n") tn.write("exit\n") print tn.read_all() My issue is that it hangs at the end of the read_all()... It doesn't print anything out. I've