2

Below is my driver information where I need to pull the data(Firmware Version) using ssh script as show below.

ncmdvstk:~ $ ssh admin@153.88.127.21
Password:

MSM760 V. 5.3.6.18-01-9124
(C) 2010 Hewlett-Packard Development Company, L.P.

CLI> enable
CLI# show system info
 [CPU info]   [Mem in  fo]
Firmware Version: 5.3.6.18-01-9124         Load 1min:       0.34   Total RAM:  9 

This is the program I am using to read all the data first in "data" variable, so that later i can split n get info i need but where as no data it's printing in print data:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('153.88.127.21', username='admin',password='catfish')

stdin, stdout, stderr = ssh.exec_command("enable")
stdin.write('show system info \n')
data = stdout.read() 
print data 

Please correct me on getting the data.

4

1 回答 1

0

您需要在stdin.flush()之后添加一个调用,stdin.write()否则您发送的输入将保持缓冲。

于 2011-11-28T07:31:18.607 回答