Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6353751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:27:55+00:00 2026-05-24T22:27:55+00:00

I have read over this post extensively and have researched Exscript, paramiko, Fabric and

  • 0

I have read over this post extensively and have researched Exscript, paramiko, Fabric and pxssh and I am still lost Persistent ssh session to Cisco router . I am new to python scripting.

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.

I can get this working with show commands that do not require the user to interact with the device. For example:

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()                        

The above script will display the results of “show ip route”.

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.

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?

Thank you!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:27:55+00:00Added an answer on May 24, 2026 at 10:27 pm

    Try executing terminal length 0 before running show version. For example:

    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('terminal length 0')           
    
    conn.execute('show version')
    print conn.response
    
    conn.send('exit\r')               
    conn.close()  
    

    From the Cisco terminal docs: http://www.cisco.com/en/US/docs/ios/12_1/configfun/command/reference/frd1003.html#wp1019281

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read over this which sort of gives an explanation of when you'd
I have quickly read over the Microsoft Lambda Expression documentation. This kind of example
I have read this post about how to test private methods. I usually do
I have read this post and it doesn't answer my question. Stateless session bean
I have already read this post: Making TextView scrollable on Android without success. My
Alright...I've given the site a fair search and have read over many posts about
So I saw this post here and read it and it seems like bulk
Okay, this should be really simple, but I have searched all over for the
I read several documents with conflicting view: This post says that you cannot use
I have asked this question in a different post here on SO: How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.