title: Filter output from python paramiko interactive shell
body: <p>I'm using paramiko to SSH into huawei routers and get the output. Here i'm doing the SSH from a jumpserver . So first i have to SSH into jump server.So i have used get_transport() method to ssh from jump server to Huawei router. Since this is a huawei router i have to use invoke_shell() method to get the command output. My problem is that i'm getting all the information from the shell output For example i get the banner while connecting to router from jumpserver and hostname of the router and command applied ( not only the command output ). So how do i filter command output?</p>
  <pre><code>import time
  import paramiko
  import csv
  
  ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  
  ssh.connect('10.X.X.X',22, username='user', password='password')
  
  vmtransport = ssh.get_transport()
  dest_addr = ('10.Y.Y.Y', 22)
  local_addr = ('10.X.X.X', 22)
  vmchannel = vmtransport.open_channel(&quot;direct-tcpip&quot;, dest_addr, local_addr)
  
  
  
  
  client = paramiko.SSHClient()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  client.connect('10.Y.Y.Y', username='user', password='password', sock=vmchannel)
  
  
  commands = client.invoke_shell()       # Request an interactive shell session on this channel.
  
  commands.send(&quot;display clock\n&quot;)
  time.sleep(1)
  output = commands.recv(65535)
  output = output.decode(&quot;utf-8&quot;)
  
  
  print(output)
  </code></pre>