soonix's user image
User since: Jan 25, 2013 at 21:42 UTC (11 years ago)
Last here: Jul 19, 2024 at 06:36 UTC (1 day ago)
Experience: 29432
Level:Canon (20)
Writeups: 1047
Location:Rockenhausen, Germany (Caveat: german language, oldest entry first)
User's localtime: Jul 20, 2024 at 14:39 CEST
Scratchpad: View
For this user:Search nodes

Posts by soonix
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
    Just noticed (via german-lnguage publisher heise) that Perl is on rank 9 in TIOBE's January 2015 list.
    Still not #1, but certainly not dead :-)

    Update: I would have included a link to TIOBE if they had permalinks to specific months.