Anesh
Anesh

Reputation: 194

Paramiko ssh output stops at --more--

The output stops printing at --more-- any idea how to get the end of the output

 >>> import paramiko
 >>> ssh = paramiko.SSHClient()
 >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
 >>> conn=ssh.connect("ipaddress",username="user", password="pass")
 >>> channel = ssh.invoke_shell()
 >>> channel.send("en\n")
 3
 >>> channel.send("password\n")
 9 
 >>> channel.send("show security local-user-list\n")
 30
 >>> results = ''
 >>> channel.send("\n")
 1
 >>> results += channel.recv(5000)
 >>> print results

 bluecoat>en
 Password:
 bluecoat#show security local-user-list
 Default List: local_user_database
 Append users loaded from file to default list: false
 local_user_database
 Lockout parameters:
 Max failed attempts: 60
 Lockout duration:    3600
 Reset interval:      7200
 Users:
 Groups:

 admin_local
  Lockout parameters:
  Max failed attempts: 60
 Lockout duration:    3600
 Reset interval:      7200
 Users:
  <username>
    Hashed Password: 
    Enabled:         true
    Groups:

  <username>
    Hashed Password: 
    Enabled:         true
  **--More--**

As you can see above the output stops printing at --more-- any idea how to get the output to print till the end.

Upvotes: 1

Views: 827

Answers (2)

Mahesh Tawade
Mahesh Tawade

Reputation: 1

It worked well with time.sleep(0.001):

while connection.recv_ready():
    time.sleep(0.001)
    outputtostr += connection.recv(2048).decode("utf-8")
return outputtostr

Upvotes: 0

Anesh
Anesh

Reputation: 194

Increasing the height of the terminal in the paramiko connect method fixed this issue

Upvotes: 1

Related Questions