[rancid] Help with Removing encrypted secret

Scott Brynen scott.brynen at visioncritical.com
Wed Feb 20 15:46:22 UTC 2013


The $1 is matching the entire matched string because you put () around the whole thing
What you're looking for is:
       if (/#spi remote-address (.*) spi-number (.*) encrypted secret .* description (.*)/ && $filter_pwds >= 1) {
            ProcessHistory("ADMIN","","","#spi remote-address $1 spi-number $2 encrypted secret <removed> description $3\n");
            next;
        }




Scott Brynen
Systems Operations Lead | Vision Critical
direct +1.604.638.9804 mobile +1.778.788.0543
web visioncritical.com<http://www.visioncritical.com>
From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Khurram Khan
Sent: Wednesday, February 20, 2013 2:18 AM
To: rancid-discuss at shrubbery.net
Subject: [rancid] Help with Removing encrypted secret

Hello All,

I've been lurking around the mailing list trying to find a solution to my issue. I'm trying to grab configuration from a Cisco ASR5000 which contains the configuration in the form of:

spi remote-address 192.168.3.50 spi-number 256 encrypted secret ba8533de9d50051d04c124ccebb16563 description "REMOTE-1"

Regex is not one of my forte's , and so far I've got the following to remove the encrypted key from the configuration which doesn't seem to be working

       if (/(\s+spi remote-address (.*) spi-number (.*) encrypted secret .* description .* )/ && $filter_pwds >= 1) {
            ProcessHistory("ADMIN","","","#spi remote-address $1 spi-number $2 encrypted secret <removed> description $4 $5\n");
            next;
        }

the result that I get in the configuration looks like:

#spi remote-address       spi remote-address 192.168.3.50 spi-number 256 encrypted secret ba8533de9d50051d04c124ccebb16563 description "REMOTE-1"  spi-number  encrypted secret <removed> description

i'm pretty sure i'm missing something in regex. If someone could point me in the right direction, I would really appreciate it.

Thank you in advance!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20130220/92371c5b/attachment.html>


More information about the Rancid-discuss mailing list