cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1629
Views
5
Helpful
1
Replies

Python Script to SSH and display output on screen

himanshu87
Level 1
Level 1

1. SSH into 1st device
2. Press Enter
3. Telnet into another device
4. Execute commands, prints them on screen until user enters "Exit"

 

I am able to do ssh and telnet. How to make a loop which asks for command until exit is entered.

 

Thanks

Himanshu

1 Reply 1

If you do a google search for how to emulate a do-while loop in Python, you'll be able to see many examples of how to create such a loop.  In your case, you'd exit the loop if the text the user inputted was "Exit", otherwise, pass the command through to the device.

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.