Python Forum
Paramiko output printing issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paramiko output printing issue
#3
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 (socket.error,paramiko.AuthenticationException,paramiko.SSHException) as message:
        print "ERROR: SSH connection to "+ip+" failed: " +str(message)
        sys.exit(1)
except paramiko.SSHException:
       print "[-] SSH Exception! ..."
showing as below error

Connected to 10.124.117.12
No handlers could be found for logger "paramiko.transport"
ERROR: SSH connection to 10.124.117.12 failed: (1, 'Administratively prohibited')
however I am able to telnet from command prompt


ssh -l ops 10.124.117.12

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! **** WARNING: UNAUTHORISED ACCESS PROHIBITED **** !
! You are about to log on to a proprietary system where access is provided, !
! by the Owner of the system, only to authorized users. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[email protected]'s password:

*A:BNG_01# logout
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,605 Dec-03-2021, 12:29 PM
Last Post: pemca
  Printing output without print usage susmith552 1 1,673 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,881 Dec-07-2019, 08:43 PM
Last Post: Pleiades
  multithreading issue with output mr_byte31 4 3,220 Sep-11-2019, 12:04 PM
Last Post: stullis
  Output issue twinpiques 6 3,197 Jul-29-2019, 11:24 PM
Last Post: Yoriz
  re.finditer issue, output is blank anna 1 2,381 Feb-07-2019, 10:41 AM
Last Post: stranac
  ciscolib cdp output list printing support anna 3 3,344 Jul-25-2018, 12:18 PM
Last Post: buran
  easysnmp output printing help anna 0 2,822 Apr-03-2018, 09:19 AM
Last Post: anna
  Output not printing when execute scripts in threads anna 1 2,749 Mar-21-2018, 05:08 PM
Last Post: woooee
  telnet unexpected output printing anna 3 3,603 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