From 4d684aecaacc9a59e7e9c0661934aeba0b16efec Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Wed, 30 Mar 2005 07:52:00 +0000 Subject: Imported from rancid-2.3.2a.tar.gz. --- bin/nrancid.in | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'bin/nrancid.in') diff --git a/bin/nrancid.in b/bin/nrancid.in index 9b965a2..3f2b224 100644 --- a/bin/nrancid.in +++ b/bin/nrancid.in @@ -1,6 +1,6 @@ #! @PERLV_PATH@ ## -## $Id: nrancid.in,v 1.13 2004/01/11 03:49:13 heas Exp $ +## $Id: nrancid.in,v 1.17 2004/10/15 08:56:01 afort Exp $ ## ## Copyright (C) 1997-2004 by Terrapin Communications, Inc. ## All rights reserved. @@ -147,6 +147,8 @@ sub GetSystem { tr/\015//d; next if /^\s*$/; last if(/$prompt/); + # throw away the pager lines + next if /^--- more ---/; /^Serial Number: (\d+), Control Number: \d+$/ && ProcessHistory("SYSTEM","","", "!SN: $1\n") && next; @@ -182,7 +184,10 @@ sub GetConf { while () { tr/\015//d; next if /^\s*$/; + next if /^Total Config.+$/i; last if(/$prompt/); + # throw away the pager lines + next if /^--- more ---/; if (/^set admin name "(\S+)"$/ && $filter_pwds >= 1) { ProcessHistory("ADMIN","","","!set admin name \n"); @@ -197,6 +202,7 @@ sub GetConf { ProcessHistory("ADMIN","","", "!set admin user $1 password privilege $3\n"); next; + } ProcessHistory("","","","$_"); } $found_end=1; @@ -242,11 +248,11 @@ if ($file) { # determine password filtering mode if ($ENV{"FILTER_PWDS"} =~ /no/i) { - $filter_pwds = 0; + $filter_pwds = 0; } elsif ($ENV{"FILTER_PWDS"} =~ /all/i) { - $filter_pwds = 2; + $filter_pwds = 2; } else { - $filter_pwds = 1; + $filter_pwds = 1; } ProcessHistory("","","","!RANCID-CONTENT-TYPE: netscreen\n!\n"); @@ -260,7 +266,8 @@ TOP: while() { while (/>\s*($cmds_regexp)\s*$/) { $cmd = $1; if (!defined($prompt)) { - $prompt = "\-\>\s*"; + $prompt = ($_ =~ /^([^>]+->)/)[0]; + $prompt =~ s/([][}{)(\\])/\\$1/g; print STDERR ("PROMPT MATCH: $prompt\n") if ($debug); } print STDERR ("HIT COMMAND:$_") if ($debug); -- cgit