telnet to a device under tacacs management - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: telnet to a device under tacacs management (/thread-27395.html) |
telnet to a device under tacacs management - kang18 - Jun-05-2020 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. 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 |