Hi,
I am trying to telnet a device under a tacacs management. but it seems I am missing something. When i run the code it just stop and terminate the program.
I am trying to telnet a device under a tacacs management. but it seems I am missing something. When i run the code it just stop and terminate the program.
import getpass import telnetlib host = "10.107.1.2" user = raw_input("Enter your username: ") password = getpass.getpass() tlnt = telnetlib.Telnet(host) tlnt.read_until(b'TACACS Username: ') tlnt.write(user.encode('ascii') + b'\n') if password: tlnt.read_until(b'TACACS Password: ') tlnt.write(password.encode('ascii') + b'\n') tlnt.read_until('>') tlnt.write(b'enable \n') tlnt.write(b'exit \n') output = tlnt.read_all().decode('ascii') print output