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:
s开发者_Python百科sh = 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.
You need to add a call to stdin.flush()
after the stdin.write()
otherwise the input you're sending will stay buffered.
精彩评论