Python Forum
telnet to a device under tacacs management
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
telnet to a device under tacacs management
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  telnet from ssh tunnel oldfart 3 7,157 Jul-17-2020, 02:28 PM
Last Post: noobami99
  3.6 telnet eyler 3 11,267 Jun-28-2019, 05:22 AM
Last Post: Khanhamid90
  Any suggestion on python library to use for both ssh and telnet? lord_mani 4 3,734 Jun-25-2019, 04:07 PM
Last Post: gb74razor
  telnet question jacklee26 2 2,488 Mar-30-2019, 06:45 AM
Last Post: jacklee26
  Retrieve output from telnet command Networker 1 4,101 Mar-12-2019, 01:36 PM
Last Post: searching1
  Aggregate multiple telnet connections Jibeji 1 4,260 Mar-02-2018, 07:21 PM
Last Post: mpd
  Multithread telnet not working Parallel anna 7 7,448 Feb-05-2018, 01:17 PM
Last Post: anna
  Copy data from 1 blk device in machine A to another blk device in machine B AbhishekV 2 3,422 Feb-01-2018, 11:40 AM
Last Post: DeaD_EyE
  Python telnet script for IP list mangesh 1 59,815 Jun-26-2017, 11:12 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020