#!/usr/bin/perl -w # # iosSanitize2.pl -- remove and other such confidential strings from IOS configurations # prior to distribution. # # usage: # # iosSanitize2.pl # # created on Thursday, October 30, 2003 by Mark Leighty ( mleighty@harfordtechnology.com ) # # Copyright (2003) Harford Technology Corporation With the exception of commercial # resale, lease, license or other commercial transactions, permission is granted to # use, copy, modify, and distribute this software. By exercising this permission you # agree, that this Notice will accompany this software at all times. # # Harford Technology Corporation MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND # CONCERNING THIS SOFTWARE OR USE THEREOF. # #---------------------------- Revision Log ----------------------------------# #$Version = 0.89; # mleighty@harfordtechnology.com # Currently "pre-production" however as features get added and we get some data # it should be functional. #-------------------------- End Revision Log --------------------------------# $ORIGINAL = $ARGV[0]; $SANITIZED = ">$ARGV[0]\.distribution"; open ORIGINAL or die "can't open $ORIGINAL"; open SANITIZED or die "can't open $SANITIZED"; while () { if ( /^enable secret/ ) { print SANITIZED "enable secret 5 XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^enable password/ ) { print SANITIZED "enable password XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^ password/ ) { print SANITIZED " password 7 XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^tacacs-server host/ ) { print SANITIZED "tacacs-server host a.b.c.d\n"; } elsif ( /^tacacs-server key/ ) { print SANITIZED "tacacs-server key XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^snmp-server community/ ) { print SANITIZED "snmp-server community XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^snmp-server host/ ) { print SANITIZED "snmp-server host w.x.y.z\n" } elsif ( /^username/ ) { print SANITIZED "username XXXXX privilege Y password 7 XxXxXxXxXxXxXxXxXxXxX\n"; } elsif ( /^ neighbor (.+) password/ ) { print SANITIZED " neighbor $1 password 7 XxXxXxXxXxXxXxXxXxXxX\n"; } else { print SANITIZED $_; } } close ORIGINAL; close SANITIZED; exit