Using plink to connect to pix works (ssh), to switch doesn't work (telnet)

Unanswered Question
May 14th, 2008
User Badges:

I want to automate a few things using plink. I can connect interactively to a cisco pix using the following command:

plink -ssh -l username -pw password -m testconpix.txt

The contents of testconpix is:



sh arp

This works fine. I am authenticated and the output of the arp table is displayed.

Now, I would like to do the same to connect to a cisco switch using the following command:

plink -telnet -m testconsw.txt

The contents of testconsw.txt are;




sh ip arp

However, I am prompted for the telnet password at the command line. It appears that the plink command is unable to read the file. What do I have to do to get plink to read the file interactively to logon and issue the commands?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
murray-davis Wed, 05/14/2008 - 13:15
User Badges:

Well, I figured it out. Apparently, telnet can only read from the command line, not from a text file. So, I switched to the python programming language because it has a telnetlibrary and used the following script: I ran this script from a command line. The script logs on interactively and then prints out the arp table of the switch.

import telnetlib

HOST = ""

tn = telnetlib.Telnet(HOST)

tn.read_until("Password: ")



tn.read_until("Password: ")


tn.write("sh arp\n")


print tn.read_all()


This Discussion