ciscodump - dump config info from routers into files
in Cool Uses for Perl
2 direct replies — Read more / Contribute
|
by soonix
on Nov 05, 2015 at 09:59
|
This is a script for reading config info from a bunch of routers (for archiving, autiting, whatever)
The configuration for the script itself is read from a INI-style config file (example below). Each router is represented by a section with its name or IP as the section header. The "info" attribute is mandatory (originally intended as title information for a to-be-generated report). Then there has to be a section "dump" (which means if you have a router with a hostname of "dump", you have to refer to it by its IP address).
Each entry in the "dump" section results in a command sent to the router(s), and the output of this command is written to a file.
The output is placed in the directory named by "dir" in the top INI section. Each router gets its own subdirectory, and if set "debug", there will be a subdirectory "debug" - so you should not use "debug" as hostname, either :-)
The "enable" password is needed, because on Cisco devices, the terminal size command is privileged. Initially, I used Net::Telnet::Cisco, and later adapted it for SSH. After trying with SSH modules directly, I settled with Control::CLI. It took me a while noticing that they use different ways of to specify prompts, before getting it to work.
Of course it is bad to have passwords stored as plaintext, but at least they are kept separate from the script itself. It runs under Windows, but should work under other systems, too.
Additionally, I uploaded it to a github gist, just in case someone wants to tinker.
|
Perl back in TIOBE top ten
in Perl News
2 direct replies — Read more / Contribute
|
by soonix
on Jan 08, 2015 at 10:53
|
|