Connect to a host with telnet : Telnet : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Telnet »

 

Connect to a host with telnet


import telnetlib
hostserver = "http://www.telnetServer.com"
newline = "n"
username = "user02" + newline
password = "qwerty0987" + newline
telnet = telnetlib.Telnet(hostserver)
telnet.read_until("login: ")
telnet.write(username)
telnet.read_until("Password: ")
telnet.write(password)
while 1:
    command = raw_input("[shell]: ")
    telnet.write(command)
    if command == "exit":
        break
    telnet.read_all()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Telnet