On May 19, 4:18*pm, SPJ <mail2...@yahoo.comwrote:
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.
There's no way I'd think about doing this in python. The best tool
for the task is just shell IMHO:
flub@signy:~$ ssh mercury show access-lists
Welcome to mercury
root@mercury's password:
Standard IP access list 1
10 permit any (265350 matches)
Standard IP access list 23
10 permit 192.168.2.0, wildcard bits 0.0.0.255 (2 matches)
Extended IP access list 100
10 deny ip any 192.168.0.0 0.0.255.255 log-input (8576 matches)
20 permit ip any any (743438 matches)Connection to mercury closed
by remote host.
flub@signy:~$
You could plug in expect to solve the password thing. Search for "ssh
expect" for that (and ignore suggestions about public keys, I haven't
found yet how to use those on cisco).