Hello everyone,i have a problem:I can't connect via python script to switch,using telnetlib module:
Script:
import getpass
import telnetlib
HOST = "10.255.23.10"
user = input("Enter your account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until(b"Username: ")
tn.write(user.encode('ascii') + b"
")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"
")
tn.write(b"show version
")
print(tn.read_all().decode('ascii'))
And what's happening:
After input password nothing happened.
I don't know why.
HP J9774A 2530-8G-PoEP Switch
What's wrong???