title: Python: SSH into Cisco device and run show commands
body: <p>I have read over this post extensively and have researched Exscript, paramiko, Fabric and pxssh and I am still lost <a href="https://stackoverflow.com/questions/5238000/persistent-ssh-session-to-cisco-router">Persistent ssh session to Cisco router</a> . I am new to python scripting.</p>
  
  <p>I am attempting to write a script in Python that will SSH into a Cisco device, run "show version", display the results in notepad, then end the script. </p>
  
  <p>I can get this working with show commands that do not require the user to interact with the device. For example:</p>
  
  <pre><code>from Exscript.util.interact import read_login
  from Exscript.protocols import SSH2
  
  account = read_login()              
  conn = SSH2()                       
  conn.connect('192.168.1.11')     
  conn.login(account)                 
  
  conn.execute('show ip route')
  print conn.response
  
  conn.send('exit\r')               
  conn.close()                        
  </code></pre>
  
  <p>The above script will display the results of "show ip route". </p>
  
  <p>If I try conn.execute('show version') the script times out because the Cisco device is expecting the user to press space bar to continue, press return to show the next line or any key to back out to the command line. </p>
  
  <p>How can I execute the show version command, press space bar twice to display the entire output of the show version command, then print it in python? </p>
  
  <p>Thank you!!!!</p>