Here is my first ssh script, facing stdout printing issue
Error as below
import socket socket.setdefaulttimeout(5) import paramiko import sys import threading import os import time ip = '10.124.117.12' user = 'ops' passwd = 'BN123' ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(ip,username=user,password=passwd, timeout=5) print "Connected to %s" % ip time.sleep(5) connection = ssh.invoke_shell() stdin, stdout, stderr = ssh.exec_command("show chassis\n") result = stdout.read().decode('ascii').strip("\n") ssh.close() print result except paramiko.AuthenticationException: print "[-] Authentication Exception! ..." except paramiko.SSHException: print "[-] SSH Exception! ..."
Error as below
python DnCollector.py Connected to 10.124.117.188 No handlers could be found for logger "paramiko.transport" [-] SSH Exception! ...