Working with Cisco Routers and Switches with Python

I’ve updated the pyMultiChange.py script. It now is fully functional, with the addition of enable mode functionality. With this script, you can take a list of routers and switches from a text file and execute a series of commands, from a text file, all from SSH. For example:

Here is the usage output, if you don’t select the required arguments:

Here is the usage output, without verbose / debugging mode:

Here is the usage output, with verbose / debugging mode:

 

Finally, here is the code:

I’m going to continue working on building out the pyRouterLib module, as there is so much functionality that could be added to that. I’ll keep you updated on the progress. As always, updates will be posted to my github.

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone

July 27, 2014

Posted In: Cisco Administration Python Scripting, Miscellaneous Hacking, Python Tips, System Administration

Updating my Python Scripts to access Cisco Devices

I’ve been working to migrate my python scripts, that access Cisco routers and switches to utilize SSH. I’m building out a ‘pyRouterLib’ class, that currently doesn’t have much functionality, but I’m going to be building it out a lot more in the coming months. I’m also working on my pyMultiChange script, so that it utilizes SSH as well. Currently, the work is going well, although, there is still more work to go.

Here is the pyRouterLib library:

Here is the pyMultiShow.py script, which utilizes the pyRouterLib to obtain user credentials:

Both can be accessed from my github.

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone

July 26, 2014

Posted In: Cisco Administration Python Scripting, Python Tips