From 1a7c45398738cdb4eaafdc9e0962272f19d54816 Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Tue, 5 Dec 2006 16:52:12 +0000 Subject: Imported from rancid-2.3.2a6.tar.gz. --- bin/Makefile.am | 10 +- bin/Makefile.in | 147 ++++++++------- bin/agmrancid.in | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++ bin/alogin.in | 13 +- bin/arancid.in | 11 +- bin/blogin.in | 13 +- bin/brancid.in | 11 +- bin/cat5rancid.in | 11 +- bin/clogin.in | 32 +++- bin/control_rancid.in | 22 ++- bin/cssrancid.in | 11 +- bin/elogin.in | 13 +- bin/erancid.in | 13 +- bin/f10rancid.in | 11 +- bin/flogin.in | 13 +- bin/fnrancid.in | 11 +- bin/francid.in | 30 ++-- bin/hlogin.in | 13 +- bin/hpuifilter.c | 21 ++- bin/hrancid.in | 13 +- bin/htlogin.in | 13 +- bin/htrancid.in | 11 +- bin/jerancid.in | 11 +- bin/jlogin.in | 10 +- bin/jrancid.in | 124 ++++++++----- bin/lg.cgi.in | 3 +- bin/lgform.cgi.in | 3 +- bin/mrancid.in | 12 +- bin/nlogin.in | 6 +- bin/nrancid.in | 12 +- bin/nslogin.in | 6 +- bin/nsrancid.in | 11 +- bin/par.in | 9 +- bin/prancid.in | 11 +- bin/rancid-cvs.in | 29 ++- bin/rancid-fe.in | 4 +- bin/rancid-run.in | 38 ++-- bin/rancid.in | 70 +++++--- bin/rivlogin.in | 69 ++++--- bin/rivrancid.in | 11 +- bin/rrancid.in | 11 +- bin/tntlogin.in | 13 +- bin/tntrancid.in | 11 +- bin/xrancid.in | 11 +- bin/zrancid.in | 11 +- 45 files changed, 1121 insertions(+), 308 deletions(-) create mode 100644 bin/agmrancid.in (limited to 'bin') diff --git a/bin/Makefile.am b/bin/Makefile.am index f73561a..8490805 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,7 +1,7 @@ ## 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.31 2006/08/12 00:46:59 heas Exp $ +## $Id: Makefile.am,v 1.35 2006/11/23 20:26:47 heas Exp $ ## ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. @@ -25,10 +25,10 @@ AUTOMAKE_OPTIONS=foreign bin_PROGRAMS = hpuifilter bin_SCRIPTS = cat5rancid control_rancid \ - alogin arancid clogin blogin brancid cssrancid \ + agmrancid alogin arancid blogin brancid clogin cssrancid \ elogin erancid f10rancid flogin francid fnrancid \ - jlogin jrancid jerancid \ hlogin hrancid htlogin htrancid \ + jerancid jlogin jrancid \ mrancid nlogin nrancid nslogin nsrancid par prancid \ rancid rancid-fe rivlogin rivrancid rrancid \ tntlogin tntrancid xrancid zrancid @@ -73,7 +73,9 @@ auto_edit = sed \ -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \ -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \ -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \ - -e 's,@MAILPLUS\@,$(MAILPLUS),g' + -e 's,@MAILPLUS\@,$(MAILPLUS),g' \ + -e 's,@PACKAGE\@,$(PACKAGE),g' \ + -e 's,@VERSION\@,$(VERSION),g' lg.cgi: Makefile $(srcdir)/lg.cgi.in rm -f lg.cgi lg.cgi.tmp; \ diff --git a/bin/Makefile.in b/bin/Makefile.in index bdee0d6..ba3d44e 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,15 +15,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -38,13 +34,14 @@ POST_UNINSTALL = : bin_PROGRAMS = hpuifilter$(EXEEXT) subdir = bin DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/alogin.in $(srcdir)/arancid.in $(srcdir)/blogin.in \ - $(srcdir)/brancid.in $(srcdir)/cat5rancid.in \ - $(srcdir)/clogin.in $(srcdir)/control_rancid.in \ - $(srcdir)/cssrancid.in $(srcdir)/elogin.in \ - $(srcdir)/erancid.in $(srcdir)/f10rancid.in \ - $(srcdir)/flogin.in $(srcdir)/fnrancid.in $(srcdir)/francid.in \ - $(srcdir)/hlogin.in $(srcdir)/hrancid.in $(srcdir)/htlogin.in \ + $(srcdir)/agmrancid.in $(srcdir)/alogin.in \ + $(srcdir)/arancid.in $(srcdir)/blogin.in $(srcdir)/brancid.in \ + $(srcdir)/cat5rancid.in $(srcdir)/clogin.in \ + $(srcdir)/control_rancid.in $(srcdir)/cssrancid.in \ + $(srcdir)/elogin.in $(srcdir)/erancid.in \ + $(srcdir)/f10rancid.in $(srcdir)/flogin.in \ + $(srcdir)/fnrancid.in $(srcdir)/francid.in $(srcdir)/hlogin.in \ + $(srcdir)/hrancid.in $(srcdir)/htlogin.in \ $(srcdir)/htrancid.in $(srcdir)/jerancid.in \ $(srcdir)/jlogin.in $(srcdir)/jrancid.in $(srcdir)/mrancid.in \ $(srcdir)/nlogin.in $(srcdir)/nrancid.in $(srcdir)/nslogin.in \ @@ -61,12 +58,12 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = control_rancid par rancid-fe alogin arancid \ - blogin brancid cat5rancid clogin rancid cssrancid elogin \ - erancid f10rancid flogin francid fnrancid jlogin jrancid \ - jerancid hlogin hrancid htlogin htrancid mrancid nlogin \ - nrancid nslogin nsrancid prancid rivlogin rivrancid rrancid \ - tntlogin tntrancid xrancid zrancid +CONFIG_CLEAN_FILES = control_rancid par rancid-fe agmrancid alogin \ + arancid blogin brancid cat5rancid clogin rancid cssrancid \ + elogin erancid f10rancid flogin francid fnrancid jlogin \ + jrancid jerancid hlogin hrancid htlogin htrancid mrancid \ + nlogin nrancid nslogin nsrancid prancid rivlogin rivrancid \ + rrancid tntlogin tntrancid xrancid zrancid am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) @@ -75,7 +72,7 @@ hpuifilter_OBJECTS = $(am_hpuifilter_OBJECTS) hpuifilter_LDADD = $(LDADD) binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +DEFAULT_INCLUDES = -I. -I$(top_builddir)/include@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -89,8 +86,6 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMINMAILPLUS = @ADMINMAILPLUS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -106,8 +101,6 @@ CCDEPMODE = @CCDEPMODE@ #CFLAGS += -g CFLAGS = -g -O0 COMM = @COMM@ -CONF_INSTALL_FALSE = @CONF_INSTALL_FALSE@ -CONF_INSTALL_TRUE = @CONF_INSTALL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CVS = @CVS@ @@ -127,6 +120,7 @@ EXPECT_PATH = @EXPECT_PATH@ FIND = @FIND@ GREP = @GREP@ ID = @ID@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -140,8 +134,7 @@ MAILPLUS = @MAILPLUS@ MAKE = @MAKE@ MAKEINFO = @MAKEINFO@ MKDIR = @MKDIR@ -MK_LCLSTATEDIR_FALSE = @MK_LCLSTATEDIR_FALSE@ -MK_LCLSTATEDIR_TRUE = @MK_LCLSTATEDIR_TRUE@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -167,10 +160,11 @@ TELNET = @TELNET@ TOUCH = @TOUCH@ U = @U@ VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -178,33 +172,45 @@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ #AUTOMAKE_OPTIONS=foreign no-dependencies AUTOMAKE_OPTIONS = foreign -bin_SCRIPTS = cat5rancid control_rancid alogin arancid clogin blogin \ - brancid cssrancid elogin erancid f10rancid flogin francid \ - fnrancid jlogin jrancid jerancid hlogin hrancid htlogin \ - htrancid mrancid nlogin nrancid nslogin nsrancid par prancid \ - rancid rancid-fe rivlogin rivrancid rrancid tntlogin tntrancid \ - xrancid zrancid lg.cgi lgform.cgi rancid-cvs rancid-run +bin_SCRIPTS = cat5rancid control_rancid agmrancid alogin arancid \ + blogin brancid clogin cssrancid elogin erancid f10rancid \ + flogin francid fnrancid hlogin hrancid htlogin htrancid \ + jerancid jlogin jrancid mrancid nlogin nrancid nslogin \ + nsrancid par prancid rancid rancid-fe rivlogin rivrancid \ + rrancid tntlogin tntrancid xrancid zrancid lg.cgi lgform.cgi \ + rancid-cvs rancid-run EXTRA_DIST = lg.cgi.in lgform.cgi.in rancid-cvs.in rancid-run.in #dist_bin_SCRIPTS= $(bin_SCRIPTS:%=%.in) CLEANFILES = lg.cgi lgform.cgi rancid-cvs rancid-run @@ -234,7 +240,9 @@ auto_edit = sed \ -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \ -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \ -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \ - -e 's,@MAILPLUS\@,$(MAILPLUS),g' + -e 's,@MAILPLUS\@,$(MAILPLUS),g' \ + -e 's,@PACKAGE\@,$(PACKAGE),g' \ + -e 's,@VERSION\@,$(VERSION),g' all: all-am @@ -275,6 +283,8 @@ par: $(top_builddir)/config.status $(srcdir)/par.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ rancid-fe: $(top_builddir)/config.status $(srcdir)/rancid-fe.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +agmrancid: $(top_builddir)/config.status $(srcdir)/agmrancid.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ alogin: $(top_builddir)/config.status $(srcdir)/alogin.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ arancid: $(top_builddir)/config.status $(srcdir)/arancid.in @@ -345,7 +355,7 @@ zrancid: $(top_builddir)/config.status $(srcdir)/zrancid.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -368,10 +378,10 @@ clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) hpuifilter$(EXEEXT): $(hpuifilter_OBJECTS) $(hpuifilter_DEPENDENCIES) @rm -f hpuifilter$(EXEEXT) - $(LINK) $(hpuifilter_LDFLAGS) $(hpuifilter_OBJECTS) $(hpuifilter_LDADD) $(LIBS) + $(LINK) $(hpuifilter_OBJECTS) $(hpuifilter_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f $$d$$p; then \ @@ -398,19 +408,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hpuifilter.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -461,22 +470,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -492,7 +500,7 @@ check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -541,12 +549,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: install-binPROGRAMS install-binSCRIPTS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -566,20 +582,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ - uninstall-info-am +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ - install-binSCRIPTS install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + install-binSCRIPTS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-binSCRIPTS uninstall-info-am + uninstall-binSCRIPTS lg.cgi: Makefile $(srcdir)/lg.cgi.in diff --git a/bin/agmrancid.in b/bin/agmrancid.in new file mode 100644 index 0000000..9f3166d --- /dev/null +++ b/bin/agmrancid.in @@ -0,0 +1,490 @@ +#! @PERLV_PATH@ +## +## $Id: agmrancid.in,v 1.1 2006/11/23 20:20:16 heas Exp $ +## +## @PACKAGE@ @VERSION@ +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. +## All rights reserved. +## +## This software may be freely copied, modified and redistributed +## without fee for non-commerical purposes provided that this license +## remains intact and unmodified with any RANCID distribution. +## +## There is no warranty or other guarantee of fitness of this software. +## It is provided solely "as is". The author(s) disclaim(s) all +## responsibility and liability with respect to this software's usage +## or its effect upon hardware, computer systems, other software, or +## anything else. +## +## Except where noted otherwise, rancid was written by and is maintained by +## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz. +## +# Amazingly hacked version of Hank's rancid - this one tries to +# deal with Cisco AGMs. +# +# RANCID - Really Awesome New Cisco confIg Differ +# +# usage: rancid [-dV] [-l] [-f filename | hostname] +# +use Getopt::Std; +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} +$log = $opt_l; +$debug = $opt_d; +$file = $opt_f; +$host = $ARGV[0]; +$clean_run = 0; +$found_end = 0; +$found_version = 0; +$found_env = 0; +$found_diag = 0; +$timeo = 90; # clogin timeout in seconds + +my(@commandtable, %commands, @commands);# command lists +my(%filter_pwds); # password filtering mode + +# This routine is used to print out the router configuration +sub ProcessHistory { + my($new_hist_tag,$new_command,$command_string,@string) = (@_); + if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command)) + && defined %history) { + print eval "$command \%history"; + undef %history; + } + if (($new_hist_tag) && ($new_command) && ($command_string)) { + if ($history{$command_string}) { + $history{$command_string} = "$history{$command_string}@string"; + } else { + $history{$command_string} = "@string"; + } + } elsif (($new_hist_tag) && ($new_command)) { + $history{++$#history} = "@string"; + } else { + print "@string"; + } + $hist_tag = $new_hist_tag; + $command = $new_command; + 1; +} + +sub numerically { $a <=> $b; } + +# This is a sort routine that will sort numerically on the +# keys of a hash as if it were a normal array. +sub keynsort { + local(%lines) = @_; + local($i) = 0; + local(@sorted_lines); + foreach $key (sort numerically keys(%lines)) { + $sorted_lines[$i] = $lines{$key}; + $i++; + } + @sorted_lines; +} + +# This is a sort routine that will sort on the +# keys of a hash as if it were a normal array. +sub keysort { + local(%lines) = @_; + local($i) = 0; + local(@sorted_lines); + foreach $key (sort keys(%lines)) { + $sorted_lines[$i] = $lines{$key}; + $i++; + } + @sorted_lines; +} + +# This is a sort routine that will sort on the +# values of a hash as if it were a normal array. +sub valsort{ + local(%lines) = @_; + local($i) = 0; + local(@sorted_lines); + foreach $key (sort values %lines) { + $sorted_lines[$i] = $key; + $i++; + } + @sorted_lines; +} + +# This is a numerical sort routine (ascending). +sub numsort { + local(%lines) = @_; + local($i) = 0; + local(@sorted_lines); + foreach $num (sort {$a <=> $b} keys %lines) { + $sorted_lines[$i] = $lines{$num}; + $i++; + } + @sorted_lines; +} + +# This is a sort routine that will sort on the +# ip address when the ip address is anywhere in +# the strings. +sub ipsort { + local(%lines) = @_; + local($i) = 0; + local(@sorted_lines); + foreach $addr (sort sortbyipaddr keys %lines) { + $sorted_lines[$i] = $lines{$addr}; + $i++; + } + @sorted_lines; +} + +# These two routines will sort based upon IP addresses +sub ipaddrval { + my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#); + $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0])); +} +sub sortbyipaddr { + &ipaddrval($a) <=> &ipaddrval($b); +} + +# This routine parses "show version" +sub ShowVersion { + print STDERR " In ShowVersion: $_" if ($debug); + my($slaveslot); + + while () { + tr/\015//d; + if (/^$prompt/) { $found_version=1; last}; + 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 (/command authorization failed/i); + return(0) if ($found_version); # Only do this routine once + # the pager can not be disabled per-session on the PIX + if (/^(-+More-+)/i) { + my($len) = length($1); + s/^$1\s{$len}//; + } + + /^Cisco Anomaly Guard Image /i && + ProcessHistory("COMMENTS","keysort","B1", "! $_") && next; + /^MDM agent /i && + ProcessHistory("COMMENTS","keysort","B1", "! $_") && next; + } + return(0); +} + +# This routine parses "show diag" +# This will create arrarys for hw info. +sub ShowDiag { + print STDERR " In ShowDiag: $_" if ($debug); + + while () { + tr/\015//d; + if (/^$prompt/) { $found_diag=1; last}; + 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 (/command authorization failed/i); + return(0) if ($found_diag); # Only do this routine once + /^$/ && next; + # the pager can not be disabled per-session on the PIX + if (/^(-+More-+)/i) { + my($len) = length($1); + s/^$1\s{$len}//; + } + + /^Cisco Anomaly Guard Image /i && next; + /^... ... \d+ \d+:\d+:\d+ \w \d+$/ && next; + /^Copyright /i && next; + /^All rights /i && next; + /sample loss:/i && next; + /forward failures /i && next; + + ProcessHistory("DIAG","keysort","C1","! $_"); + } + ProcessHistory("DIAG","","","!\n"); + return(0); +} + +# This routine processes a "write term" +sub WriteTerm { + print STDERR " In WriteTerm: $_" if ($debug); + my($lineauto,$comment,$linecnt) = (0,0,0); + + while () { + tr/\015//d; + last if (/^$prompt/); + return(1) if /Line has invalid autocommand /; + return(1) if (/(Invalid input detected|Type help or )/i); + return(-1) if (/command authorization failed/i); + # the pager can not be disabled per-session on the PIX + if (/^(-+More-+)/i) { + my($len) = length($1); + s/^$1\s{$len}//; + } + + /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked + return(0) if ($found_end); # Only do this routine once + $linecnt++; + $lineauto = 0 if (/^[^ ]/); + + # skip consecutive comment/blank lines to avoid oscillating extra + # comment line on some access servers. grrr. + if (/^!/ || /^$/) { + next if ($comment); + ProcessHistory("","","",$_); + $comment++; + next; + } + $comment = 0; + + # Dog gone Cool matches to process the rest of the config + /^tftp-server flash / && next; # kill any tftp remains + /^ntp clock-period / && next; # kill ntp clock-period + /^ length / && next; # kill length on serial lines + /^ width / && next; # kill width on serial lines + $lineauto = 1 if /^ modem auto/; + /^ speed / && $lineauto && next; # kill speed on serial lines + /^ clockrate / && next; # kill clockrate on serial interfaces + if (/^(enable )?(password|passwd)( level \w+)? encrypted ((.)\S+)/) { + if ($filter_pwds >= 2) { + ProcessHistory("USER","keysort","$1", + "!$1$2$3 encrypted \n"); + } elsif ($filter_pwds >= 1 && $5 ne "\$") { + ProcessHistory("USER","keysort","$1", + "!$1$2$3 encrypted \n"); + } else { + ProcessHistory("USER","keysort","$1","$_"); + } + next; + } + + if ((/^(enable )?(password|passwd)( level \w+)? encrypted [^\$]/ && + $filter_pwds >= 1) || + (/^(enable )?(password|passwd)( level \w+)? encrypted [^\$]/ && + $filter_pwds >= 2)) { + ProcessHistory("ENABLE","","","!$1$2$3 \n"); + next; + } + if (/^username (\S+)(\s.*)? encrypted ((.)\S+)/) { + if ($filter_pwds >= 2) { + ProcessHistory("USER","keysort","$1", + "!username $1$2 encrypted \n"); + } elsif ($filter_pwds >= 1 && $4 ne "\$") { + ProcessHistory("USER","keysort","$1", + "!username $1$2 encrypted \n"); + } else { + ProcessHistory("USER","keysort","$1","$_"); + } + next; + } + if (/^(\s*)password / && $filter_pwds >= 1) { + ProcessHistory("LINE-PASS","","","!$1password \n"); + next; + } + if (/^(\s*)secret / && $filter_pwds >= 2) { + ProcessHistory("LINE-PASS","","","!$1secret \n"); + next; + } + # filter out any RCS/CVS tags to avoid confusing local CVS storage + s/\$(Revision|Id):/ $1:/; + # order arp lists + /^arp\s+(\d+\.\d+\.\d+\.\d+)\s+/ && + ProcessHistory("ARP","ipsort","$1","$_") && next; + + # order logging statements + /^logging host (\d+\.\d+\.\d+\.\d+)/ && + ProcessHistory("LOGGING","ipsort","$1","$_") && next; + # order/prune snmp-server host statements + # we only prune lines of the form + # snmp-server host a.b.c.d + if (/^snmp-server trap-dest (\d+\.\d+\.\d+\.\d+) /) { + if (defined($ENV{'NOCOMMSTR'})) { + my($ip) = $1; + my($line) = "snmp-server host $ip"; + my(@tokens) = split(' ', $'); + my($token); + while ($token = shift(@tokens)) { + if ($token eq 'version') { + $line .= " " . join(' ', ($token, shift(@tokens))); + if ($token eq '3') { + $line .= " " . join(' ', ($token, shift(@tokens))); + } + } elsif ($token eq 'vrf') { + $line .= " " . join(' ', ($token, shift(@tokens))); + } elsif ($token =~ /^(informs?|traps?|(no)?auth)$/) { + $line .= " " . $token; + } else { + $line = "!$line " . join(' ', ("", join(' ',@tokens))); + last; + } + } + ProcessHistory("SNMPSERVERHOST","ipsort","$ip","$line\n"); + } else { + ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_"); + } + next; + } + if (/^(snmp community) (\S+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1 $'") && next; + } else { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; + } + } + # prune tacacs/radius server keys + if (/^((tacacs-server|radius-server)\s(\w*[-\s(\s\S+])*\s?key) \d \w+/ + && $filter_pwds >= 1) { + ProcessHistory("","","","!$1 $'"); next; + } + + # delete ntp auth password - this md5 is a reversable too + if (/^(ntp authentication-key \d+ md5) / && $filter_pwds >= 1) { + ProcessHistory("","","","!$1 \n"); next; + } + # order ntp peers/servers + if (/^ntp (server|peer) (\d+)\.(\d+)\.(\d+)\.(\d+)/) { + $sortkey = sprintf("$1 %03d%03d%03d%03d",$2,$3,$4,$5); + ProcessHistory("NTP","keysort",$sortkey,"$_"); + next; + } + + # catch anything that wasnt matched above. + ProcessHistory("","","","$_"); + # end of config. the ": " game is for the PIX + if (/^(: +)?end$/) { + $found_end = 1; + return(1); + } + } + # The AGM lacks a definitive "end of config" marker. If we have seen at + # least 5 lines of write term o/p, we can be reasonably sure that we got + # the config. + if ($linecnt > 5) { + $found_end = 1; + return(1); + } + + return(0); +} + +# dummy function +sub DoNothing {print STDOUT;} + +# Main +@commandtable = ( + {'show version' => 'ShowVersion'}, + {'show diagnostic-info' => 'ShowDiag'}, + {'show running-config' => 'WriteTerm'}, +); +# Use an array to preserve the order of the commands and a hash for mapping +# commands to the subroutine and track commands that have been completed. +@commands = map(keys(%$_), @commandtable); +%commands = map(%$_, @commandtable); + +$cisco_cmds=join(";",@commands); +$cmds_regexp=join("|",@commands); + +if (length($host) == 0) { + if ($file) { + print(STDERR "Too few arguments: file name required\n"); + exit(1); + } else { + print(STDERR "Too few arguments: host name required\n"); + exit(1); + } +} +open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n"; +select(OUTPUT); +# make OUTPUT unbuffered if debugging +if ($debug) { $| = 1; } + +if ($file) { + print STDERR "opening file $host\n" if ($debug); + print STDOUT "opening file $host\n" if ($log); + open(INPUT,"<$host") || die "open failed for $host: $!\n"; +} else { + print STDERR "executing hlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug); + print STDOUT "executing hlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log); + if (defined($ENV{NOPIPE})) { + system "hlogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "hlogin failed for $host: $!\n"; + open(INPUT, "< $host.raw") || die "hlogin failed for $host: $!\n"; + } else { + open(INPUT,"hlogin -t $timeo -c \"$cisco_cmds\" $host ) { + tr/\015//d; + if (/[>#]\s?exit$/) { + $clean_run=1; + last; + } + if (/^Error:/) { + print STDOUT ("$host clogin error: $_"); + print STDERR ("$host clogin error: $_") if ($debug); + $clean_run=0; + last; + } + while (/#\s*($cmds_regexp)\s*$/) { + $cmd = $1; + if (!defined($prompt)) { + $prompt = ($_ =~ /^([^#]+#)/)[0]; + $prompt =~ s/([][}{)(\\])/\\$1/g; + print STDERR ("PROMPT MATCH: $prompt\n") if ($debug); + } + print STDERR ("HIT COMMAND:$_") if ($debug); + if (! defined($commands{$cmd})) { + print STDERR "$host: found unexpected command - \"$cmd\"\n"; + $clean_run = 0; + last TOP; + } + $rval = &{$commands{$cmd}}; + delete($commands{$cmd}); + if ($rval == -1) { + $clean_run = 0; + last TOP; + } + if (/[>#]\s?exit$/) { + $clean_run=1; + last; + } + } +} +print STDOUT "Done $logincmd: $_\n" if ($log); +# Flush History +ProcessHistory("","","",""); +# Cleanup +close(INPUT); +close(OUTPUT); + +if (defined($ENV{NOPIPE})) { + unlink("$host.raw") if (! $debug); +} + +# check for completeness +if (scalar(%commands) || !$clean_run || !$found_end) { + if (scalar(%commands)) { + printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands))); + printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug); + } + if (!$clean_run || !$found_end) { +print STDOUT $clean_run . " " . $found_end . "\n"; + print STDOUT "$host: End of run not found\n"; + print STDERR "$host: End of run not found\n" if ($debug); + system("/usr/bin/tail -1 $host.new"); + } + unlink "$host.new" if (! $debug); +} diff --git a/bin/alogin.in b/bin/alogin.in index ae3ddee..27286d7 100644 --- a/bin/alogin.in +++ b/bin/alogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: alogin.in,v 1.33 2006/08/10 07:00:30 heas Exp $ +## $Id: alogin.in,v 1.35 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -68,6 +69,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -85,13 +89,16 @@ for {set i 0} {$i < $argc} {incr i} { set username [ lindex $argv $i ] } # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/arancid.in b/bin/arancid.in index 9b76146..165a187 100644 --- a/bin/arancid.in +++ b/bin/arancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: arancid.in,v 1.21 2006/05/28 16:38:50 heas Exp $ +## $Id: arancid.in,v 1.22 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Hacked version of rancid for Alteon WebOS switches ## tested with: ad3 v8.1.18 ## afort@choqolat.org (andrew fort) @@ -27,10 +28,14 @@ # # arancid - Alteon WebOS plugin for rancid # -# usage: arancid [-d] [-l] [-f filename | hostname] +# usage: arancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/blogin.in b/bin/blogin.in index 6233820..9c19de9 100644 --- a/bin/blogin.in +++ b/bin/blogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: blogin.in,v 1.31 2006/08/10 07:00:30 heas Exp $ +## $Id: blogin.in,v 1.33 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -72,6 +73,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -97,13 +101,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/brancid.in b/bin/brancid.in index 772e56c..35f3f2f 100644 --- a/bin/brancid.in +++ b/bin/brancid.in @@ -1,8 +1,9 @@ #! @PERLV_PATH@ ## -## $Id: brancid.in,v 1.23 2006/05/28 16:38:50 heas Exp $ +## $Id: brancid.in,v 1.24 2006/10/05 04:27:42 heas Exp $ ## hacked version of Hank's rancid - this one tries to deal with Bay's. ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -22,10 +23,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in index fd56c0a..bd13d65 100644 --- a/bin/cat5rancid.in +++ b/bin/cat5rancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: cat5rancid.in,v 1.46 2006/05/28 16:38:50 heas Exp $ +## $Id: cat5rancid.in,v 1.47 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -21,10 +22,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/clogin.in b/bin/clogin.in index 5406df3..81c654e 100644 --- a/bin/clogin.in +++ b/bin/clogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: clogin.in,v 1.99 2006/08/10 07:00:30 heas Exp $ +## $Id: clogin.in,v 1.103 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -75,6 +76,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -100,13 +104,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { @@ -489,14 +496,17 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } { # Catalyst 1900s have some lame menu. Enter # K to reach a command-line. send "K\r" - exp_continue; + exp_continue + } + -re "Last login:" { + exp_continue } -re "@\[^\r\n]+ $p_prompt" { - # ssh pwd prompt - sleep 1 - send "$userpswd\r" - exp_continue - } + # ssh pwd prompt + sleep 1 + send "$userpswd\r" + exp_continue + } -re "$u_prompt" { send "$user\r" set uprompt_seen 1 @@ -677,6 +687,10 @@ proc run_commands { prompt command } { send "n\r" exp_continue } + "Configuration changes have occurred.*" { # Cisco CSS + send "n\r" + exp_continue + } "Do you wish to save your configuration changes" { send "n\r" exp_continue diff --git a/bin/control_rancid.in b/bin/control_rancid.in index b8fde93..69ff911 100644 --- a/bin/control_rancid.in +++ b/bin/control_rancid.in @@ -1,7 +1,8 @@ #! /bin/sh ## -## $Id: control_rancid.in,v 1.77 2006/05/28 16:38:50 heas Exp $ +## $Id: control_rancid.in,v 1.79 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,22 +25,21 @@ # print a usage message to stderr pr_usage() { - echo "usage: $0 [-r device_name] [-m mail rcpt] [group [group ...]]" >&2; + echo "usage: $0 [-V] [-r device_name] [-m mail rcpt] [group [group ...]]" >&2; } # command-line options -# -r +# -V print version string # -m +# -r alt_mailrcpt=0 if [ $# -ge 1 ] ; then while [ 1 ] ; do case $1 in - -r) - shift - # next arg is the device name - device="$1" - shift + -V) + echo "@PACKAGE@ @VERSION@" + exit 0 ;; -m) shift @@ -52,6 +52,12 @@ if [ $# -ge 1 ] ; then fi shift ;; + -r) + shift + # next arg is the device name + device="$1" + shift + ;; --) shift; break; ;; diff --git a/bin/cssrancid.in b/bin/cssrancid.in index 664953b..294f400 100644 --- a/bin/cssrancid.in +++ b/bin/cssrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: cssrancid.in,v 1.12 2006/05/28 16:38:50 heas Exp $ +## $Id: cssrancid.in,v 1.13 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -21,10 +22,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/elogin.in b/bin/elogin.in index a477c94..d581101 100644 --- a/bin/elogin.in +++ b/bin/elogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: elogin.in,v 1.36 2006/08/10 07:00:30 heas Exp $ +## $Id: elogin.in,v 1.38 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -65,6 +66,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -90,13 +94,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/erancid.in b/bin/erancid.in index d60dc03..a95da84 100644 --- a/bin/erancid.in +++ b/bin/erancid.in @@ -1,8 +1,9 @@ #! @PERLV_PATH@ ## -## $Id: erancid.in,v 1.24 2005/09/25 17:48:29 heas Exp $ +## $Id: erancid.in,v 1.26 2006/10/05 04:27:42 heas Exp $ ## -## Copyright (C) 1997-2004 by Terrapin Communications, Inc. +## @PACKAGE@ @VERSION@ +## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed @@ -21,10 +22,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/f10rancid.in b/bin/f10rancid.in index 4b63338..e61d215 100644 --- a/bin/f10rancid.in +++ b/bin/f10rancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: f10rancid.in,v 1.22 2006/08/12 00:48:48 heas Exp $ +## $Id: f10rancid.in,v 1.23 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/flogin.in b/bin/flogin.in index 24b8400..4e93e35 100644 --- a/bin/flogin.in +++ b/bin/flogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: flogin.in,v 1.42 2006/08/10 07:00:30 heas Exp $ +## $Id: flogin.in,v 1.44 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -76,6 +77,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -101,13 +105,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/fnrancid.in b/bin/fnrancid.in index c4820e3..b14906a 100644 --- a/bin/fnrancid.in +++ b/bin/fnrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: fnrancid.in,v 1.10 2006/05/28 16:38:50 heas Exp $ +## $Id: fnrancid.in,v 1.11 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; #$debug = 1; diff --git a/bin/francid.in b/bin/francid.in index bda031f..2967a34 100644 --- a/bin/francid.in +++ b/bin/francid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: francid.in,v 1.39 2006/07/12 23:43:14 heas Exp $ +## $Id: francid.in,v 1.42 2006/10/05 05:43:31 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; @@ -148,7 +153,7 @@ sub ShowVersion { while () { tr/\015//d; next if /^\s*$/; - last if(/^$prompt/); + last if (/^$prompt/); next if (/^(The system |Crash time)/); next if (/^((Active|Standby) Management|LP Slot \d+) uptime is/); @@ -201,6 +206,10 @@ sub ShowChassis { if (/temperature:/i) { $skip = 1; } + s/(Fan \d+ \S+), speed .*/$1/; + if (/speed/i) { + $skip = 1; + } next if $skip; ProcessHistory("CHASSIS","","","! $_"); @@ -215,8 +224,8 @@ sub ShowFlash { while () { tr/\015//d; - last if(/^$prompt/); - next if /^\s*$/; + last if (/^$prompt/); + next if (/^\s*$/); ProcessHistory("FLASH","","","!Flash: $_"); } ProcessHistory("","","","!\n"); @@ -229,9 +238,10 @@ sub ShowModule { while () { tr/\015//d; - last if(/^$prompt/); - next if /^\s*$/; - next if /:\s*$/; + last if (/^$prompt/); + return(1) if (/Invalid input ->/); + next if (/^\s*$/); + next if (/:\s*$/); ProcessHistory("MODULE","","","!Module: $_"); } ProcessHistory("","","","!\n"); @@ -244,7 +254,7 @@ sub WriteTerm { while () { tr/\015//d; - last if(/^$prompt/); + last if (/^$prompt/); /Current configuration:/i && next; /^ver \d+\.\d+/ && next; diff --git a/bin/hlogin.in b/bin/hlogin.in index ebfdf1f..1eabd5c 100644 --- a/bin/hlogin.in +++ b/bin/hlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: hlogin.in,v 1.35 2006/08/10 07:00:31 heas Exp $ +## $Id: hlogin.in,v 1.37 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -77,6 +78,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -102,13 +106,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/hpuifilter.c b/bin/hpuifilter.c index 00a8833..c278a3f 100644 --- a/bin/hpuifilter.c +++ b/bin/hpuifilter.c @@ -1,5 +1,5 @@ /* - * $Id: hpuifilter.c,v 1.33 2006/05/28 16:38:51 heas Exp $ + * $Id: hpuifilter.c,v 1.36 2006/11/29 01:02:27 heas Exp $ * * Copyright (C) 1997-2006 by Terrapin Communications, Inc. * All rights reserved. @@ -166,9 +166,10 @@ main(int argc, char **argv, char **ev) unsetenv("DISPLAY"); - /* allocate pty for telnet/ssh, then fork and exec */ for (child = 3; child < 10; child++) close(child); + + /* allocate pty for telnet/ssh, then fork and exec */ if (openpty(&ptym, &ptys, ptyname, NULL, NULL)) { fprintf(stderr, "%s: could not allocate pty: %s\n", progname, strerror(errno)); @@ -242,7 +243,6 @@ main(int argc, char **argv, char **ev) signal(SIGCHLD, SIG_DFL); /* close the master pty & std* inherited from the parent */ close(ptym); - setsid(); if (ptys != 0) close(0); if (ptys != 1) @@ -250,10 +250,11 @@ main(int argc, char **argv, char **ev) if (ptys != 2) close(2); #ifdef TIOCSCTTY + setsid(); if (ioctl(ptys, TIOCSCTTY, NULL) == -1) { snprintf(ptyname, FILENAME_MAX, "%s: could not set controlling " "tty: %s\n", progname, strerror(errno)); - write(ptys, ptyname, strlen(ptyname)); + write(0, ptyname, strlen(ptyname)); return(EX_OSERR); } #endif @@ -262,7 +263,7 @@ main(int argc, char **argv, char **ev) if (dup2(ptys, 0) == -1 || dup2(ptys, 1) == -1 || dup2(ptys, 2) == -1) { snprintf(ptyname, FILENAME_MAX, "%s: dup2() failed: %s\n", progname, strerror(errno)); - write(ptys, ptyname, strlen(ptyname)); + write(0, ptyname, strlen(ptyname)); return(EX_OSERR); } if (ptys > 2) @@ -272,7 +273,7 @@ main(int argc, char **argv, char **ev) execvp(argv[optind], argv + optind); snprintf(ptyname, FILENAME_MAX, "%s: execvp() failed: %s\n", progname, strerror(errno)); - write(ptys, ptyname, strlen(ptyname)); + write(0, ptyname, strlen(ptyname)); return(EX_TEMPFAIL); /*NOTREACHED*/ } @@ -468,7 +469,7 @@ int filter(char *buf, int len) { static regmatch_t pmatch[1]; -#define N_REG 13 /* number of regexes in reg[][] */ +#define N_REG 14 /* number of regexes in reg[][] */ static regex_t preg[N_REG]; static char reg[N_REG][50] = { /* vt100/220 escape codes */ "\e7\e\\[1;24r\e8", /* ds */ @@ -485,6 +486,7 @@ filter(char *buf, int len) "\e\\[\\?25h", /* ve */ "\e\\[\\?25l", /* vi */ "\e\\[K", /* ce */ + "\e\\[7m", /* mr - ansi */ /* replace these with CR */ "\e\\[0m", /* me */ @@ -629,7 +631,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *term, static char line[] = "/dev/XtyXX"; const char *cp1, *cp2, *cp, *linep; int master, slave; - gid_t ttygid; + gid_t ttygid; mode_t mode; struct group *gr; @@ -644,6 +646,9 @@ openpty(int *amaster, int *aslave, char *name, struct termios *term, linep = ptsname(master); grantpt(master); unlockpt(master); +#ifndef TIOCSCTTY + setsid(); +#endif if ((slave = open(linep, O_RDWR)) < 0) { slave = errno; (void) close(master); diff --git a/bin/hrancid.in b/bin/hrancid.in index f26182d..0feefd0 100644 --- a/bin/hrancid.in +++ b/bin/hrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: hrancid.in,v 1.25 2006/07/10 21:35:39 heas Exp $ +## $Id: hrancid.in,v 1.27 2006/10/05 04:27:42 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; @@ -160,8 +165,6 @@ sub ShowVersion { # This routine parses "show flash" sub ShowFlash { - # skip if this is 7000, 7200, 7500, or 12000; else we end up with - # redundant data from dir /all slot0: print STDERR " In ShowFlash: $_" if ($debug); while () { diff --git a/bin/htlogin.in b/bin/htlogin.in index 03c3762..213f028 100644 --- a/bin/htlogin.in +++ b/bin/htlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: htlogin.in,v 1.16 2006/08/10 07:00:31 heas Exp $ +## $Id: htlogin.in,v 1.18 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -67,6 +68,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -92,13 +96,16 @@ for {set i 0} {$i < $argc} {incr i} { } set do_passwd 0 # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/htrancid.in b/bin/htrancid.in index c40f812..d15d569 100644 --- a/bin/htrancid.in +++ b/bin/htrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: htrancid.in,v 1.12 2006/05/28 16:38:51 heas Exp $ +## $Id: htrancid.in,v 1.13 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: htrancid [-d] [-l] [-f filename | hostname] +# usage: htrancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/jerancid.in b/bin/jerancid.in index d4a9bd7..c0fb33e 100644 --- a/bin/jerancid.in +++ b/bin/jerancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: jerancid.in,v 1.35 2006/05/28 16:38:51 heas Exp $ +## $Id: jerancid.in,v 1.36 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/jlogin.in b/bin/jlogin.in index b353a0e..729afa7 100644 --- a/bin/jlogin.in +++ b/bin/jlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: jlogin.in,v 1.54 2006/08/10 07:00:31 heas Exp $ +## $Id: jlogin.in,v 1.56 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -64,6 +65,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 120 @@ -105,6 +109,10 @@ for {set i 0} {$i < $argc} {incr i} { set userpasswd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # passphrase } -r* - -R* { diff --git a/bin/jrancid.in b/bin/jrancid.in index 6fd53fc..73dc5fa 100644 --- a/bin/jrancid.in +++ b/bin/jrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: jrancid.in,v 1.72 2006/07/28 16:57:57 heas Exp $ +## $Id: jrancid.in,v 1.79 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: jrancid [-d] [-l] [-f filename | hostname] +# usage: jrancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $debug = $opt_d; $log = $opt_l; $file = $opt_f; @@ -39,6 +44,7 @@ $timeo = 120; # clogin timeout in seconds my(@commandtable, %commands, @commands);# command lists my(%filter_pwds); # password filtering mode +my($ShowChassisSCB); # Only run ShowChassisSCB() once # This routine is used to print out the router configuration sub ProcessHistory { @@ -152,9 +158,9 @@ sub ShowChassisClocks { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -188,9 +194,9 @@ sub ShowChassisEnvironment { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -206,6 +212,8 @@ sub ShowChassisEnvironment { ProcessHistory("","","","# $1\n") && next; /(^.*\S)\s+ Spinning at .*$/ && ProcessHistory("","","","# $1\n") && next; + /(^.*\S)\s+Measurement/ && + ProcessHistory("","","","# $1\n") && next; ProcessHistory("","","","# $_"); } return; @@ -219,9 +227,9 @@ sub ShowChassisFirmware { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -243,9 +251,9 @@ sub ShowChassisFpcDetail { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -270,9 +278,9 @@ sub ShowChassisHardware { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -295,9 +303,9 @@ sub ShowChassisRoutingEngine { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; @@ -328,9 +336,9 @@ sub ShowChassisSCB { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); return if ($ShowChassisSCB); /error: the chassis subsystem is not running/ && return; @@ -361,9 +369,9 @@ sub ShowChassisAlarms { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /Unrecognized command/ && return; /command is not valid/ && return; @@ -383,9 +391,9 @@ sub ShowSystemAutoinstall { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /Unrecognized command/ && return; /command is not valid/ && return; @@ -397,6 +405,26 @@ sub ShowSystemAutoinstall { return; } +sub ShowSystemCoreDumps { + print STDERR " In ShowSystemCoreDumps: $_" if ($debug); + + s/^[a-z]+@//; + ProcessHistory("","","","# $_"); + while () { + tr/\015//d; + last if (/^$prompt/); + + /Unrecognized command/ && return(1); + /^\s+\^/ && return(1); + /syntax error/ && return(1); + /^JUNOS / && && next; + /No such file or directory$/ && next; + + ProcessHistory("","","","# $_"); + } + return(0); +} + # This routine parses "show system license" sub ShowSystemLicense { print STDERR " In ShowSystemLicense: $_" if ($debug); @@ -405,9 +433,9 @@ sub ShowSystemLicense { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /Unrecognized command/ && return; /command is not valid/ && return; @@ -427,9 +455,9 @@ sub ShowSystemLicenseKeys { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /Unrecognized command/ && return; /command is not valid/ && return; @@ -449,9 +477,9 @@ sub ShowSystemBootMessages { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /Unrecognized command/ && return; /command is not valid/ && return; @@ -476,10 +504,10 @@ sub ShowVersion { ProcessHistory("","","","# $_"); while () { tr/\015//d; - last if(/^$prompt/); - next if(/^\s*$/); - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + last if (/^$prompt/); + next if (/^\s*$/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); /^Juniper Networks is:/ && ProcessHistory("","","","# \n# $_") && next; ProcessHistory("","","","# $_"); @@ -502,12 +530,12 @@ sub ShowConfiguration { next if (/^\s*$/); # end of config - hopefully. juniper does not have a reliable # end-of-config tag. appears to end with "\nPROMPT>", but not sure. - if(/^$prompt/) { + if (/^$prompt/) { $found_end++; last; } - next if(/^system (shutdown message from|going down )/i); - next if(/^\{(master|backup)}/); + next if (/^system (shutdown message from|going down )/i); + next if (/^\{(master|backup)}/); $lines++; /^database header mismatch: / && return(-1); @@ -581,6 +609,7 @@ sub DoNothing {print STDOUT;} {'show chassis scb' => 'ShowChassisSCB'}, {'show chassis sfm detail' => 'ShowChassisSCB'}, {'show chassis ssb' => 'ShowChassisSCB'}, + {'show chassis feb detail' => 'ShowChassisSCB'}, {'show chassis feb' => 'ShowChassisSCB'}, {'show chassis cfeb' => 'ShowChassisSCB'}, {'show chassis alarms' => 'ShowChassisAlarms'}, @@ -588,6 +617,7 @@ sub DoNothing {print STDOUT;} {'show system license' => 'ShowSystemLicense'}, # {'show system license keys' => 'ShowSystemLicenseKeys'}, {'show system boot-messages' => 'ShowSystemBootMessages'}, + {'show system core-dumps' => 'ShowSystemCoreDumps'}, {'show version detail' => 'ShowVersion'}, {'show configuration' => 'ShowConfiguration'} ); @@ -640,7 +670,7 @@ if ($ENV{"FILTER_PWDS"} =~ /no/i) { } ProcessHistory("","","","# RANCID-CONTENT-TYPE: juniper\n#\n"); -TOP: while() { +TOP: while () { tr/\015//d; if (/^Error:/) { print STDOUT ("$host jlogin error: $_"); diff --git a/bin/lg.cgi.in b/bin/lg.cgi.in index 2a6957f..4ad6fdd 100644 --- a/bin/lg.cgi.in +++ b/bin/lg.cgi.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: lg.cgi.in,v 1.53 2006/05/28 16:38:51 heas Exp $ +## $Id: lg.cgi.in,v 1.54 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## diff --git a/bin/lgform.cgi.in b/bin/lgform.cgi.in index 88b2a33..774d104 100644 --- a/bin/lgform.cgi.in +++ b/bin/lgform.cgi.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: lgform.cgi.in,v 1.30 2006/05/28 16:38:51 heas Exp $ +## $Id: lgform.cgi.in,v 1.31 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## diff --git a/bin/mrancid.in b/bin/mrancid.in index a97e4d9..f77779e 100644 --- a/bin/mrancid.in +++ b/bin/mrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: mrancid.in,v 1.17 2006/05/28 16:38:51 heas Exp $ +## $Id: mrancid.in,v 1.19 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; @@ -293,7 +298,6 @@ sub WriteTerm { ProcessHistory("IPHOST","numsort","$1","$_") && next; # end of config - #if (/^end(\n\[OK])?$/) { if (/^(: )?end$/) { $found_end = 1; return(1); diff --git a/bin/nlogin.in b/bin/nlogin.in index 4b04a15..153d0ba 100644 --- a/bin/nlogin.in +++ b/bin/nlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: nlogin.in,v 1.30 2006/08/10 07:00:31 heas Exp $ +## $Id: nlogin.in,v 1.32 2006/12/05 16:50:52 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -67,6 +68,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes firewall take awhile to answer (the default is 10 sec) set timeout 45 diff --git a/bin/nrancid.in b/bin/nrancid.in index 8ac4c34..940bdc8 100644 --- a/bin/nrancid.in +++ b/bin/nrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: nrancid.in,v 1.26 2006/05/28 16:38:52 heas Exp $ +## $Id: nrancid.in,v 1.28 2006/11/10 21:40:48 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -26,10 +27,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; @@ -332,7 +337,6 @@ if (scalar(%commands) || !$found_end) { printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug); } if (!$found_end) { - print STDOUT "$found_end: found end\n"; print STDOUT "$host: End of run not found\n"; print STDERR "$host: End of run not found\n" if ($debug); system("/usr/bin/tail -1 $host.new"); diff --git a/bin/nslogin.in b/bin/nslogin.in index 2de297d..10be62b 100644 --- a/bin/nslogin.in +++ b/bin/nslogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: nslogin.in,v 1.19 2006/08/10 07:00:31 heas Exp $ +## $Id: nslogin.in,v 1.21 2006/12/05 16:50:53 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -77,6 +78,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 diff --git a/bin/nsrancid.in b/bin/nsrancid.in index f8b505e..a74cce6 100644 --- a/bin/nsrancid.in +++ b/bin/nsrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: nsrancid.in,v 1.13 2006/05/28 16:38:52 heas Exp $ +## $Id: nsrancid.in,v 1.14 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/par.in b/bin/par.in index 3b704d8..408b36b 100644 --- a/bin/par.in +++ b/bin/par.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: par.in,v 1.12 2006/05/28 16:38:52 heas Exp $ +## $Id: par.in,v 1.14 2006/11/28 21:21:28 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -44,7 +45,11 @@ # line is assumed to be a command to be run. # use Getopt::Std; -getopts('p:n:l:c:fixedq'); +getopts('p:n:l:c:fixedqV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $procs=$opt_n; $procs=3 if(!$procs); $command=$opt_c; #$command="{}" if(!$command); $parlog=$opt_l; $parlog="par.log.".time() if(!$parlog); diff --git a/bin/prancid.in b/bin/prancid.in index acee537..4777675 100755 --- a/bin/prancid.in +++ b/bin/prancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: prancid.in,v 1.34 2006/05/28 16:38:52 heas Exp $ +## $Id: prancid.in,v 1.35 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/rancid-cvs.in b/bin/rancid-cvs.in index fef54b4..24d555a 100644 --- a/bin/rancid-cvs.in +++ b/bin/rancid-cvs.in @@ -1,7 +1,8 @@ #! /bin/sh ## -## $Id: rancid-cvs.in,v 1.18 2006/05/28 16:38:52 heas Exp $ +## $Id: rancid-cvs.in,v 1.19 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -28,6 +29,32 @@ # Read in the environment ENVFILE="@sysconfdir@/rancid.conf" +# print a usage message to stderr +pr_usage() { + echo "usage: $0 [-V] [group [group ...]]" >&2; +} + +# command-line options +# -V print version string +if [ $# -ge 1 ] ; then + while [ 1 ] ; do + case $1 in + -V) + echo "@PACKAGE@ @VERSION@" + exit 0 + ;; + -*) + echo "unknown option: $1" >&2 + pr_usage + exit 1 + ;; + *) + break; + ;; + esac + done +fi + . $ENVFILE # Base dir diff --git a/bin/rancid-fe.in b/bin/rancid-fe.in index 604040d..3e60783 100644 --- a/bin/rancid-fe.in +++ b/bin/rancid-fe.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rancid-fe.in,v 1.42 2006/08/12 00:44:53 heas Exp $ +## $Id: rancid-fe.in,v 1.44 2006/11/23 20:26:47 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -30,6 +31,7 @@ require 5; $vendor =~ tr/[A-Z]/[a-z]/; %vendortable = ( + 'agm' => 'agmrancid', 'alteon' => 'arancid', 'baynet' => 'brancid', 'cat5' => 'cat5rancid', diff --git a/bin/rancid-run.in b/bin/rancid-run.in index 5de4edc..42e387a 100644 --- a/bin/rancid-run.in +++ b/bin/rancid-run.in @@ -1,7 +1,8 @@ #! /bin/sh ## -## $Id: rancid-run.in,v 1.33 2006/05/28 16:38:52 heas Exp $ +## $Id: rancid-run.in,v 1.35 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -33,29 +34,30 @@ CR_ARGV=""; export CR_ARGV # print a usage message to stderr pr_usage() { - echo "usage: $0 [-f config_file] [-r device_name] [-m mail rcpt] [group [group ...]]" >&2; + echo "usage: $0 [-V] [-f config_file] [-r device_name] [-m mail rcpt] [group [group ...]]" >&2; } # command-line options +# -V +# -f +# -m # -r if [ $# -ge 1 ] ; then while [ 1 ] ; do case $1 in - -f) - shift - # next arg is the device name - ENVFILE="$1" - if [ -z $ENVFILE ]; then - pr_usage - exit 1 - fi - shift - ;; - -r) + -V) + echo "@PACKAGE@ @VERSION@" + exit 0 + ;; + -f) shift - # next arg is the device name - CR_ARGV="$CR_ARGV -r $1"; export CR_ARGV + # next arg is the alternate config file name + ENVFILE="$1" + if [ -z $ENVFILE ]; then + pr_usage + exit 1 + fi shift ;; -m) @@ -64,6 +66,12 @@ if [ $# -ge 1 ] ; then CR_ARGV="$CR_ARGV -m $1"; export CR_ARGV shift ;; + -r) + shift + # next arg is the device name + CR_ARGV="$CR_ARGV -r $1"; export CR_ARGV + shift + ;; --) shift; break; ;; diff --git a/bin/rancid.in b/bin/rancid.in index a69768e..4b5b12a 100644 --- a/bin/rancid.in +++ b/bin/rancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rancid.in,v 1.209 2006/08/12 02:34:22 heas Exp $ +## $Id: rancid.in,v 1.218 2006/10/05 04:27:43 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -21,10 +22,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; @@ -234,7 +239,7 @@ sub ShowVersion { next; /^System image file is "([^\"]*)"$/ && ProcessHistory("COMMENTS","keysort","F5","!Image: $1\n") && next; - if (/(\S+)\s+(?:\((\S+)\)\s+processor\s+)?\(revision[^)]+\).*with (\S+[kK]) bytes/) { + if (/(\S+)\s+(?:\((\S+)\)\s+processor|\(revision[^)]+\)).*\s+with (\S+k) bytes/i) { my($proc) = $1; my($cpu) = $2; my($mem) = $3; @@ -267,55 +272,57 @@ sub ShowVersion { s/^/, /; } - if ( $proc eq "CSC") { + if ($proc eq "CSC") { $type = "AGS"; - } elsif ( $proc eq "CSC4") { + } elsif ($proc eq "CSC4") { $type = "AGS+"; - } elsif ( $proc =~ /^(AS)?25[12][12]/) { + } elsif ($proc =~ /^(AS)?25[12][12]/) { $type = "2500"; - } elsif ( $proc =~ /261[01]/ || $proc =~ /262[01]/ ) { + } elsif ($proc =~ /261[01]/ || $proc =~ /262[01]/ ) { $type = "2600"; - } elsif ( $proc =~ /^36[0246][0-9]/) { + } elsif ($proc =~ /^36[0246][0-9]/) { $type = "3600"; - } elsif ( $proc =~ /^37/) { + } elsif ($proc =~ /^37/) { $type = "3700"; - } elsif ( $proc =~ /^38/) { + } elsif ($proc =~ /^38/) { $type = "3800"; - } elsif ( $proc eq "RSP7000") { + } elsif ($proc eq "RSP7000") { $type = "7500"; - } elsif ( $proc =~ /RSP\d/) { + } elsif ($proc =~ /RSP\d/) { $type = "7500"; - } elsif ( $proc eq "RP1") { + } elsif ($proc eq "RP1") { $type = "7000"; - } elsif ( $proc eq "RP") { + } elsif ($proc eq "RP") { $type = "7000"; - } elsif ( $proc =~ /720[246]/) { + } elsif ($proc =~ /720[246]/) { $type = "7200"; - } elsif ( $proc =~ /1200[48]\/GRP/ || $proc =~ /1201[26]\/GRP/) { + } elsif ($proc =~ /1200[48]\/GRP/ || $proc =~ /1201[26]\/GRP/) { $type = "12000"; - } elsif ( $proc =~ /1201[26]-8R\/GRP/) { + } elsif ($proc =~ /1201[26]-8R\/GRP/) { $type = "12000"; - } elsif ( $proc =~ /WS-C29/) { + } elsif ($proc =~ /WS-C29/) { $type = "2900XL"; $device = "switch"; - } elsif ( $proc =~ /WS-C355/) { + } elsif ($proc =~ /WS-C355/) { $type = "3550"; $device = "switch"; - } elsif ( $proc =~ /WS-C35/) { + } elsif ($proc =~ /WS-C35/) { $type = "3500XL"; $device = "switch"; - } elsif ( $proc =~ /WS-C45/) { + } elsif ($proc =~ /WS-C45/) { $type = "4500"; $device = "switch"; - } elsif ( $proc =~ /6000/) { + } elsif ($proc =~ /6000/) { $type = "6000"; $device = "switch"; - } elsif ( $proc =~ /CISCO76/) { + } elsif ($proc =~ /CISCO76/) { $type = "7600"; $device = "router"; - } elsif ( $proc =~ /1900/) { + } elsif ($proc =~ /1900/) { $type = "1900"; $device = "switch"; + } elsif ( $proc =~ /^73/) { + $type = "7300"; } else { $type = $proc; } @@ -1196,9 +1203,13 @@ sub ShowInventory { ProcessHistory("INVENTORY","","", sprintf("!%-30s %s\n", $1, $2)); next; } - # split PID/VID line - if (/^(PID: \S*)\s*, (VID: \S*)\s*, (SN: \S*)\s*$/) { - ProcessHistory("INVENTORY","","", "!$1\n!$2\n!$3\n"); + # split PID/VID/SN line + if (/^PID: (\S*)\s*, VID: (\S*)\s*, SN: (\S*)\s*$/) { + my($entries) = ""; + $entries .= "!PID: $1\n" if ($1); + $entries .= "!VID: $2\n" if ($2); + $entries .= "!SN: $3\n" if ($3); + ProcessHistory("INVENTORY","","", "$entries"); next; } ProcessHistory("INVENTORY","","","!$_"); @@ -1369,6 +1380,7 @@ sub ShowVLAN { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); + return(1) if /^\s*\^\s*$/; return(1) if /Line has invalid autocommand /; return(1) if /(Invalid input detected|Type help or )/; return(1) if /Ambiguous command/i; @@ -1648,7 +1660,7 @@ sub WriteTerm { } } # prune tacacs/radius server keys - if (/^((tacacs-server|radius-server)\s(\w*[-\s(\s\S+])*\s?key) \w+/ + if (/^((tacacs-server|radius-server)\s(\w*[-\s(\s\S+])*\s?key) \d \w+/ && $filter_pwds >= 1) { ProcessHistory("","","","!$1 $'"); next; } diff --git a/bin/rivlogin.in b/bin/rivlogin.in index e7df3eb..6dc6afb 100644 --- a/bin/rivlogin.in +++ b/bin/rivlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: rivlogin.in,v 1.21 2006/07/17 20:39:42 heas Exp $ +## $Id: rivlogin.in,v 1.25 2006/12/05 16:50:53 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -30,7 +31,11 @@ # # Returned to the RANCID crowd by andrew fort -# Global vars section +# Usage line +set usage "Error: Usage: $argv0 \[-noenable\] \ +\[-f cloginrc-file\] \[-c command\] \[-Evar=x\] \[-s script-file\] \ +\[-x command-file\] \[-t timeout\] \[-o output-file\] \ +router \[router...\]\n" # program diagnostics set verbose 0 @@ -66,12 +71,29 @@ set avenable 1 # tracks if we receive them on the command line. set do_passwd 1 set do_enapasswd 1 - -# cmd usage -set usage "Error: Usage: $argv0 \[-noenable\] \ -\[-f cloginrc-file\] \[-c command\] \[-Evar=x\] \[-s script-file\] \ -\[-x command-file\] \[-t timeout\] \[-o output-file\] \ -router \[router...\]\n" +# +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) ]} { + set default_user $env(CISCO_USER) +} elseif {[ info exists env(USER) ]} { + set default_user $env(USER) +} elseif {[ info exists env(LOGNAME) ]} { + set default_user $env(LOGNAME) +} else { + # This uses "id" which I think is portable. At least it has existed + # (without options) on all machines/OSes I've been on recently - + # unlike whoami or id -nu. + if [ catch {exec id} reason ] { + send_error "\nError: could not exec id: $reason\n" + exit 1 + } + regexp {\(([^)]*)} "$reason" junk default_user +} +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Procedures Section @@ -794,6 +816,10 @@ for {set idx 0} {$idx < $argc} {incr idx} { } set do_script 1 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Command file } -x* - -X { @@ -825,22 +851,21 @@ for {set idx 0} {$idx < $argc} {incr idx} { puts "DEBUG: output file: $output_file" } } - - } -t* - - -T* { - incr idx - set timeout [ lindex $argv $idx ] - - } -noenable { - set avenable 0 - } -* { - puts "ERROR:unkown argument passed: $arg\n" - puts $usage + # Timeout + } -t* - + -T* { + incr idx + set timeout [ lindex $argv $idx ] + # Do we enable? + } -noenable { + set avenable 0 + } -* { + send_user "Error: Unkown argument! $arg\n" + send_user $usage exit 1 - - } default { + } default { break - } + } } } diff --git a/bin/rivrancid.in b/bin/rivrancid.in index 3a6d9f2..d6625b6 100644 --- a/bin/rivrancid.in +++ b/bin/rivrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rivrancid.in,v 1.16 2006/05/28 16:38:52 heas Exp $ +## $Id: rivrancid.in,v 1.17 2006/10/05 04:27:44 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -27,10 +28,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rivrancid [-d] [-l] [-f filename | hostname] +# usage: rivrancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/rrancid.in b/bin/rrancid.in index 5549775..87ea7c4 100644 --- a/bin/rrancid.in +++ b/bin/rrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: rrancid.in,v 1.25 2006/05/28 16:38:52 heas Exp $ +## $Id: rrancid.in,v 1.26 2006/10/05 04:27:44 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/tntlogin.in b/bin/tntlogin.in index 164fd94..57fbfc0 100644 --- a/bin/tntlogin.in +++ b/bin/tntlogin.in @@ -1,7 +1,8 @@ #! @EXPECT_PATH@ -- ## -## $Id: tntlogin.in,v 1.20 2006/08/10 07:00:31 heas Exp $ +## $Id: tntlogin.in,v 1.22 2006/12/05 16:50:53 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -64,6 +65,9 @@ if {[ info exists env(CISCO_USER) ]} { } regexp {\(([^)]*)} "$reason" junk default_user } +if {[ info exists env(CLOGINRC) ]} { + set password_file $env(CLOGINRC) +} # Sometimes routers take awhile to answer (the default is 10 sec) set timeout 45 @@ -81,13 +85,16 @@ for {set i 0} {$i < $argc} {incr i} { set username [ lindex $argv $i ] } # VTY Password - } -v* - - -v* { + } -v* { if {! [ regexp .\[vV\](.+) $arg ignore passwd]} { incr i set passwd [ lindex $argv $i ] } set do_passwd 0 + # Version string + } -V* { + send_user "@PACKAGE@ @VERSION@\n" + exit 0 # Enable Username } -w* - -W* { diff --git a/bin/tntrancid.in b/bin/tntrancid.in index 2a830d1..e16d57b 100644 --- a/bin/tntrancid.in +++ b/bin/tntrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: tntrancid.in,v 1.16 2006/05/28 16:38:53 heas Exp $ +## $Id: tntrancid.in,v 1.17 2006/10/05 04:27:44 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -24,10 +25,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: tntrancid [-d] [-l] [-f filename | hostname] +# usage: tntrancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/xrancid.in b/bin/xrancid.in index 12fad57..96b99ef 100644 --- a/bin/xrancid.in +++ b/bin/xrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: xrancid.in,v 1.40 2006/05/28 16:38:53 heas Exp $ +## $Id: xrancid.in,v 1.41 2006/10/05 04:27:44 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -21,10 +22,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; diff --git a/bin/zrancid.in b/bin/zrancid.in index 8607425..c8a926f 100755 --- a/bin/zrancid.in +++ b/bin/zrancid.in @@ -1,7 +1,8 @@ #! @PERLV_PATH@ ## -## $Id: zrancid.in,v 1.13 2006/05/28 16:38:53 heas Exp $ +## $Id: zrancid.in,v 1.14 2006/10/05 04:27:44 heas Exp $ ## +## @PACKAGE@ @VERSION@ ## Copyright (C) 1997-2006 by Terrapin Communications, Inc. ## All rights reserved. ## @@ -23,10 +24,14 @@ # # RANCID - Really Awesome New Cisco confIg Differ # -# usage: rancid [-d] [-l] [-f filename | hostname] +# usage: rancid [-dV] [-l] [-f filename | hostname] # use Getopt::Std; -getopts('dfl'); +getopts('dflV'); +if ($opt_V) { + print "@PACKAGE@ @VERSION@\n"; + exit(0); +} $log = $opt_l; $debug = $opt_d; $file = $opt_f; -- cgit