Python Forum
Paramiko output printing issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paramiko output printing issue
#1
Here is my first ssh script, facing stdout printing issue
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! ...
Reply


Messages In This Thread
Paramiko output printing issue - by anna - Feb-05-2018, 05:39 PM
RE: Paramiko output printing issue - by Gribouillis - Feb-05-2018, 07:34 PM
RE: Paramiko output printing issue - by anna - Feb-06-2018, 06:07 AM
RE: Paramiko output printing issue - by anna - Feb-06-2018, 08:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Output from Paramiko exec_command from channel pemca 0 2,590 Dec-03-2021, 12:29 PM
Last Post: pemca
  Printing output without print usage susmith552 1 1,667 Feb-07-2020, 07:52 PM
Last Post: Clunk_Head
  How do I stop this fast factorization program from printing beyond the 3rd output? Pleiades 6 3,860 Dec-07-2019, 08:43 PM
Last Post: Pleiades
  multithreading issue with output mr_byte31 4 3,199 Sep-11-2019, 12:04 PM
Last Post: stullis
  Output issue twinpiques 6 3,173 Jul-29-2019, 11:24 PM
Last Post: Yoriz
  re.finditer issue, output is blank anna 1 2,367 Feb-07-2019, 10:41 AM
Last Post: stranac
  ciscolib cdp output list printing support anna 3 3,334 Jul-25-2018, 12:18 PM
Last Post: buran
  easysnmp output printing help anna 0 2,811 Apr-03-2018, 09:19 AM
Last Post: anna
  Output not printing when execute scripts in threads anna 1 2,736 Mar-21-2018, 05:08 PM
Last Post: woooee
  telnet unexpected output printing anna 3 3,581 Jan-17-2018, 01:16 PM
Last Post: anna

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020