summaryrefslogtreecommitdiffstats
path: root/bin/cat5rancid
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cat5rancid')
-rwxr-xr-xbin/cat5rancid127
1 files changed, 87 insertions, 40 deletions
diff --git a/bin/cat5rancid b/bin/cat5rancid
index 0055cc8..8073448 100755
--- a/bin/cat5rancid
+++ b/bin/cat5rancid
@@ -681,6 +681,36 @@ sub ShowDiag {
return(0);
}
+# This routine parses "show module"
+sub ShowModule {
+ print STDERR " In ShowModule: $_" if ($debug);
+
+# # eat the header lines
+# $junk = <INPUT>;
+# $junk = <INPUT>;
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if(/^$prompt/);
+# last if(/^$/);
+# $junk = $_;
+# $slot = substr($junk, 0, 2) + 0;
+# $port = substr($junk, 24, 3) + 0;
+# $plu = "";
+# $plu = "s" if $port > 1;
+# $type = substr($junk, 30, 21);
+# $type =~ s/^\s+//;
+# $type =~ s/\s+$//;
+# $board = substr($junk, 52, 9);
+# $board =~ s/ //;
+# $serial = substr($junk, 62,9) + 0;
+# ProcessHistory("SLOT","","","!Slot $slot/$board: $type, $port port$plu, serial $serial\n");
+ ProcessHistory("SLOT","","","! $_");
+ }
+ # The "write term" code gives us one of these, so skip it here
+ # ProcessHistory("SLOT","","","!\n");
+}
+
# This routine parses "show c7200" for the 7200
# This will create arrarys for hw info.
sub ShowC7200 {
@@ -721,7 +751,8 @@ sub WriteTerm {
while (<INPUT>) {
tr/\015//d;
- last if(/^$prompt/);
+ last if (/^$prompt/);
+#heas next if (/^\.+$/);
/Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
# skip the crap
if (/^(\.\.+$|##+$|Building configuration...)/i) {
@@ -810,26 +841,40 @@ sub WriteTerm {
/^access-list\s+(\d\d\d)\s+(\S+)\s+ip\s+any/ &&
ProcessHistory("EACL $1 $2","ipsort","0.0.0.0","$_") && next;
# order arp lists
- /^arp\s+(\d+\.\d+\.\d+\.\d+)\s+/ &&
+ /^set arp\s+(\d+\.\d+\.\d+\.\d+)\s+/ &&
ProcessHistory("ARP","ipsort","$1","$_") && next;
/^ip prefix-list\s+(\S+)\s+seq\s+(\d+)\s+(permit|deny)\s+(\d\S+)(\/.*)$/ &&
ProcessHistory("PACL $1 $3","ipsort","$4","ip prefix-list $1 $3 $4$5\n")
&& next;
# order logging statements
- /^logging (\d+\.\d+\.\d+\.\d+)/ &&
+ /^set logging server (\d+\.\d+\.\d+\.\d+)/ &&
ProcessHistory("LOGGING","ipsort","$1","$_") && next;
# order name-server statements
- /^ip name-server (\d+\.\d+\.\d+\.\d+)/ &&
+ /^set ip dns server (\d+\.\d+\.\d+\.\d+)/ &&
ProcessHistory("NAMESERVER","ipsort","$1","$_") && next;
- # order snmp-server host statements
- /^snmp-server host (\d+\.\d+\.\d+\.\d+)/ &&
- ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_") && next;
- /^snmp-server community / &&
- ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next;
+ # order/prune snmp-server host statements
+ # we only prune lines of the form
+ # snmp-server host a.b.c.d <community>
+ if (/^set snmp trap (\d+\.\d+\.\d+\.\d+) /) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ ProcessHistory("SNMPSERVERHOST","ipsort","$1","# set snmp trap $1 <removed>\n");
+ } else {
+ ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_");
+ }
+ next;
+ }
+ if (/^(set snmp community) (\S+) (\S+)/) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","#$1 $2 <removed>\n");
+ } else {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_")
+ }
+ next;
+ }
# order tacacs server statements
- /^(tacacs-server key )/ &&
- ProcessHistory("","","","!$1<removed>\n") && next;
- /^tacacs-server host (\d+\.\d+\.\d+\.\d+)/ &&
+ /^set (tacacs) key / &&
+ ProcessHistory("","","","! set $1 key <removed>\n") && next;
+ /^set tacacs server (\d+\.\d+\.\d+\.\d+)/ &&
ProcessHistory("TAC","ipsort","$1","$_") && next;
# order clns host statements
/^clns host \S+ (\S+)/ &&
@@ -873,44 +918,46 @@ sub DoNothing {print STDOUT;}
# Main
%commands=(
'show version' => "ShowVersion",
- 'show install active' => "ShowInstallActive",
- 'show env all' => "ShowEnv",
- 'show gsr chassis' => "ShowGSR",
+# 'show install active' => "ShowInstallActive",
+# 'show env all' => "ShowEnv",
+# 'show gsr chassis' => "ShowGSR",
'show boot' => "ShowBoot",
- 'show bootvar' => "ShowBoot",
+# 'show bootvar' => "ShowBoot",
'show flash' => "ShowFlash",
- 'dir /all bootflash:' => "DirSlotN",
- 'dir /all slot0:' => "DirSlotN",
- 'dir /all disk0:' => "DirSlotN",
- 'dir /all slot1:' => "DirSlotN",
- 'dir /all disk1:' => "DirSlotN",
- 'show controllers' => "ShowContAll",
- 'show controllers cbus' => "ShowContCbus",
- 'show diagbus' => "ShowDiagbus",
- 'show diag' => "ShowDiag",
- 'show c7200' => "ShowC7200",
+ 'dir bootflash:' => "DirSlotN",
+ 'dir slot0:' => "DirSlotN",
+# 'dir /all disk0:' => "DirSlotN",
+ 'dir slot1:' => "DirSlotN",
+# 'dir /all disk1:' => "DirSlotN",
+# 'show controllers' => "ShowContAll",
+# 'show controllers cbus' => "ShowContCbus",
+# 'show diagbus' => "ShowDiagbus",
+# 'show diag' => "ShowDiag",
+ 'show module' => "ShowModule",
+# 'show c7200' => "ShowC7200",
'write term' => "WriteTerm"
);
# keys() doesnt return things in the order entered and the order of the
# cmds is important (show version first and write term last). pita
@commands=(
"show version",
- "show install active",
- "show env all",
- "show gsr chassis",
+# "show install active",
+# "show env all",
+# "show gsr chassis",
"show boot",
- "show bootvar",
+# "show bootvar",
"show flash",
- "dir /all bootflash:",
- "dir /all slot0:",
- "dir /all disk0:",
- "dir /all slot1:",
- "dir /all disk1:",
- "show controllers",
- "show controllers cbus",
- "show diagbus",
- "show diag",
- "show c7200",
+ "dir bootflash:",
+ "dir slot0:",
+# "dir /all disk0:",
+ "dir slot1:",
+# "dir /all disk1:",
+# "show controllers",
+# "show controllers cbus",
+# "show diagbus",
+# "show diag",
+ "show module",
+# "show c7200",
"write term"
);
$cisco_cmds=join(";",@commands);