summaryrefslogtreecommitdiffstats
path: root/bin/rancid.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rancid.in')
-rwxr-xr-xbin/rancid.in54
1 files changed, 50 insertions, 4 deletions
diff --git a/bin/rancid.in b/bin/rancid.in
index 24b9d14..065697a 100755
--- a/bin/rancid.in
+++ b/bin/rancid.in
@@ -138,6 +138,7 @@ sub ShowVersion {
tr/\015//d;
last if(/^$prompt/);
next if(/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
if (/^Slave in slot (\d+) is running/) {
$slave = " Slave:";
next;
@@ -213,6 +214,9 @@ sub ShowVersion {
} elsif ( $1 =~ /WS-C35/) {
$type = "3500XL";
$device = "switch";
+ } elsif ( $1 =~ /6000/) {
+ $type = "6000";
+ $device = "switch";
} else {
$type = $1;
}
@@ -281,6 +285,7 @@ sub ShowInstallActive {
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /^\s*\^\s*$/;
return(1) if /(Invalid input detected|Type help or )/;
+ return(-1) if (/command authorization failed/i);
ProcessHistory("COMMENTS","keysort","F5","!Image: $_") && next;
}
return(0);
@@ -296,6 +301,7 @@ sub ShowEnv {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type !~ /^7/);
+ return(-1) if (/command authorization failed/i);
if (!defined($E0)) {
$E0=1;
ProcessHistory("COMMENTS","keysort","E0","!\n");
@@ -329,6 +335,7 @@ sub ShowGSR {
tr/\015//d;
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
return(1) if ($type !~ /^120/);
/^$/ && next;
/^\s+Chassis: type (\S+) Fab Ver: (\S+)/ &&
@@ -364,6 +371,7 @@ sub ShowBoot {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /^\s*\^\s*$/;
+ return(-1) if (/command authorization failed/i);
return(1) if /Ambiguous command/i;
return(1) if /(Invalid input detected|Type help or )/;
return(1) if /(Open device \S+ failed|Error opening \S+:)/;
@@ -395,6 +403,7 @@ sub ShowFlash {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type =~ /^(120|7)/);
+ return(-1) if (/command authorization failed/i);
return(1) if /^\s*\^\s*$/;
return(1) if /(Invalid input detected|Type help or )/;
ProcessHistory("FLASH","","","!Flash: $_");
@@ -421,6 +430,7 @@ sub DirSlotN {
return(1) if /No space information available/;
return(-1) if /\%Error calling/;
return(-1) if /: device being squeezed/; # Flash is busy
+ return(-1) if (/command authorization failed/i);
return(1) if /(Open device \S+ failed|Error opening \S+:)/;
ProcessHistory("FLASH","","","!Flash: $dev: $_");
}
@@ -438,6 +448,7 @@ sub ShowContAll {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type =~ /^(120|7[05])/);
+ return(-1) if (/command authorization failed/i);
if (/^Interface ([^ \n(]*)/) { $INT = "$1, "; next; }
/^(BRI unit \d)/ &&
ProcessHistory("INT","","","!Interface: $1\n") && next;
@@ -495,6 +506,7 @@ sub ShowContCbus {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type !~ /^7[05]0/);
+ return(-1) if (/command authorization failed/i);
if (/^\s*slot(\d+): ([^,]+), hw (\S+), sw (\S+), ccb/) {
$slot = $1;
$board{$slot} = $2;
@@ -539,6 +551,7 @@ sub ShowDiagbus {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type !~ /^7[05]/);
+ return(-1) if (/command authorization failed/i);
if (/^\s*Slot (\d+):/i) {
$slot = $1;
next;
@@ -624,6 +637,7 @@ sub ShowDiag {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type !~ /^(120|720|36|26)/);
+ return(-1) if (/command authorization failed/i);
/^$/ && next;
if (!defined($showdiags)) {$showdiags=1; ProcessHistory("SLOT","","","!\n");}
s/Port Packet Over SONET/POS/;
@@ -632,6 +646,7 @@ sub ShowDiag {
ProcessHistory("SLOT","","","!Slot $slot: $3\n");
# Here we look for boards that don't have DRAM.
$board = "Other";
+ $board = "PS" if (/Power Supply/);
$board = "RP" if (/Route Processor/);
$board = "CLK" if (/Clock Scheduler Card/);
$board = "SFC" if (/Switch Fabric Card/);
@@ -640,6 +655,9 @@ sub ShowDiag {
if (/^\s+MAIN:\s+ type \d+,\s+(.*)/) {
ProcessHistory("SLOT","","","!Slot $slot/MAIN: part $1\n") && next;
}
+ if (/ Engine:\s+(.*)/) {
+ ProcessHistory("SLOT","","","!Slot $slot/Engine: $1\n");
+ }
if (/^\s+PCA:\s+(.*)/) {
local($part) = $1;
$_ = <INPUT>;
@@ -720,6 +738,7 @@ sub ShowModule {
return if (/^\s*\^$/);
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
# match slot info line, slot info then the rev info (the two are split)
if (/^ ?(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) {
@@ -750,6 +769,7 @@ sub ShowC7200 {
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if ($type !~ /^72/);
+ return(-1) if (/command authorization failed/i);
/^$/ && next;
if (/C7200 Midplane EEPROM:/) {
$_ = <INPUT>;
@@ -783,14 +803,37 @@ sub ShowVTP {
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /^\s*\^\s*$/;
return(1) if /(Invalid input detected|Type help or )/;
- return(1) if ($type !~ /^2900XL$/);
+ return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);
+ return(-1) if (/command authorization failed/i);
next if (/^Configuration last modified by/);
+ if (/^VTP Operating Mode\s+:\s+(Transparent|Server)/) {
+ $DO_SHOW_VLAN = 1;
+ }
ProcessHistory("COMMENTS","keysort","I0","!VTP: $_");
}
ProcessHistory("COMMENTS","keysort","I0","!\n");
return(0);
}
+# This routine parses "show vlan"
+sub ShowVLAN {
+ print STDERR " In ShowVLAN: $_" if ($debug);
+
+ ($_=<INPUT>,return(1)) if (!$DO_SHOW_VLAN);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /(Invalid input detected|Type help or )/;
+ return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);
+ return(-1) if (/command authorization failed/i);
+ ProcessHistory("COMMENTS","keysort","IO","!VLAN: $_");
+ }
+ ProcessHistory("COMMENTS","keysort","IO","!\n");
+ return(0);
+}
+
# This routine processes a "write term"
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
@@ -798,6 +841,7 @@ sub WriteTerm {
while (<INPUT>) {
tr/\015//d;
last if(/^$prompt/);
+ return(-1) if (/command authorization failed/i);
# 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
@@ -898,9 +942,6 @@ sub WriteTerm {
# order logging statements
/^logging (\d+\.\d+\.\d+\.\d+)/ &&
ProcessHistory("LOGGING","ipsort","$1","$_") && next;
- # order name-server statements
- /^ip name-server (\d+\.\d+\.\d+\.\d+)/ &&
- ProcessHistory("NAMESERVER","ipsort","$1","$_") && next;
# order/prune snmp-server host statements
# we only prune lines of the form
# snmp-server host a.b.c.d <community>
@@ -993,6 +1034,7 @@ sub DoNothing {print STDOUT;}
'show gsr chassis' => "ShowGSR",
'show boot' => "ShowBoot",
'show bootvar' => "ShowBoot",
+ 'show variables boot' => "ShowBoot",
'show flash' => "ShowFlash",
'dir /all nvram:' => "DirSlotN",
'dir /all bootflash:' => "DirSlotN",
@@ -1007,6 +1049,7 @@ sub DoNothing {print STDOUT;}
'show module' => "ShowModule", # cat 6500-ios
'show c7200' => "ShowC7200",
'show vtp status' => "ShowVTP",
+ 'show vlan' => "ShowVLAN",
'write term' => "WriteTerm"
);
# keys() doesnt return things in the order entered and the order of the
@@ -1018,6 +1061,7 @@ sub DoNothing {print STDOUT;}
"show gsr chassis",
"show boot",
"show bootvar",
+ "show variables boot",
"show flash",
"dir /all nvram:",
"dir /all bootflash:",
@@ -1032,6 +1076,7 @@ sub DoNothing {print STDOUT;}
"show module",
"show c7200",
"show vtp status",
+ "show vlan",
"write term"
);
$cisco_cmds=join(";",@commands);
@@ -1057,6 +1102,7 @@ if ($file) {
}
}
+ProcessHistory("","","","!RANCID-CONTENT-TYPE: cisco\n!\n");
ProcessHistory("COMMENTS","keysort","B0","!\n");
ProcessHistory("COMMENTS","keysort","F0","!\n");
ProcessHistory("COMMENTS","keysort","G0","!\n");