--- brancid 2009-08-26 22:39:21.000000000 -0400 +++ /usr/bin/bnrancid 2009-08-27 08:35:27.000000000 -0400 @@ -59,3 +59,3 @@ $found_end = 0; -$timeo = 90; # blogin timeout in seconds +$timeo = 90; # bnlogin timeout in seconds @@ -212,2 +212,4 @@ +sub ExitCommand { while() { next; } $found_end = 1; $clean_run = 1; return 0; } + # dummy function @@ -217,6 +219,7 @@ @commandtable = ( - {'bcc' => 'RunCommand'}, + {'terminal length 0' => 'RunCommand'}, {'show config' => 'ShowConfig'}, - {'show config -all' => 'ShowConfig'}, - {'exit' => 'RunCommand'} + {'show running-config' => 'ShowConfig'}, + {'show autosave' => 'ShowConfig'}, + {'exit' => 'ExitCommand'} ); @@ -249,9 +252,9 @@ } else { - print STDERR "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug); - print STDOUT "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log); + print STDERR "executing bnlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug); + print STDOUT "executing bnlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log); if (defined($ENV{NOPIPE})) { - system "blogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "blogin failed for $host: $!\n"; - open(INPUT, "< $host.raw") || die "blogin failed for $host: $!\n"; + system "bnlogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "bnlogin failed for $host: $!\n"; + open(INPUT, "< $host.raw") || die "bnlogin failed for $host: $!\n"; } else { - open(INPUT,"blogin -t $timeo -c \"$cisco_cmds\" $host ) { tr/\015//d; - if ( (/\>\s?logout$/) || $found_end ) { + if ( (/[\>#]\s*exit$/) || $found_end ) { $clean_run=1; @@ -287,4 +290,4 @@ if (/^Error:/) { - print STDOUT ("$host blogin error: $_"); - print STDERR ("$host blogin error: $_") if ($debug); + print STDOUT ("$host bnlogin error: $_"); + print STDERR ("$host bnlogin error: $_") if ($debug); $clean_run=0; @@ -292,6 +295,6 @@ } - while (/>\s*($cmds_regexp)\s*$/) { + while (/[>#]\s*($cmds_regexp)\s*$/) { $cmd = $1; if (!defined($prompt)) { - $prompt = ($_ =~ /^([^>]+>)/)[0]; + $prompt = ($_ =~ /^([^>#]+[>#])/)[0]; $prompt =~ s/([][}{)(\\])/\\$1/g; --- blogin 2009-08-26 22:39:21.000000000 -0400 +++ /usr/bin/bnlogin 2009-08-27 14:58:10.000000000 -0400 @@ -404,2 +404,10 @@ } + -re "Ctrl-Y" { send -- "\031" + expect { + -re "$p_prompt" { send -- "$userpswd\r" } + -re "ommand Line Interface" { send "C"; exp_continue } + -re "\[\^\:\]$prompt" { set in_proc 0; return 0 } + } + exp_continue + } -re "$u_prompt" { send -- "$user\r" @@ -416,2 +424,3 @@ -re "$p_prompt" { + if $in_proc { exp_continue } if ![string compare $prog "ssh"] { @@ -428,2 +437,3 @@ } + -re "ommand Line Interface" { send "C"; exp_continue } "$prompt" { break; } @@ -470,6 +480,2 @@ - send "more off\r" - - expect $prompt {} - regsub -all "\[)(]" $prompt {\\&} reprompt @@ -484,5 +490,5 @@ -re "\[\n\r]+" { exp_continue } + -re "Main Menu" { send "L" } } } - send "logout\r" expect { @@ -636,3 +642,2 @@ } elseif { $do_script } { - send "more off\r" expect $prompt {} --- brancid 2009-08-26 22:39:21.000000000 -0400 +++ /usr/bin/passrancid 2009-08-27 07:31:29.000000000 -0400 @@ -59,3 +59,3 @@ $found_end = 0; -$timeo = 90; # blogin timeout in seconds +$timeo = 90; # passlogin timeout in seconds @@ -172,5 +172,5 @@ tr/\015//d; - last if (/^$prompt/); + last if (/$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - next if (/^Reading configuration information/); + next if (/^Preparing to Display Configuration\.\.\.$/); next if (/^Can\'t find object or class named \"\-all\"\s*$/); @@ -178,2 +178,3 @@ next if (/^\# *uptime +\d+\s*$/); + next if (/^\#\s+(MON|TUE|WED|THU|FRI|SAT|SUN)/); if (/community label /) { @@ -186,5 +187,5 @@ } - # ProcessHistory("","","","!$_"); - if (/exit$/) { + if (/^back$/) { $found_end = 1; + ProcessHistory("","","","#$_"); return(1); @@ -212,2 +213,3 @@ +sub ExitCommand { while() { next; } $found_end = 1; $clean_run = 1; return 0; } # dummy function @@ -217,6 +219,5 @@ @commandtable = ( - {'bcc' => 'RunCommand'}, - {'show config' => 'ShowConfig'}, - {'show config -all' => 'ShowConfig'}, - {'exit' => 'RunCommand'} + {'config cli more false' => 'RunCommand'}, + {'show config' => 'ShowConfig'}, + {'exit' => 'ExitCommand'} ); @@ -249,9 +250,9 @@ } else { - print STDERR "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug); - print STDOUT "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log); + print STDERR "executing passlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug); + print STDOUT "executing passlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log); if (defined($ENV{NOPIPE})) { - system "blogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "blogin failed for $host: $!\n"; - open(INPUT, "< $host.raw") || die "blogin failed for $host: $!\n"; + system "passlogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "passlogin failed for $host: $!\n"; + open(INPUT, "< $host.raw") || die "passlogin failed for $host: $!\n"; } else { - open(INPUT,"blogin -t $timeo -c \"$cisco_cmds\" $host ) { tr/\015//d; - if ( (/\>\s?logout$/) || $found_end ) { + if ( (/#\s*exit\s*$/) || $found_end ) { $clean_run=1; @@ -287,4 +288,4 @@ if (/^Error:/) { - print STDOUT ("$host blogin error: $_"); - print STDERR ("$host blogin error: $_") if ($debug); + print STDOUT ("$host passlogin error: $_"); + print STDERR ("$host passlogin error: $_") if ($debug); $clean_run=0; @@ -292,6 +293,6 @@ } - while (/>\s*($cmds_regexp)\s*$/) { + while (/[>#]\s*($cmds_regexp)\s*$/) { $cmd = $1; if (!defined($prompt)) { - $prompt = ($_ =~ /^([^>]+>)/)[0]; + $prompt = ($_ =~ /^([^>#]+[>#])/)[0]; $prompt =~ s/([][}{)(\\])/\\$1/g; --- blogin 2009-08-26 22:39:21.000000000 -0400 +++ /usr/bin/passlogin 2009-08-27 06:29:22.000000000 -0400 @@ -470,6 +470,2 @@ - send "more off\r" - - expect $prompt {} - regsub -all "\[)(]" $prompt {\\&} reprompt @@ -636,3 +632,2 @@ } elseif { $do_script } { - send "more off\r" expect $prompt {} --- rancid-fe 2009-08-26 22:39:21.000000000 -0400 +++ /usr/bin/rancid-fe 2009-08-27 07:35:19.000000000 -0400 @@ -57,2 +57,3 @@ 'baynet' => 'brancid', + 'baynortel' => 'bnrancid', 'cat5' => 'cat5rancid', @@ -77,2 +78,3 @@ 'netscreen' => 'nrancid', + 'passport' => 'passrancid', 'procket' => 'prancid',