diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Makefile.in | 1 | ||||
-rw-r--r-- | bin/alogin.in | 12 | ||||
-rw-r--r-- | bin/blogin.in | 18 | ||||
-rwxr-xr-x | bin/clogin.in | 18 | ||||
-rwxr-xr-x | bin/control_rancid.in | 75 | ||||
-rwxr-xr-x | bin/elogin.in | 12 | ||||
-rwxr-xr-x | bin/f10rancid.in | 10 | ||||
-rwxr-xr-x | bin/flogin.in | 204 | ||||
-rwxr-xr-x | bin/hlogin.in | 18 | ||||
-rw-r--r-- | bin/hpfilter.c | 1 | ||||
-rwxr-xr-x | bin/jrancid.in | 4 | ||||
-rwxr-xr-x | bin/par.in | 35 | ||||
-rwxr-xr-x | bin/rancid.in | 18 |
13 files changed, 284 insertions, 142 deletions
diff --git a/bin/Makefile.in b/bin/Makefile.in index 74652a3..ad98aa8 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -299,7 +299,6 @@ distdir: $(DISTFILES) || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done -hpfilter.o: hpfilter.c ../include/config.h ../include/version.h info-am: info: info-am diff --git a/bin/alogin.in b/bin/alogin.in index dc5afaa..03f12ca 100644 --- a/bin/alogin.in +++ b/bin/alogin.in @@ -465,9 +465,17 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|login| Login):" } + if { "$u_prompt" == "" } { + set u_prompt "(Username|login| Login):" + } else { + set u_prompt [lindex $u_prompt 0] + } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "\[Pp]assword:" } + if { "$p_prompt" == "" } { + set p_prompt "\[Pp]assword:" + } else { + set p_prompt [lindex $p_prompt 0] + } # Figure out cypher type if {[info exists cypher]} { diff --git a/bin/blogin.in b/bin/blogin.in index 811a0d0..23bf97c 100644 --- a/bin/blogin.in +++ b/bin/blogin.in @@ -536,11 +536,23 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|login|user name):" } + if { "$u_prompt" == "" } { + set u_prompt "(Username|login|user name):" + } else { + set u_prompt [lindex $u_prompt 0] + } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "(\[Pp]assword|passwd):" } + if { "$p_prompt" == "" } { + set p_prompt "(\[Pp]assword|passwd):" + } else { + set p_prompt [lindex $p_prompt 0] + } set e_prompt [find enableprompt $router] - if { "$e_prompt" == "" } { set e_prompt "\[Pp]assword:" } + if { "$e_prompt" == "" } { + set e_prompt "\[Pp]assword:" + } else { + set e_prompt [lindex $e_prompt 0] + } # Figure out cypher type if {[info exists cypher]} { diff --git a/bin/clogin.in b/bin/clogin.in index 9fff218..c026699 100755 --- a/bin/clogin.in +++ b/bin/clogin.in @@ -627,11 +627,23 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|Login|login|user name):" } + if { "$u_prompt" == "" } { + set u_prompt "(Username|Login|login|user name):" + } else { + set u_prompt [lindex $u_prompt 0] + } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "(\[Pp]assword|passwd):" } + if { "$p_prompt" == "" } { + set p_prompt "(\[Pp]assword|passwd):" + } else { + set p_prompt [lindex $p_prompt 0] + } set e_prompt [find enableprompt $router] - if { "$e_prompt" == "" } { set e_prompt "\[Pp]assword:" } + if { "$e_prompt" == "" } { + set e_prompt "\[Pp]assword:" + } else { + set e_prompt [lindex $e_prompt 0] + } # Figure out cypher type if {[info exists cypher]} { diff --git a/bin/control_rancid.in b/bin/control_rancid.in index dc453a0..42f14ae 100755 --- a/bin/control_rancid.in +++ b/bin/control_rancid.in @@ -131,12 +131,12 @@ fi # generate the list of all, up, & down routers cd $DIR trap 'rm -fr routers.db routers.all.new routers.down.new routers.up.new \ - $TMP;' 1 2 15 + routers.mail routers.added routers.deleted $TMP;' 1 2 15 grep -v '^#' router.db > routers.db cut -d: -f1,2 routers.db | sort -u > routers.all.new if [ ! -f routers.all ] ; then touch routers.all; fi diff routers.all routers.all.new > /dev/null 2>&1; RALL=$? -@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print join(":", @F)."\n") +@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print $_) if ($F[2] !~ /^up$/i);}' routers.db | sort -u > routers.down.new if [ ! -f routers.down ] ; then touch routers.down; fi diff routers.down routers.down.new > /dev/null 2>&1; RDOWN=$? @@ -149,32 +149,59 @@ if [ $RALL -ne 0 -o $RDOWN -ne 0 -o $RUP -ne 0 ] then ( if [ $RUP -ne 0 ] ; then - if [ $RUP -eq 1 ] ; then - echo Routers changed to up: - comm -13 routers.up routers.up.new | sed -e 's/^/ /' - echo - elif [ -s routers.up.new ] ; then - echo Routers changed to up: - sed -e 's/^/ /' routers.up.new - echo + if [ ! -s routers.up ] ; then + echo Routers changed to up: + sed -e 's/^/ /' routers.up.new + echo + else + WCUP=`comm -13 routers.up routers.up.new | wc -l | \ + sed -e 's/^ *\([^ ]*\)/\1/'` + if [ $WCUP -gt 0 ] ; then + echo Routers changed to up: + comm -13 routers.up routers.up.new | sed -e 's/^/ /' + echo + fi fi fi if [ $RDOWN -ne 0 ] ; then - if [ $RDOWN -eq 1 ] ; then - echo Routers changed to down: - comm -13 routers.down routers.down.new | sed -e 's/^/ /' - echo - elif [ -s routers.down.new ] ; then - echo Routers changed to down: - sed -e 's/^/ /' routers.down.new - echo + if [ ! -s routers.down ] ; then + echo Routers changed to down: + sed -e 's/^/ /' routers.down.new + echo + else + WCDOWN=`comm -13 routers.down routers.down.new | wc -l | \ + sed -e 's/^ *\([^ ]*\)/\1/'` + if [ $WCDOWN -eq 1 ] ; then + echo Routers changed to down: + comm -13 routers.down routers.down.new | \ + sed -e 's/^/ /' + echo + fi fi fi - WC=`wc -l routers.all | sed -e 's/^ *\([^ ]*\) .*$/\1/'` - WCNEW=`wc -l routers.all.new | sed -e 's/^ *\([^ ]*\) .*$/\1/'` - if [ $RALL -eq 1 -a $WC -gt $WCNEW ] ; then - echo Deleted routers: - comm -23 routers.all routers.all.new | sed -e 's/^/ /' + if [ $RALL -eq 1 ] ; then + comm -13 routers.all routers.all.new | sed -e 's/^/ /' \ + > routers.added + comm -23 routers.all routers.all.new | sed -e 's/^/ /' \ + > routers.deleted + + WCADDED=`wc -l routers.added | sed -e 's/^ *\([^ ]*\) .*$/\1/'` + WCDELETED=`wc -l routers.deleted | sed -e 's/^ *\([^ ]*\) .*$/\1/'` + + if [ $WCADDED -gt 0 ] + then + echo Added routers: + cat routers.added + echo + fi + if [ $WCDELETED -gt 0 ] + then + echo Deleted routers: + cat routers.deleted + echo + fi + + rm -f routers.added routers.deleted fi ) > routers.mail @@ -224,8 +251,8 @@ for router in `cut -d: -f1 ../routers.up` ; do cvs add -ko $router echo "CVS added missing router $router" fi - echo done +echo # cvs delete configs for routers not listed in routers.up. for router in `find . \( -name \*.new -prune -o -name CVS -prune \) -o -type f -print | sed -e 's/^.\///'` ; do grep -i "^$router:" ../router.db > /dev/null 2>&1 diff --git a/bin/elogin.in b/bin/elogin.in index a76155d..1b647fa 100755 --- a/bin/elogin.in +++ b/bin/elogin.in @@ -439,9 +439,17 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|login| Login):" } + if { "$u_prompt" == "" } { + set u_prompt "(Username|login| Login):" + } else { + set u_prompt [lindex $u_prompt 0] + } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "\[Pp]assword:" } + if { "$p_prompt" == "" } { + set p_prompt "\[Pp]assword:" + } else { + set p_prompt [lindex $p_prompt 0] + } # Figure out cypher type if {[info exists cypher]} { diff --git a/bin/f10rancid.in b/bin/f10rancid.in index 54ccd74..06528c5 100755 --- a/bin/f10rancid.in +++ b/bin/f10rancid.in @@ -242,10 +242,12 @@ sub ShowVersion { ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu\n"); next; } - if (/^(.*)\s+processor .*with (\d+[kK]?) bytes/) { - my($cpu) = $1; - my($mem) = $2; - my($type) = "Buffy"; + if (/^Chassis Type: (.*)$/) { + $type = $1; + } + if (/^(.*\s+Processor)( \d)?:(.*) with (\d+[kK]?) bytes/) { + my($cpu) = "$1$2:$3"; + my($mem) = $4; my($device) = "Force10"; ProcessHistory("COMMENTS","keysort","A1", "!Chassis type:$slave - a $device $type\n"); diff --git a/bin/flogin.in b/bin/flogin.in index 1e34077..1a34068 100755 --- a/bin/flogin.in +++ b/bin/flogin.in @@ -275,12 +275,13 @@ proc source_password_file { password_file } { } # Log into the router. -proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { - global spawn_id in_proc do_command do_script +proc login { router user userpswd passwd enapasswd cmethod cyphertype } { + global spawn_id in_proc do_command do_script platform + global prompt u_prompt p_prompt e_prompt set in_proc 1 set uprompt_seen 0 - # Telnet to the router & try to login. + # try each of the connection methods in $cmethod until one is successful set progs [llength $cmethod] foreach prog [lrange $cmethod 0 end] { if [string match "telnet*" $prog] { @@ -297,8 +298,8 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { } elseif ![string compare $prog "ssh"] { if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { send_user "\nError: ssh failed: $reason\n" - exit 1 - } + exit 1 + } } elseif ![string compare $prog "rsh"] { if [ catch {spawn rsh -l $user $router} reason ] { send_user "\nError: rsh failed: $reason\n" @@ -309,29 +310,28 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { return 1 } incr progs -1 - - sleep 0.3 - - # This helps cleanup each expect clause. - expect_after { - timeout { - send_user "\nError: TIMEOUT reached\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue - } - } eof { - send_user "\nError: EOF received\n" - catch {close}; wait - if { $in_proc} { - return 1 - } else { - continue + sleep 0.3 + + # This helps cleanup each expect clause. + expect_after { + timeout { + send_user "\nError: TIMEOUT reached\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } + } eof { + send_user "\nError: EOF received\n" + catch {close}; wait + if { $in_proc} { + return 1 + } else { + continue + } } - } - } + } # Here we get a little tricky. There are several possibilities: # the router can ask for a username and passwd and then @@ -341,71 +341,77 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { # then it will just send the passwd. # if telnet fails with connection refused, try ssh expect { - "Connection refused" { - close; wait - if { $tryssh } { - if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { - send_user "\nError: failed to ssh: $reason\n" - exit 1 - } - set tryssh 0 - sleep 0.3 - exp_continue - } else { - expect eof - send_user "\nError: Connection Refused\n"; wait; return 1 + -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by|Telnet server disabled)" { + catch {close}; wait + if !$progs { + send_user "\nError: Connection Refused ($prog)\n"; return 1 } - } eof { send_user "\nError: Couldn't login\n"; wait; return 1 - } "Unknown host\r\n" { - expect eof + } + eof { send_user "\nError: Couldn't login\n"; wait; return 1 } + -nocase "unknown host\r" { + catch {close}; send_user "\nError: Unknown host\n"; wait; return 1 - } "Host is unreachable" { - expect eof + } + "Host is unreachable" { + catch {close}; send_user "\nError: Host Unreachable!\n"; wait; return 1 - } "No address associated with name" { - expect eof + } + "No address associated with name" { + catch {close}; send_user "\nError: Unknown host\n"; wait; return 1 } - -re "Host key not found .* \(yes\/no\)\?" { - send "yes\r" - send_user "Host $router added to the list of known hosts.\n" - exp_continue } - -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { - send "no\r" - send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n" - return 1 } + -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" { + send "yes\r" + send_user "\nHost $router added to the list of known hosts.\n" + exp_continue } + -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { + send "no\r" + send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n" + return 1 } -re "Offending key for .* \(yes\/no\)\?" { send "no\r" send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n" return 1 } - denied { send_user "\nError: Check your passwd for $router\n" - catch {close}; wait; return 1 - } - "% Bad passwords" {send_user "\nError: Check your passwd for $router\n"; return 1 } - -re "(Username:|login:|Name :)" { - sleep 1; - send "$user\r" - set uprompt_seen 1 - exp_continue - } - "@\[^\r\n]+\[Pp]assword:" { + -re "(denied|Sorry)" { + send_user "\nError: Check your passwd for $router\n" + catch {close}; wait; return 1 + } + "Login failed" { + send_user "\nError: Check your passwd for $router\n" + return 1 + } + -re "% (Bad passwords|Authentication failed)" { + send_user "\nError: Check your passwd for $router\n" + return 1 + } + -re "@\[^\r\n]+ $p_prompt" { # ssh pwd prompt sleep 1 send "$userpswd\r" exp_continue } - "\[Pp]assword:" { - sleep 1; - if {$uprompt_seen == 1} { - send "$userpswd\r" - } else { - send "$passwd\r" - } - exp_continue - } - "$prompt" { break; } + -re "$u_prompt" { + send "$user\r" + set uprompt_seen 1 + exp_continue + } + -re "$p_prompt" { + sleep 1 + if {$uprompt_seen == 1} { + send "$userpswd\r" + } else { + send "$passwd\r" + } + exp_continue + } + "$prompt" { break; } + "Login invalid" { + send_user "\nError: Invalid login\n"; + catch {close}; wait; return 1 + } } } + set in_proc 0 return 0 } @@ -413,21 +419,25 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } { # Enable proc do_enable { enauser enapasswd } { global prompt in_proc + global u_prompt e_prompt set in_proc 1 - sleep 1; # dont go too fast for it now... + sleep 1; # dont go too fast for it now... send "enable\r" expect { - -re "(Username|User Name):" { send "$enauser\r"; exp_continue} - "Password:" { send "$enapasswd\r"; exp_continue} - "#" { } - denied { send_user "\nError: Check your Enable passwd\n"; return 1} - "% Bad passwords" { send_user "\nError: Check your Enable passwd\n" - return 1 - } + -re "$u_prompt" { send "$enauser\r"; exp_continue} + -re "$e_prompt" { send "$enapasswd\r"; exp_continue} + "#" { set prompt "#" } + "(enable)" { set prompt "> (enable) " } + denied { send_user "\nError: Check your Enable passwd\n"; + return 1 + } + "% Bad passwords" { send_user "\nError: Check your Enable passwd\n"; + return 1 + } } - # Set the prompt variable so script files don't need to know what it is. - set prompt "#" + # We set the prompt variable (above) so script files don't need + # to know what it is. set in_proc 0 return 0 } @@ -542,6 +552,26 @@ foreach router [lrange $argv $i end] { if { "$enauser" == "" } { set enauser $ruser } } + # Figure out prompts + set u_prompt [find userprompt $router] + if { "$u_prompt" == "" } { + set u_prompt "(Username|login|Name|User Name):" + } else { + set u_prompt [lindex $u_prompt 0] + } + set p_prompt [find passprompt $router] + if { "$p_prompt" == "" } { + set p_prompt "(\[Pp]assword):" + } else { + set p_prompt [lindex $p_prompt 0] + } + set e_prompt [find enableprompt $router] + if { "$e_prompt" == "" } { + set e_prompt "\[Pp]assword:" + } else { + set e_prompt [lindex $e_prompt 0] + } + # Figure out cypher tpye if {[info exists cypher]} { # command line cypher type @@ -556,7 +586,7 @@ foreach router [lrange $argv $i end] { if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} } # Login to the router - if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} { + if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} { continue } if { $enable } { diff --git a/bin/hlogin.in b/bin/hlogin.in index a3c00ac..917ea83 100755 --- a/bin/hlogin.in +++ b/bin/hlogin.in @@ -605,11 +605,23 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|login|user name):" } + if { "$u_prompt" == "" } { + set u_prompt "(Username|login|user name):" + } else { + set u_prompt [lindex $u_prompt 0] + } set p_prompt [find passprompt $router] - if { "$p_prompt" == "" } { set p_prompt "(\[Pp]assword|passwd):" } + if { "$p_prompt" == "" } { + set p_prompt "(\[Pp]assword|passwd):" + } else { + set p_prompt [lindex $p_prompt 0] + } set e_prompt [find enableprompt $router] - if { "$e_prompt" == "" } { set e_prompt "\[Pp]assword:" } + if { "$e_prompt" == "" } { + set e_prompt "\[Pp]assword:" + } else { + set e_prompt [lindex $e_prompt 0] + } # Figure out cypher type if {[info exists cypher]} { diff --git a/bin/hpfilter.c b/bin/hpfilter.c index f665b6f..83d799e 100644 --- a/bin/hpfilter.c +++ b/bin/hpfilter.c @@ -92,7 +92,6 @@ main(int argc, char **argv) signal(SIGCHLD, (void *) reapchild); signal(SIGHUP, (void *) reapchild); signal(SIGINT, (void *) reapchild); - signal(SIGKILL, (void *) reapchild); signal(SIGTERM, (void *) reapchild); /* create 2 pipes for send/recv and then fork and exec telnet */ diff --git a/bin/jrancid.in b/bin/jrancid.in index 4eb6ee3..238e704 100755 --- a/bin/jrancid.in +++ b/bin/jrancid.in @@ -329,6 +329,7 @@ sub ShowSystemBootMessages { /^\s+\^/ && return; /syntax error/ && return; /^JUNOS / && <INPUT> && next; + /^Timecounter "TSC" / && next; /^real memory / && next; /^avail memory / && next; /^\/dev\// && next; @@ -386,6 +387,9 @@ sub ShowConfiguration { if (/(\s*authentication-key ).*$/ && $filter_pwds >= 1) { s/(\s*authentication-key ).*$/#$1<removed>;/; } + if (/(\s*hello-authentication-key ).*$/ && $filter_pwds >= 1) { + s/(\s*hello-authentication-key ).*$/#$1<removed>;/; + } if (/^(.*\ssecret \")\$9\$.*(\".*)$/ && $filter_pwds >= 1) { s/^(.*\ssecret \")\$9\$.*(\".*)$/#$1<removed>$2/; } @@ -27,6 +27,10 @@ # -x = view par logs as they run through xterms # -i = run commands through interactive xterms # -d = print debugging to stderr +# -p # = pause # seconds between forks, default 0. +# -f = no file or STDIN, just run a quantity of $command. +# This precludes passing different args to each process. +# -e = exec args split by spaces rather than use sh -c # # par takes a list of items to run a command on. If the list entry begins # with a ":" the remainder of the line is the command to run ("{}" will be @@ -37,15 +41,17 @@ # line is assumed to be a command to be run. # use Getopt::Std; -getopts('n:l:c:xidq'); +getopts('p:n:l:c:fixedq'); $procs=$opt_n; $procs=3 if(!$procs); -$command=$opt_c;$command="{}" if(!$command); -$parlog=$opt_l; $parlog="par.log.".time if(!$parlog); +$command=$opt_c; #$command="{}" if(!$command); +$parlog=$opt_l; $parlog="par.log.".time() if(!$parlog); $debug=$opt_d; +$no_file=$opt_f ? 1 : 0; +$pause_time = $opt_p ? $opt_p : 0; if ($opt_q && ($opt_x || $opt_l)) { print STDERR "-q nullifies -x and -l\n"; - exit 1; + exit(1); } $signalled=0; @@ -54,7 +60,7 @@ sub handler { $signalled++; print STDERR "Received signal - ending run ($signalled).\n"; if($signalled>1) { - printf STDERR "Ok - killing $id!\n"; + printf(STDERR "Ok - killing $id!\n"); kill 9, 0; exit(1); } @@ -74,6 +80,10 @@ sub start { close(LOG); exec "($cmd) >>$logfile"; } else { + if($opt_e) { + # Don't use sh -c. + exec split(/\s+/, $cmd); + } exec "($cmd)"; } exit 0; @@ -95,13 +105,19 @@ sub watchf { unless(fork) { exec "xterm -e tail -f $log" ; exit 1; } } -for($i=0;<>;$i++) { +# this does not work, $_ doesnt end up with <> +#for($i=0; ($no_file && $i<$procs) || (! $no_file && <> ) ;$i++) { +for($i=0; ($no_file || ($_=<>)) ;$i++) { chop; if (/^\#/){$i--;next;} - if(/^:(.*)$/){$command=$1;$i--;next;} + if ($opt_c == "" && /^:(.*)$/) { + $command=$1;$i--;next; + } if ($i<$procs) { $logfile="running.$i"; $logfile="$parlog.$i" if (!$opt_q); - } else { $logfile=finish; } + } else { + $logfile=finish; + } last if $signalled; if ($logfile) { $cmd = $command; @@ -109,9 +125,10 @@ for($i=0;<>;$i++) { $cmd = "xterm -e $cmd" if ($opt_i); $id=start($cmd,$logfile); watchf($logfile) if($opt_x); - $log{$id}=$logfile; + $log{$id} = $logfile; } print STDERR "$i/$procs: $_: id=$id, log=$log{$id}\n" if ($debug); + sleep($pause_time) if ($pause_time); } if($signalled && !eof) { diff --git a/bin/rancid.in b/bin/rancid.in index 4bd7ee3..4566b58 100755 --- a/bin/rancid.in +++ b/bin/rancid.in @@ -671,9 +671,9 @@ sub ShowDiag { if (/^\s+PCA:\s+(.*)/) { local($part) = $1; $_ = <INPUT>; - /^\s+HW version (\S+)\s+S\/N (\S+)/ && - ProcessHistory("SLOT","keysort","C1","!Slot $slot/PCA: part $part, serial $2\n") && - ProcessHistory("SLOT","keysort","C2","!Slot $slot/PCA: hvers $1\n"); + /^\s+(HW version|design release) (\S+)\s+S\/N (\S+)/i && + ProcessHistory("SLOT","keysort","C1","!Slot $slot/PCA: part $part, serial $3\n") && + ProcessHistory("SLOT","keysort","C2","!Slot $slot/PCA: hvers $2\n"); next; } if (/^\s+MBUS: .*\)\s+(.*)/) { @@ -869,6 +869,7 @@ sub ShowVLAN { # This routine processes a "write term" sub WriteTerm { print STDERR " In WriteTerm: $_" if ($debug); + my($lineauto) = 0; while (<INPUT>) { tr/\015//d; @@ -878,6 +879,7 @@ sub WriteTerm { # the pager can not be disabled per-session on the PIX s/^<-+ More -+>\s*//; /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked + $lineauto = 0 if (/^[^ ]/); # skip the crap if (/^(##+$|(Building|Current) configuration)/i) { while (<INPUT>) { @@ -901,6 +903,8 @@ sub WriteTerm { /^ntp clock-period / && next; # kill ntp clock-period /^ length / && next; # kill length on serial lines /^ width / && next; # kill width on serial lines + $lineauto = 1 if /^ modem auto/; + /^ speed / && $lineauto && next; # kill speed on serial lines /^ clockrate / && next; # kill clockrate on serial interfaces if (/^(enable )?(password|passwd) / && $filter_pwds >= 1) { ProcessHistory("ENABLE","","","!$1$2 <removed>\n"); @@ -945,6 +949,14 @@ sub WriteTerm { if (/^( ip ospf authentication-key) / && $filter_pwds >= 1) { ProcessHistory("","","","!$1 <removed>\n"); next; } + # isis passwords appear to be completely plain-text + if (/^\s+isis password (\S+)( .*)?/ && $filter_pwds >= 1) { + ProcessHistory("","","","!isis password <removed>$2\n"); next; + } + if (/^\s+(domain-password|area-password) (\S+)( .*)?/ + && $filter_pwds >= 1) { + ProcessHistory("","","","!$1 <removed>$2\n"); next; + } # this is reversable, despite 'md5' in the cmd if (/^( ip ospf message-digest-key \d+ md5) / && $filter_pwds >= 1) { ProcessHistory("","","","!$1 <removed>\n"); next; |