Running commands on cisco routers using python

Hartmut Goebel h.goebel at goebel-consult.de
Tue May 20 04:09:14 EDT 2008


Mike Driscoll schrieb:
> On May 19, 10:18 am, SPJ <mail2... at yahoo.com> wrote:
>> Is it possible to run specific commands on cisco router using Python?
>> I have to run command "show access-list" on few hundred cisco routers and get the dump into a file. Please let me know if it is feasible and the best way to achieve this.
>>
>> Thanks,
>> SPJ
> 
> I think it depends on how you're connecting to the routers.
> Theoretically, you should be able to use Python's socket or ssh
> modules to connect to them, send commands and capture the output.

I've implemented a toolset for login into cisco components, issueing 
commands and fetchign the results. Works like a charm.

Keypoint here is using pexpect for interacting with SSH.

-- 
Schönen Gruß - Regards
Hartmut Goebel

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de



More information about the Python-list mailing list