, paramiko. , , . , :
import paramiko
import time
import sys
import socket
def ssh_con (ip, un, pw):
global client
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print ("Connecting to device/VM: %s" % ip)
client.connect(ip, username=un, password=pw)
def cmd_io (command):
global client_cmd
client_cmd.send("%s \n" %command)
time.sleep(1)
output = client_cmd.recv(10000).decode("utf-8")
print (output)
ip = '172.168.200.300'
un = 'xyz'
pw = 'abc'
ssh_con(ip,un,pw)
client_cmd = client.invoke_shell()
print ("SSH CONNECTION ESTABLISHED TO vMEG %s" % ip)
cmd_io ("en")
cmd_io ("terminal monitor")
cmd_io ("debug wag https")
cmd_io ("debug wag httpc")
cmd_io ("debug https")
cmd_io ("debug httpc")
cmd_io ("debug wag kafka")
client_cmd.settimeout(1.0)
while True:
try:
output = client_cmd.recv(10000).decode("utf-8")
print (output)
except socket.timeout:
pass
. script . , stderr, , , - , 1 .
, , , script. , 100% , - .