I have a small script to execute a command in a device. Instead of getting the output of the command in stdout, I am getting all those printed before the command prompt after loggin into the device.
import paramiko,
client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect('10.88.124.88', username='admin',password='testing',timeout=15.0)
print "Connected...\n"
print "Executing show version...\n"
stdin, stdout, stderr = client.exec_command("show version")
print "AFTER Executing show version...\n"
stdin.channel.shutdown_write()
print "BEFORE Reading output...\n"
output = stdout.read()
print "AFTER Reading output...\n"
print "OUTPUT:: '", output, "'"
print "Execting quit...\n"
stdin, stdout, stderr = client.exec_command("quit\n")
The output I am getting from the script is as shown below. I am expecting output of "show version" in the output. Not sure where I am missing. The response from the device is a bit slow.
[root@dev-s2-3m7-aio-139-44 ~]# ./ssh-bana.py
Connected...
...
OUTPUT:: ' Command Line Interface is starting up, please wait ...
verifying connection to main ([email protected])... success
verifying connection to secondary ([email protected])... success
Welcome to the TelePresence Command Line Interface (version 1.1)
Last login: Wed Jun 27 14:45:21 CDT 2012 from 10.88.139.44
admin: '
Execting quit...