From a0be206eb419f63eeb436631cc91b3456dff006f Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Sat, 12 Aug 2006 02:59:43 +0000 Subject: Imported from rancid-2.3.2a5.tar.gz. --- bin/Makefile.am | 4 +-- bin/alogin.in | 23 +++++++-------- bin/arancid.in | 4 +-- bin/blogin.in | 12 ++++---- bin/brancid.in | 4 +-- bin/cat5rancid.in | 4 +-- bin/clogin.in | 22 ++++++++++----- bin/control_rancid.in | 4 +-- bin/cssrancid.in | 4 +-- bin/elogin.in | 12 ++++---- bin/f10rancid.in | 78 ++------------------------------------------------- bin/flogin.in | 18 ++++++------ bin/fnrancid.in | 4 +-- bin/francid.in | 22 +++++++++++++-- bin/hlogin.in | 34 +++++++++++++--------- bin/hpuifilter.c | 19 +++++++++---- bin/hrancid.in | 14 ++++++--- bin/htlogin.in | 16 ++++++----- bin/htrancid.in | 4 +-- bin/jerancid.in | 4 +-- bin/jlogin.in | 12 ++++---- bin/jrancid.in | 16 +++++++++-- bin/lg.cgi.in | 4 +-- bin/lgform.cgi.in | 4 +-- bin/mrancid.in | 4 +-- bin/nlogin.in | 50 ++++++++++++++++----------------- bin/nrancid.in | 4 +-- bin/nslogin.in | 8 ++++-- bin/nsrancid.in | 4 +-- bin/par.in | 4 +-- bin/prancid.in | 4 +-- bin/rancid-cvs.in | 4 +-- bin/rancid-fe.in | 56 +++++++++++++++++++----------------- bin/rancid-run.in | 4 +-- bin/rancid.in | 26 +++++++++++------ bin/rivlogin.in | 24 ++-------------- bin/rivrancid.in | 4 +-- bin/rrancid.in | 4 +-- bin/tntlogin.in | 14 +++++---- bin/tntrancid.in | 4 +-- bin/xrancid.in | 4 +-- bin/zrancid.in | 4 +-- 42 files changed, 281 insertions(+), 287 deletions(-) (limited to 'bin') diff --git a/bin/Makefile.am b/bin/Makefile.am index 21fac52..f73561a 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,9 +1,9 @@ ## Process this file with automake to produce Makefile.in ## A Makefile.in is supplied, in case you do not have automake. -## $Id: Makefile.am,v 1.28 2004/01/11 07:15:23 hank Exp $ +## $Id: Makefile.am,v 1.31 2006/08/12 00:46:59 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/alogin.in b/bin/alogin.in index 537c506..ae3ddee 100644 --- a/bin/alogin.in +++ b/bin/alogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: alogin.in,v 1.30 2005/06/14 20:20:43 heas Exp $ +## $Id: alogin.in,v 1.33 2006/08/10 07:00:30 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -417,15 +417,16 @@ proc run_commands { prompt command } { } send "exit\r" expect { - -re "^WARNING: There are unsaved configuration changes." - { - send "y\r" - exp_continue - } - "\n" { exp_continue } - "\[^\n\r *]*Session terminated" { return 0 } - timeout { return 0 } - eof { return 0 } + -re "^WARNING: There are unsaved configuration changes." { + send "y\r" + exp_continue + } + "\n" { exp_continue } + "\[^\n\r *]*Session terminated" { return 0 } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/arancid.in b/bin/arancid.in index 36ff3bd..9b76146 100644 --- a/bin/arancid.in +++ b/bin/arancid.in @@ -1,12 +1,12 @@ #! @PERLV_PATH@ ## -## $Id: arancid.in,v 1.20 2005/09/25 17:48:28 heas Exp $ +## $Id: arancid.in,v 1.21 2006/05/28 16:38:50 heas Exp $ ## ## Hacked version of rancid for Alteon WebOS switches ## tested with: ad3 v8.1.18 ## afort@choqolat.org (andrew fort) ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/blogin.in b/bin/blogin.in index 63dae4c..6233820 100644 --- a/bin/blogin.in +++ b/bin/blogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: blogin.in,v 1.28 2005/06/14 20:20:43 heas Exp $ +## $Id: blogin.in,v 1.31 2006/08/10 07:00:30 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -468,9 +468,11 @@ proc run_commands { prompt command } { } send "logout\r" expect { - "\n" { exp_continue } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/brancid.in b/bin/brancid.in index 59d168b..772e56c 100644 --- a/bin/brancid.in +++ b/bin/brancid.in @@ -1,9 +1,9 @@ #! @PERLV_PATH@ ## -## $Id: brancid.in,v 1.22 2005/09/25 17:48:28 heas Exp $ +## $Id: brancid.in,v 1.23 2006/05/28 16:38:50 heas Exp $ ## hacked version of Hank's rancid - this one tries to deal with Bay's. ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in index ca2ae36..fd56c0a 100644 --- a/bin/cat5rancid.in +++ b/bin/cat5rancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: cat5rancid.in,v 1.45 2005/09/25 17:48:29 heas Exp $ +## $Id: cat5rancid.in,v 1.46 2006/05/28 16:38:50 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/clogin.in b/bin/clogin.in index 1a265a8..5406df3 100644 --- a/bin/clogin.in +++ b/bin/clogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: clogin.in,v 1.94 2006/04/28 15:37:40 heas Exp $ +## $Id: clogin.in,v 1.99 2006/08/10 07:00:30 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -55,6 +55,8 @@ set avautoenable 0 # tracks if we receive them on the command line. set do_passwd 1 set do_enapasswd 1 +# +set send_human {.4 .4 .7 .3 5} # Find the user in the ENV, or use the unix userid. if {[ info exists env(CISCO_USER) ]} { @@ -659,24 +661,30 @@ proc run_commands { prompt command } { log_user 1 if { [ string compare "extreme" "$platform" ] } { - send "exit\r" + send -h "exit\r" } else { - send "quit\r" + send -h "quit\r" } expect { -re "^\[^\n\r *]*$reprompt" { # the Cisco CE and Jnx ERX # return to non-enabled mode # on exit in enabled mode. - send "exit\r" + send -h "exit\r" exp_continue; } + "Would you like to save them now" { # Force10 + send "n\r" + exp_continue + } "Do you wish to save your configuration changes" { send "n\r" exp_continue } -re "\[\n\r]+" { exp_continue } - timeout { return 0 } + timeout { catch {close}; wait + return 0 + } eof { return 0 } } set in_proc 0 @@ -815,7 +823,7 @@ foreach router [lrange $argv $i end] { send "\r" expect { -re "\[\r\n]+" { exp_continue; } - -re "^(.+\[:.])1 $prompt" { # stoopid extreme cmd-line numbers and + -re "^(.+\[:.])1 ($prompt)" { # stoopid extreme cmd-line numbers and # prompt based on state of config changes, # which may have an * at the beginning. set junk $expect_out(1,string) diff --git a/bin/control_rancid.in b/bin/control_rancid.in index cf601c4..b8fde93 100644 --- a/bin/control_rancid.in +++ b/bin/control_rancid.in @@ -1,8 +1,8 @@ #! /bin/sh ## -## $Id: control_rancid.in,v 1.76 2006/05/04 21:31:20 heas Exp $ +## $Id: control_rancid.in,v 1.77 2006/05/28 16:38:50 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/cssrancid.in b/bin/cssrancid.in index 993f615..664953b 100644 --- a/bin/cssrancid.in +++ b/bin/cssrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: cssrancid.in,v 1.11 2005/09/25 17:48:29 heas Exp $ +## $Id: cssrancid.in,v 1.12 2006/05/28 16:38:50 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/elogin.in b/bin/elogin.in index e58f149..a477c94 100644 --- a/bin/elogin.in +++ b/bin/elogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: elogin.in,v 1.33 2005/06/14 20:20:43 heas Exp $ +## $Id: elogin.in,v 1.36 2006/08/10 07:00:30 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -407,9 +407,11 @@ proc run_commands { prompt command } { } send "exit\r" expect { - "\n" { exp_continue } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/f10rancid.in b/bin/f10rancid.in index 6dc62f6..4b63338 100644 --- a/bin/f10rancid.in +++ b/bin/f10rancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: f10rancid.in,v 1.17 2005/09/25 17:48:29 heas Exp $ +## $Id: f10rancid.in,v 1.22 2006/08/12 00:48:48 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -361,41 +361,6 @@ sub ShowEnv { return(0); } -# This routine parses "show gsr chassis-info" for the gsr -# This will create arrays for hw info. -sub ShowGSR { - # Skip if this is not a 1200n. - print STDERR " In ShowGSR: $_" if ($debug); - - while () { - tr/\015//d; - last if (/^$prompt/); - next if (/^(\s*|\s*$cmd\s*)$/); - return(-1) if (/command authorization failed/i); - # return(1) if ($type !~ /^12[40]/); - /^$/ && next; - /^\s+Chassis: type (\S+) Fab Ver: (\S+)/ && - ProcessHistory("COMMENTS","keysort","D0","!\n") && - ProcessHistory("COMMENTS","keysort","D1", - "!GSR Chassis type: $1 Fab Ver: $2\n") && - next; - /^\s+Chassis S\/N: (.*)$/ && - ProcessHistory("COMMENTS","keysort","D2", - "!GSR Chassis S/N: $1\n") && - next; - /^\s+PCA: (\S+)\s*rev: (\S+)\s*dev: \S+\s*HW ver: (\S+)$/ && - ProcessHistory("COMMENTS","keysort","D3", - "!GSR Backplane PCA: $1, rev $2, ver $3\n") && - next; - /^\s+Backplane S\/N: (\S+)$/ && - ProcessHistory("COMMENTS","keysort","D4", - "!GSR Backplane S/N: $1\n") && - next; - } - ProcessHistory("COMMENTS","","","!\n"); - return(0); -} - # This routine parses "show boot" sub ShowBoot { # Pick up boot variables if 7000/7200/7500/12000/2900/3500; @@ -801,41 +766,6 @@ sub ShowModule { return(0); } -# This routine parses "show c7200" for the 7200 -# This will create arrays for hw info. -sub ShowC7200 { - # Skip if this is not a 7200. - print STDERR " In ShowC7200: $_" if ($debug); - - while () { - tr/\015//d; - 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:/) { - $_ = ; - /revision\s+(\S+).*revision\s+(\S+)/; - ProcessHistory("SLOT","","","!Slot Midplane: hvers $1 rev $2\n"); - $_ = ; - /number\s+(\S+)\s+Part number\s+(\S+)/; - ProcessHistory("SLOT","","","!Slot Midplane: part $2, serial $1\n!\n"); - next; - } - if (/C720\d(VXR)? CPU EEPROM:/) { - $_ = ; - /revision\s+(\S+).*revision\s+(\S+)/ && - ProcessHistory("SLOT","","","!Slot CPU: hvers $1 rev $2\n"); - $_ = ; - /number\s+(\S+)\s+Part number\s+(\S+)/ && - ProcessHistory("SLOT","","","!Slot CPU: part $2, serial $1\n!\n"); - next; - } - } - return(0); -} - # This routine parses "show vtp status" sub ShowVTP { print STDERR " In ShowVTP: $_" if ($debug); @@ -891,7 +821,7 @@ sub WriteTerm { # skip the crap if (/^(##+$|(Building|Current) configuration)/i) { while () { - next if (/^Current configuration\s*:/i); + next if (/^!?Current configuration\s*:/i); next if (/^:/); next if (/^([%!].*|\s*)$/); next if (/^ip add.*ipv4:/); # band-aid for 3620 12.0S @@ -1114,7 +1044,6 @@ sub DoNothing {print STDOUT;} {'show version' => 'ShowVersion'}, {'show install active' => 'ShowInstallActive'}, {'show env all' => 'ShowEnv'}, - {'show gsr chassis' => 'ShowGSR'}, {'show boot' => 'ShowBoot'}, {'show bootvar' => 'ShowBoot'}, {'show variables boot' => 'ShowBoot'}, @@ -1132,7 +1061,6 @@ sub DoNothing {print STDOUT;} {'show diagbus' => 'ShowDiagbus'}, {'show diag' => 'ShowDiag'}, {'show module' => 'ShowModule'}, - {'show c7200' => 'ShowC7200'}, {'show vtp status' => 'ShowVTP'}, {'show vlan' => 'ShowVLAN'}, {'show running' => 'WriteTerm'} diff --git a/bin/flogin.in b/bin/flogin.in index 49f057e..24b8400 100644 --- a/bin/flogin.in +++ b/bin/flogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: flogin.in,v 1.39 2005/06/14 20:20:43 heas Exp $ +## $Id: flogin.in,v 1.42 2006/08/10 07:00:30 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -502,12 +502,14 @@ proc run_commands { prompt command } { } send "exit\r" expect { - "\n" { exp_continue } - -re "^\[^ ]+>" { - send "exit\r" - exp_continue } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + -re "^\[^ ]+>" { send "exit\r" + exp_continue + } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/fnrancid.in b/bin/fnrancid.in index 7757139..c4820e3 100644 --- a/bin/fnrancid.in +++ b/bin/fnrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: fnrancid.in,v 1.9 2005/09/25 17:48:29 heas Exp $ +## $Id: fnrancid.in,v 1.10 2006/05/28 16:38:50 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/francid.in b/bin/francid.in index e7d77b7..bda031f 100644 --- a/bin/francid.in +++ b/bin/francid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: francid.in,v 1.35 2005/09/25 17:48:29 heas Exp $ +## $Id: francid.in,v 1.39 2006/07/12 23:43:14 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -186,12 +186,21 @@ sub ShowChassis { next if (/ from /); next if (/current temperature/i); - if (/^---/) { # next section reached + if (/^---/ || /^$/) { # next section reached $skip = 0; } if (/(POWERS|TEMPERATURE READINGS)/) { $skip = 1; } + if (/fan controlled temperature:/i) { + $skip = 1; + } + if (/THERMAL PLANE/) { + $skip = 1; + } + if (/temperature:/i) { + $skip = 1; + } next if $skip; ProcessHistory("CHASSIS","","","! $_"); @@ -246,6 +255,13 @@ sub WriteTerm { /^ width / && next; # kill width on serial lines # filter out any RCS/CVS tags to avoid confusing local CVS storage s/\$(Revision|Id):/ $1:/; + # sort secure-mac-addresses. Note: There is no way to determine which + # have been added dynamically vs statically. Thus, sort them? + /secure-mac-address (\S+)/ && + ProcessHistory("SECMAC","keysort","$1","$_") && next; + # OR filter them? XXX + #next if (/secure-mac-address/); + # order access-lists /^access-list\s+(\d+)\s+(perm|deny)\s+(\d\S+)(\/\d+)\s*$/ && ProcessHistory("PACL $1 $2","ipsort","$3","$_") diff --git a/bin/hlogin.in b/bin/hlogin.in index f50891a..ebfdf1f 100644 --- a/bin/hlogin.in +++ b/bin/hlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: hlogin.in,v 1.31 2006/02/07 19:06:55 heas Exp $ +## $Id: hlogin.in,v 1.35 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -57,6 +57,8 @@ set do_passwd 1 set do_enapasswd 1 # attempt at platform switching. set platform "" +# +set send_human {.4 .4 .7 .3 5} # Find the user in the ENV, or use the unix userid. if {[ info exists env(CISCO_USER) ]} { @@ -469,16 +471,14 @@ proc run_commands { prompt command } { global in_proc platform set in_proc 1 - # If the prompt is (enable), then we are on a switch and the - # command is "set length 0"; otherwise its "term length 0". - # skip if its and extreme. + # Turn off the pager and escape regex meta characters in the $prompt send "no page\r" regsub -all "\[)(]" $prompt {\\&} reprompt - expect { - -re $reprompt {} - -re "\[\n\r]+" { exp_continue } - } - # this is the only way i see to get rid for more prompts in o/p..grrrrr + expect { + -re $reprompt {} + -re "\[\n\r]+" { exp_continue } + } + # this is the only way i see to get rid of more prompts in o/p..grrrrr log_user 0 # Is this a multi-command? if [ string match "*\;*" "$command" ] { @@ -506,6 +506,10 @@ proc run_commands { prompt command } { } -re "^<-+ More -+>\[^\n\r]*" { send " " exp_continue } + -re "^-+ MORE -+\[^\n\r]*" { send " " + exp_continue } + -re "^-+More-+\[^\n\r]*" { send " " + exp_continue } -re "\b+" { exp_continue } } } @@ -531,11 +535,13 @@ proc run_commands { prompt command } { exp_continue } -re "^-+ MORE -+\[^\n\r]*" { send " " exp_continue } + -re "^-+More-+\[^\n\r]*" { send " " + exp_continue } -re "\b+" { exp_continue } } } log_user 1 - send "exit\r" + send -h "exit\r" expect { "Do you want to save current configuration" { send "n\r" @@ -551,10 +557,12 @@ proc run_commands { prompt command } { } -re "\[\r\n]+" { exp_continue } -re "^.+>" { - send "exit\r" + send -h "exit\r" exp_continue } - timeout { return 0 } + timeout { catch {close}; wait + return 0 + } eof { return 0 } } set in_proc 0 diff --git a/bin/hpuifilter.c b/bin/hpuifilter.c index a13c223..00a8833 100644 --- a/bin/hpuifilter.c +++ b/bin/hpuifilter.c @@ -1,7 +1,7 @@ /* - * $Id: hpuifilter.c,v 1.30 2005/09/29 16:58:16 heas Exp $ + * $Id: hpuifilter.c,v 1.33 2006/05/28 16:38:51 heas Exp $ * - * Copyright (C) 1997-2004 by Terrapin Communications, Inc. + * Copyright (C) 1997-2006 by Terrapin Communications, Inc. * All rights reserved. * * This software may be freely copied, modified and redistributed @@ -228,6 +228,17 @@ main(int argc, char **argv, char **ev) } if (child == 0) { + struct winsize ws; + + /* + * Make sure our terminal length and width are something greater + * than 1, for pagers on stupid boxes. + */ + ioctl(ptys, TIOCGWINSZ, &ws); + ws.ws_row = 24; + ws.ws_col = 132; + ioctl(ptys, TIOCSWINSZ, &ws); + signal(SIGCHLD, SIG_DFL); /* close the master pty & std* inherited from the parent */ close(ptym); @@ -454,9 +465,7 @@ main(int argc, char **argv, char **ev) } int -filter(buf, len) - char *buf; - int len; +filter(char *buf, int len) { static regmatch_t pmatch[1]; #define N_REG 13 /* number of regexes in reg[][] */ diff --git a/bin/hrancid.in b/bin/hrancid.in index 5e54bdc..f26182d 100644 --- a/bin/hrancid.in +++ b/bin/hrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: hrancid.in,v 1.23 2005/09/25 17:48:29 heas Exp $ +## $Id: hrancid.in,v 1.25 2006/07/10 21:35:39 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -189,8 +189,14 @@ sub ShowSystem { return(-1) if (/command authorization failed/i); return(-1) if /^(Invalid|Ambiguous) input:/i; - /memory\s+-\s+total\s+:\s+(\S+)/i && - ProcessHistory("COMMENTS","keysort","B0",";Memory: $1\n"); + if (/memory\s+-\s+total\s+:\s+(\S+)/i) { + my($mem) = $1; + $mem =~ s/,//g; + $mem /= (1024 * 1024); + ProcessHistory("COMMENTS","keysort","B0",";Memory: " . int($mem) . + "M\n"); + next; + } /serial\s+number\s+:\s+(\S+)/i && ProcessHistory("COMMENTS","keysort","A1",";Serial Number: $1\n"); /firmware\s+revision\s+:\s+(\S+)/i && diff --git a/bin/htlogin.in b/bin/htlogin.in index c95733b..03c3762 100644 --- a/bin/htlogin.in +++ b/bin/htlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: htlogin.in,v 1.13 2005/06/14 20:20:43 heas Exp $ +## $Id: htlogin.in,v 1.16 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -389,7 +389,7 @@ proc run_commands { prompt command } { for {set i 0} {$i < $num_commands} { incr i} { send "[lindex $commands $i]\r" expect { - -re "^\[^\n\r]*$prompt" {} + -re "^\[^\n\r]*$prompt" {} -re "^\[^\n\r *]*$prompt" {} -re "\[\n\r]" { exp_continue } } @@ -397,16 +397,18 @@ proc run_commands { prompt command } { } else { send "$command\r" expect { - -re "^\[^\n\r]*$prompt" {} + -re "^\[^\n\r]*$prompt" {} -re "^\[^\n\r *]*$prompt" {} -re "\[\n\r]" { exp_continue } } } send "exit\r" expect { - "\n" { exp_continue } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/htrancid.in b/bin/htrancid.in index e1082c9..c40f812 100644 --- a/bin/htrancid.in +++ b/bin/htrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: htrancid.in,v 1.11 2005/09/25 17:48:30 heas Exp $ +## $Id: htrancid.in,v 1.12 2006/05/28 16:38:51 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/jerancid.in b/bin/jerancid.in index 656da3c..d4a9bd7 100644 --- a/bin/jerancid.in +++ b/bin/jerancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: jerancid.in,v 1.34 2005/09/25 17:48:30 heas Exp $ +## $Id: jerancid.in,v 1.35 2006/05/28 16:38:51 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/jlogin.in b/bin/jlogin.in index e6c4a01..b353a0e 100644 --- a/bin/jlogin.in +++ b/bin/jlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: jlogin.in,v 1.51 2005/06/14 20:20:43 heas Exp $ +## $Id: jlogin.in,v 1.54 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -427,9 +427,11 @@ proc run_commands { prompt command } { } send "quit\r" expect { - "\n" { exp_continue } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/jrancid.in b/bin/jrancid.in index ab35fad..6fd53fc 100644 --- a/bin/jrancid.in +++ b/bin/jrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: jrancid.in,v 1.70 2005/09/28 22:07:57 heas Exp $ +## $Id: jrancid.in,v 1.72 2006/07/28 16:57:57 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -164,7 +164,17 @@ sub ShowChassisClocks { /syntax error/ && return; # filter decimal places of m160 measured clock MHz - /Measured frequency/ && s/\..*MHz/ MHz/; + if (/Measured frequency/) { + s/\..*MHz/ MHz/; + } elsif (/^.+\.[0-9]+ MHz$/) { + # filter for the m160 (newer format) + s/\.[0-9]+ MHz/ MHz/; + } elsif (/^(.+)(\.[0-9]+) MHz/) { + # filter for T series + my($leadlen) = length($1); + $x = sprintf(" MHz%".length($2)."s", " "); + substr($_, $leadlen, length($2)+4, $x); + } ProcessHistory("","","","# $_"); } return; diff --git a/bin/lg.cgi.in b/bin/lg.cgi.in index 93e9797..2a6957f 100644 --- a/bin/lg.cgi.in +++ b/bin/lg.cgi.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: lg.cgi.in,v 1.52 2005/12/07 19:19:46 heas Exp $ +## $Id: lg.cgi.in,v 1.53 2006/05/28 16:38:51 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/lgform.cgi.in b/bin/lgform.cgi.in index 5270e3a..88b2a33 100644 --- a/bin/lgform.cgi.in +++ b/bin/lgform.cgi.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: lgform.cgi.in,v 1.29 2004/09/03 18:41:25 heas Exp $ +## $Id: lgform.cgi.in,v 1.30 2006/05/28 16:38:51 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/mrancid.in b/bin/mrancid.in index 7186717..a97e4d9 100644 --- a/bin/mrancid.in +++ b/bin/mrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: mrancid.in,v 1.16 2005/09/25 17:48:30 heas Exp $ +## $Id: mrancid.in,v 1.17 2006/05/28 16:38:51 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/nlogin.in b/bin/nlogin.in index b5058bc..4b04a15 100644 --- a/bin/nlogin.in +++ b/bin/nlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: nlogin.in,v 1.27 2006/01/26 22:14:28 heas Exp $ +## $Id: nlogin.in,v 1.30 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -393,38 +393,38 @@ proc run_commands { prompt command } { for {set i 0} {$i < $num_commands} { incr i} { send "[subst [lindex $commands $i]]\r" expect { - -re "\[\n\r]+" { exp_continue } - -re "$prompt" {} - -gl "--- more ---" { - send " " - exp_continue - } + -re "\[\n\r]+" { exp_continue } + -re "$prompt" {} + -gl "--- more ---" { send " " + exp_continue + } } } } else { send "[subst $command]\r" expect { - -re "\[\n\r]+" { exp_continue } - -re "$prompt" {} - -gl "--- more ---" { - send " " - exp_continue - } + -re "\[\n\r]+" { exp_continue } + -re "$prompt" {} + -gl "--- more ---" { send " " + exp_continue + } } } send "exit\r" expect { - -re "$prompt" { - send "exit\r" - exp_continue - } - -re "\[\n\r]+" { exp_continue } - -gl "Configuration modified, save?" { - send "n\r" - exp_continue - } - timeout { return 0 } - eof { return 0 } + -re "$prompt" { + send "exit\r" + exp_continue + } + -re "\[\n\r]+" { exp_continue } + -gl "Configuration modified, save?" { + send "n\r" + exp_continue + } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/nrancid.in b/bin/nrancid.in index 04f38b0..8ac4c34 100644 --- a/bin/nrancid.in +++ b/bin/nrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: nrancid.in,v 1.25 2005/10/12 01:35:31 heas Exp $ +## $Id: nrancid.in,v 1.26 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/nslogin.in b/bin/nslogin.in index b48004d..2de297d 100644 --- a/bin/nslogin.in +++ b/bin/nslogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: nslogin.in,v 1.17 2005/06/14 22:23:44 heas Exp $ +## $Id: nslogin.in,v 1.19 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -500,7 +500,9 @@ proc run_commands { prompt command } { exp_continue } "\n" { exp_continue } - timeout { return 0 } + timeout { catch {close}; wait + return 0 + } eof { return 0 } } set in_proc 0 diff --git a/bin/nsrancid.in b/bin/nsrancid.in index 61aa9e5..f8b505e 100644 --- a/bin/nsrancid.in +++ b/bin/nsrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: nsrancid.in,v 1.12 2005/09/25 17:48:30 heas Exp $ +## $Id: nsrancid.in,v 1.13 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/par.in b/bin/par.in index ae94eae..3b704d8 100644 --- a/bin/par.in +++ b/bin/par.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: par.in,v 1.11 2005/06/14 20:20:44 heas Exp $ +## $Id: par.in,v 1.12 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/prancid.in b/bin/prancid.in index 47eda29..acee537 100755 --- a/bin/prancid.in +++ b/bin/prancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: prancid.in,v 1.33 2005/09/25 17:48:30 heas Exp $ +## $Id: prancid.in,v 1.34 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/rancid-cvs.in b/bin/rancid-cvs.in index a683f49..fef54b4 100644 --- a/bin/rancid-cvs.in +++ b/bin/rancid-cvs.in @@ -1,8 +1,8 @@ #! /bin/sh ## -## $Id: rancid-cvs.in,v 1.17 2005/08/15 00:42:50 heas Exp $ +## $Id: rancid-cvs.in,v 1.18 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/rancid-fe.in b/bin/rancid-fe.in index 3976253..604040d 100644 --- a/bin/rancid-fe.in +++ b/bin/rancid-fe.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rancid-fe.in,v 1.37 2005/06/14 20:20:44 heas Exp $ +## $Id: rancid-fe.in,v 1.42 2006/08/12 00:44:53 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -27,32 +27,38 @@ require 5; ($router, $vendor) = split('\:', $ARGV[0]); +$vendor =~ tr/[A-Z]/[a-z]/; - if ($vendor =~ /^alteon$/i) { exec('arancid', $router); } -elsif ($vendor =~ /^baynet$/i) { exec('brancid', $router); } -elsif ($vendor =~ /^cat5$/i) { exec('cat5rancid', $router); } -elsif ($vendor =~ /^cisco$/i) { exec('rancid', $router); } -elsif ($vendor =~ /^css$/i) { exec('cssrancid', $router); } -elsif ($vendor =~ /^enterasys$/i) { exec('rivrancid', $router); } -elsif ($vendor =~ /^erx$/i) { exec('jerancid', $router); } -elsif ($vendor =~ /^extreme$/i) { exec('xrancid', $router); } -elsif ($vendor =~ /^ezt3$/i) { exec('erancid', $router); } -elsif ($vendor =~ /^force10$/i) { exec('f10rancid', $router); } -elsif ($vendor =~ /^foundry$/i) { exec('francid', $router); } -elsif ($vendor =~ /^hitachi$/i) { exec('htrancid', $router); } -elsif ($vendor =~ /^hp$/i) { exec('hrancid', $router); } -elsif ($vendor =~ /^juniper$/i) { exec('jrancid', $router); } -elsif ($vendor =~ /^mrtd$/i) { exec('mrancid', $router); } -elsif ($vendor =~ /^netscaler$/i) { exec('nsrancid', $router); } -elsif ($vendor =~ /^netscreen$/i) { exec('nrancid', $router); } -elsif ($vendor =~ /^procket$/i) { exec('prancid', $router); } -elsif ($vendor =~ /^redback$/i) { exec('rrancid', $router); } -elsif ($vendor =~ /^riverstone$/i) { exec('rivrancid', $router); } -elsif ($vendor =~ /^tnt$/i) { exec('tntrancid', $router); } -elsif ($vendor =~ /^zebra$/i) { exec('zrancid', $router); } -else { +%vendortable = ( + 'alteon' => 'arancid', + 'baynet' => 'brancid', + 'cat5' => 'cat5rancid', + 'cisco' => 'rancid', + 'css' => 'cssrancid', + 'enterasys' => 'rivrancid', + 'erx' => 'jerancid', + 'extreme' => 'xrancid', + 'ezt3' => 'erancid', + 'force10' => 'f10rancid', + 'foundry' => 'francid', + 'hitachi' => 'htrancid', + 'hp' => 'hrancid', + 'juniper' => 'jrancid', + 'mrtd' => 'mrancid', + 'netscaler' => 'nsrancid', + 'netscreen' => 'nrancid', + 'procket' => 'prancid', + 'redback' => 'rrancid', + 'riverstone' => 'rivrancid', + 'tnt' => 'tntrancid', + 'zebra' => 'zrancid' +); + +if ($vendortable{$vendor} eq "") { printf(STDERR "unknown router manufacturer for $router: $vendor\n"); exit(-1); +} else { + exec($vendortable{$vendor} . " $router"); } printf(STDERR "exec failed router manufacturer $vendor: $!\n"); diff --git a/bin/rancid-run.in b/bin/rancid-run.in index 9197117..5de4edc 100644 --- a/bin/rancid-run.in +++ b/bin/rancid-run.in @@ -1,8 +1,8 @@ #! /bin/sh ## -## $Id: rancid-run.in,v 1.32 2005/06/14 20:20:44 heas Exp $ +## $Id: rancid-run.in,v 1.33 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/rancid.in b/bin/rancid.in index 4afe73a..a69768e 100644 --- a/bin/rancid.in +++ b/bin/rancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rancid.in,v 1.203 2006/04/06 21:14:05 heas Exp $ +## $Id: rancid.in,v 1.209 2006/08/12 02:34:22 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -197,12 +197,13 @@ sub ShowVersion { /^Encryption hardware device\s+:\s+(.*)/ && ProcessHistory("COMMENTS","keysort","A3", "!Encryption: $1\n") && next; - /^Flash\s+\S+ \@ 0x\S+,\s+(\S+)/ && - ProcessHistory("COMMENTS","keysort","B2", "!Memory: Flash $1\n") && - next; /^running activation key\s*:\s+(.*)/i && ProcessHistory("COMMENTS","keysort","D2", "!Key: $1\n") && next; + # Flash on the PIX or FWSM (FireWall Switch Module) + /^Flash(\s+\S+)+ \@ 0x\S+,\s+(\S+)/ && + ProcessHistory("COMMENTS","keysort","B2", "!Memory: Flash $2\n") && + next; # CatOS 3500xl stuff /^System serial number(:\s+.*)$/ && ProcessHistory("COMMENTS","keysort","C1", "!Serial Number$1\n") && @@ -233,7 +234,7 @@ sub ShowVersion { next; /^System image file is "([^\"]*)"$/ && ProcessHistory("COMMENTS","keysort","F5","!Image: $1\n") && next; - if (/(\S+)\s+\((\S+)\)\s+processor.*with (\S+[kK]) bytes/) { + if (/(\S+)\s+(?:\((\S+)\)\s+processor\s+)?\(revision[^)]+\).*with (\S+[kK]) bytes/) { my($proc) = $1; my($cpu) = $2; my($mem) = $3; @@ -278,6 +279,8 @@ sub ShowVersion { $type = "3600"; } elsif ( $proc =~ /^37/) { $type = "3700"; + } elsif ( $proc =~ /^38/) { + $type = "3800"; } elsif ( $proc eq "RSP7000") { $type = "7500"; } elsif ( $proc =~ /RSP\d/) { @@ -321,7 +324,10 @@ sub ShowVersion { "!Chassis type:$slave $proc - a $type $device\n"); ProcessHistory("COMMENTS","keysort","B1", "!Memory:$slave main $mem\n"); - ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu$_$slaveslot\n"); + if (defined($cpu)) { + ProcessHistory("COMMENTS","keysort","A3", + "!CPU:$slave $cpu$_$slaveslot\n"); + } next; } if (/(\S+) Silicon\s*Switch Processor/) { @@ -1365,6 +1371,7 @@ sub ShowVLAN { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /Line has invalid autocommand /; return(1) if /(Invalid input detected|Type help or )/; + return(1) if /Ambiguous command/i; # newer releases (~12.1(9)) place the vlan config in the normal # configuration (write term). return(1) if ($type =~ /^(3550|4500|7600)$/); @@ -1641,9 +1648,9 @@ sub WriteTerm { } } # prune tacacs/radius server keys - if (/^((tacacs-server|radius-server)\s(\w*[-\s(\s\S+])*\s?key) \d \w+/ + if (/^((tacacs-server|radius-server)\s(\w*[-\s(\s\S+])*\s?key) \w+/ && $filter_pwds >= 1) { - ProcessHistory("","","","!$1 $'\n"); next; + ProcessHistory("","","","!$1 $'"); next; } # order clns host statements /^clns host \S+ (\S+)/ && @@ -1761,6 +1768,7 @@ sub DoNothing {print STDOUT;} {'show inventory raw' => 'ShowInventory'}, {'show vtp status' => 'ShowVTP'}, {'show vlan' => 'ShowVLAN'}, + {'show vlan-switch' => 'ShowVLAN'}, {'show debug' => 'ShowDebug'}, {'show running-config' => 'WriteTerm'}, {'write term' => 'WriteTerm'}, diff --git a/bin/rivlogin.in b/bin/rivlogin.in index e0de6b2..e7df3eb 100644 --- a/bin/rivlogin.in +++ b/bin/rivlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: rivlogin.in,v 1.19 2005/06/14 20:20:44 heas Exp $ +## $Id: rivlogin.in,v 1.21 2006/07/17 20:39:42 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -79,7 +79,6 @@ router \[router...\]\n" # # Sets Xterm title if interactive...if its an xterm and the user cares # - proc label { host } { global env @@ -97,14 +96,12 @@ proc label { host } { } } - # This is a helper function to make the password file easier to # maintain. # NOTES: Using this the password file has the form: # add password sl* pete cow # add password at* steve # add password * hanky-pie - proc add { var args } { global $var @@ -116,7 +113,6 @@ proc add { var args } { # could install more than just password info... I will assume however, # that a "bad guy" could just as easy put such code in the clogin # script, so I will leave .cloginrc as just an extention of that script - proc source_password_file { } { global env password_file read_password_file @@ -142,7 +138,6 @@ proc source_password_file { } { # pre: var is x, router is y # post: return routerr entry from database else null string - proc find { var router } { if {[ source_password_file ] == 0 } { @@ -160,10 +155,8 @@ proc find { var router } { return {} } - # pre: login completed ok # post: terminate login session by closing tcp connection - proc auto_exit { } { global telnet_id @@ -180,7 +173,6 @@ proc auto_exit { } { # # NOTE: a number of globals are setup: my_prompt, telnet_id are key # and paging of cli output is disabled - proc login { router user userpswd passwd enapasswd } { global login_array @@ -298,7 +290,6 @@ proc login { router user userpswd passwd enapasswd } { # pre: login completed ok # post: turn off paging of commands - proc disable_cli_paging { } { global my_prompt @@ -313,7 +304,6 @@ proc disable_cli_paging { } { # pre: login returned 0, prompt at top level # post: turn off command completion return 0 # on error, return 1 - proc disable_cmd_autocomplete { } { global my_prompt @@ -334,7 +324,6 @@ proc disable_cmd_autocomplete { } { # pre: login returned 0, do_enable returned 0, cli is in enable or config mode # post: issues logout cli to device, returns 0 - proc logout { prompt } { global config_mode enable_prompt @@ -370,7 +359,6 @@ proc logout { prompt } { # pre: current mode allows transition to enable mode # post: enable mode entered, my_prompt updated, return 0 else 1 - proc do_enable { enauser enapasswd userpswd } { global expect_out verbose global my_prompt enable_prompt @@ -422,7 +410,6 @@ proc do_enable { enauser enapasswd userpswd } { # pre: current mode allows transition to enable mode # post: enable mode entered, my_prompt updated, return 0 else 1 - proc do_configure { } { global expect_out verbose config_mode global my_prompt @@ -451,7 +438,6 @@ proc do_configure { } { # track sent/received from device to output_file # pre: outut_file is valid filename w/write access # post: logfile open, global var logging == 1, return 0 , else 1 - proc start_logfile { output_file } { global logging @@ -487,13 +473,11 @@ proc run_commands { prompt cmdstring } { return 0 } - # Run commands given on the command line # pre: prompt is current system cli prompt, cmdstring is command to execute # post: return 0 on success else 1 # NOTE: output from router ends up in output_file if specified # expect internal input buffer is reset to "" after each command - proc run_single_command { prompt cmdstring } { global verbose set rc 0 @@ -615,7 +599,6 @@ proc run_single_command { prompt cmdstring } { # pre: RSTONE_USER env var is set # post: update global "default_user" to this string - proc init_userid { } { global default_user @@ -644,7 +627,6 @@ proc source_script_file { filename } { # return 0 on success, return 1 on error # NOTE: for scripts that begin with "configure", change the mode to configure # before executing the following commands - proc process_script_file { filename } { global my_prompt verbose @@ -706,7 +688,6 @@ proc process_script_file { filename } { # post: remove extended ascii sequences and other cruft # and prepend a header: rscmd: ip-addr : date # TODO: should watch all file commands more closely - proc strip_log { filename router } { global tempfile @@ -871,7 +852,6 @@ if { $idx == $argc } { } # main loop - foreach router [lrange $argv $idx end] { set router [string tolower $router] diff --git a/bin/rivrancid.in b/bin/rivrancid.in index e069b3b..3a6d9f2 100644 --- a/bin/rivrancid.in +++ b/bin/rivrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rivrancid.in,v 1.15 2005/09/25 17:48:30 heas Exp $ +## $Id: rivrancid.in,v 1.16 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/rrancid.in b/bin/rrancid.in index 1bc688f..5549775 100644 --- a/bin/rrancid.in +++ b/bin/rrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rrancid.in,v 1.24 2005/09/25 17:48:31 heas Exp $ +## $Id: rrancid.in,v 1.25 2006/05/28 16:38:52 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/tntlogin.in b/bin/tntlogin.in index 027be07..164fd94 100644 --- a/bin/tntlogin.in +++ b/bin/tntlogin.in @@ -1,8 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: tntlogin.in,v 1.17 2005/06/14 20:20:44 heas Exp $ +## $Id: tntlogin.in,v 1.20 2006/08/10 07:00:31 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -419,10 +419,12 @@ proc run_commands { prompt command } { # send "y\r" exp_continue } - "\n" { exp_continue } - "\[^\n\r *]*Session terminated" { return 0 } - timeout { return 0 } - eof { return 0 } + "\n" { exp_continue } + "\[^\n\r *]*Session terminated" { return 0 } + timeout { catch {close}; wait + return 0 + } + eof { return 0 } } set in_proc 0 } diff --git a/bin/tntrancid.in b/bin/tntrancid.in index 94a3120..2a830d1 100644 --- a/bin/tntrancid.in +++ b/bin/tntrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: tntrancid.in,v 1.15 2005/09/25 17:48:31 heas Exp $ +## $Id: tntrancid.in,v 1.16 2006/05/28 16:38:53 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/xrancid.in b/bin/xrancid.in index 80e7e5b..12fad57 100644 --- a/bin/xrancid.in +++ b/bin/xrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: xrancid.in,v 1.39 2006/03/23 18:43:01 heas Exp $ +## $Id: xrancid.in,v 1.40 2006/05/28 16:38:53 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed diff --git a/bin/zrancid.in b/bin/zrancid.in index f98c762..8607425 100755 --- a/bin/zrancid.in +++ b/bin/zrancid.in @@ -1,8 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: zrancid.in,v 1.12 2005/09/25 17:48:31 heas Exp $ +## $Id: zrancid.in,v 1.13 2006/05/28 16:38:53 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed -- cgit