[-]
[+]
|
Changed |
rancid.changes
|
|
[-]
[+]
|
Changed |
rancid.spec
^
|
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/CHANGES
^
|
@@ -1,3 +1,114 @@
+2.3.8
+ rancid: filter sup-bootflash if sup-bootdisk worked
+
+ *login: fix match of (yes/no) prompts from ssh
+
+ rancid: carry-over additional inventory filtering from XR
+
+2.3.7
+ xrrancid: change some "admin show" sorting to reflect previous code
+
+ xrrancid: filter useless junk from show inventory
+
+ mrvrancid: update ShowChassis() for temp filtering in new s/w
+
+ nrancid: installed memory on Juniper SSG series - Steven Bertsch
+
+ rancid: missing CR after s/n
+
+ xrrancid: admin show variables boot clean-up - Per Carlson
+
+ xrrancid: add admin show install summary, license - Per Carlson
+
+ xrrancid: fix access-list formatting & sorting
+
+ rancid: collect show capture & shun for ASA - Josh Ward
+
+ xrancid: misc patches for XOS - Zenon Mousmoulas
+
+ rancid-cvs: svn repository handling improvement - Zenon Mousmoulas
+
+ rancid: filter WPA passwd - Pavel Korovin
+
+ rancid: add 'show running-config view full' for role cli - Pavel Korovin
+
+ rancid: filter ppp hostnames (aka usernames) - Pavel Korovin
+
+ *login: update host key change match for newer ssh
+
+ clogin: disable pager for XOS-12.3 - Zenon Mousmoulas
+
+ rancid.conf & control_rancid: support arbitrary subversion URLs as
+ (pre-provisioned) repositories and do not overwrite an existing local
+ repository - Zenon Mousmoulas
+
+ rancid.conf: add LC_COLLATE - Daniel Schmidt
+
+ nlogin: add identfile support - Garry Shtern
+
+ hrancid: match 'logout' in new procurve versions for end of run
+
+ hrancid: include comment line for procurve parser - Per-Olof Olsson
+
+ hrancid: collect show config status - mostly from Per-Olof Olsson
+
+ nxrancid: add show environment fex all fan cmd - Deny IP Any Any
+
+ *login: dont split $sshcmd
+
+ nxrancid: Nexus 4000s don't support 'show environment power' - Lee
+
+ xrrancid: add admin show running - Troy Boudreau
+
+ arancid: /info/sys -> /info/sys/dump - Tim Frost
+
+ rancid: correct isakmp key filter - Pan Affa
+
+ clogin; set terminal width to 132 for both -s and -c
+
+ clogin: respond to ASA's pager in long login banners - Lee
+
+ clogin: set terminal width to 132
+
+ rancid: match flash memory on likes of Cisco 2811 and 2621XM - Pan Affa
+
+ import share/rancid-cvspurge - Matthew Grossman
+
+ rancid: add 'dir /all sup-bootdisk:' for 6500 sup32 - Lee
+
+ rancid: adjust regex for tacacs key match - Pavel Korovin
+
+ *login: join sshcmd clogin directive to handle spaces properly
+
+ mt{login,rancid}: import Microtik module from Chris Boot
+
+ rancid: ppp password missed on dialer interfaces - noted by Hirofumi
+ Katou
+
+ arancid: filter "esecret" lines which change with each config display -
+ Ton
+
+ hlogin: logout from enabled mode instead of exit for -S - Thorsten Hahn
+
+ hrancid: collect show config files and show tech transceivers - Thorsten
+ Hahn
+
+ rancid: filter config timestamp on MDS/NX-OS
+
+ avorancid: collect power management file - from Darius Jan Seroka
+
+ fnrancid: correct comment character - noted by Gavin McCullagh
+
+ fnrancid: update system time and conf_file_ver filters - Gavin McCullagh
+
+ nxrancid: do not require 'show system redundancy status', apparently
+ unsupported on some nexus models.
+
+ clogin: set terminal width for -c and -s
+
+ hlogin: stacks prompt for switch number or CR at login, send CR -
+ Per-Olof Olsson
+
2.3.6
rancid.spec: updated for 2.3.6 - from Florian Koch
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/FAQ
^
|
@@ -3,7 +3,7 @@
This FAQ contains information that may not apply directly to versions of
rancid prior to 2.3. It also contains paths containing tags such as
<PREFIX>, which refer to paths that are site-specific and are determined
-by how rancid is or was configured at installation time. These are explained
+by how rancid was configured at installation time. These are explained
briefly in the configure --help output. Below are the defaults used in
rancid.
@@ -155,7 +155,7 @@
Q. I am new to svn. Where can I find more information?
-Q. The svn so-called "red book" is the definitive guide.
+A. The svn so-called "red book" is the definitive guide.
http://svnbook.red-bean.com/en/1.5/svn-book.html
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/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 1931 2008-02-14 22:01:17Z heas $
+## $Id: Makefile.am 2286 2011-02-16 18:27:13Z heas $
##
## Copyright (C) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
@@ -43,3 +43,6 @@
endif
install-data-hook:
$(mkinstalldirs) $(DIRS2_CREATE);
+
+distclean-local:
+ -rm -rf $(top_srcdir)/autom4te.cache
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/Makefile.in
^
|
@@ -137,6 +137,7 @@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
@@ -665,7 +666,8 @@
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
+distclean-am: clean-am distclean-generic distclean-local \
+ distclean-tags
dvi: dvi-recursive
@@ -735,23 +737,26 @@
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
- distclean distclean-generic distclean-tags distcleancheck \
- distdir distuninstallcheck dvi dvi-am html html-am info \
- info-am install install-am install-data install-data-am \
- install-data-hook 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-pkgdataDATA install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-pkgdataDATA
+ distclean distclean-generic distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-hook 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-pkgdataDATA install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive uninstall uninstall-am uninstall-pkgdataDATA
@SET_MAKE@
install-data-hook:
$(mkinstalldirs) $(DIRS2_CREATE);
+distclean-local:
+ -rm -rf $(top_srcdir)/autom4te.cache
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/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 2258 2010-10-11 20:49:05Z heas $
+## $Id: Makefile.am 2334 2011-11-17 21:09:37Z heas $
##
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
@@ -53,9 +53,9 @@
brancid cat5rancid clogin control_rancid cssrancid elogin erancid \
f5rancid f10rancid flogin fnlogin fnrancid francid hlogin hrancid \
htlogin htrancid jerancid jlogin jrancid mrancid mrvlogin mrvrancid \
- nlogin nrancid nslogin nsrancid nxrancid par prancid rancid-fe rancid \
- rivlogin rivrancid rrancid srancid tlogin tntlogin tntrancid trancid \
- xrancid xrrancid zrancid
+ mtlogin mtrancid nlogin nrancid nslogin nsrancid nxrancid par prancid \
+ rancid-fe rancid rivlogin rivrancid rrancid srancid tlogin tntlogin \
+ tntrancid trancid xrancid xrrancid zrancid
bin_SCRIPTS += lg.cgi lgform.cgi rancid-cvs rancid-run
EXTRA_DIST= lg.cgi.in lgform.cgi.in rancid-cvs.in rancid-run.in
@@ -100,7 +100,8 @@
-e 's,@MAILPLUS\@,$(MAILPLUS),g' \
-e 's,@PACKAGE\@,$(PACKAGE),g' \
-e 's,@SVN_FSTYPE\@,$(SVN_FSTYPE),g' \
- -e 's,@VERSION\@,$(VERSION),g'
+ -e 's,@VERSION\@,$(VERSION),g' \
+ -e 's,@COPYYEARS\@,$(COPYYEARS),g'
lg.cgi: Makefile $(srcdir)/lg.cgi.in
rm -f lg.cgi lg.cgi.tmp; \
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/Makefile.in
^
|
@@ -55,16 +55,16 @@
$(srcdir)/htlogin.in $(srcdir)/htrancid.in \
$(srcdir)/jerancid.in $(srcdir)/jlogin.in $(srcdir)/jrancid.in \
$(srcdir)/mrancid.in $(srcdir)/mrvlogin.in \
- $(srcdir)/mrvrancid.in $(srcdir)/nlogin.in \
- $(srcdir)/nrancid.in $(srcdir)/nslogin.in \
- $(srcdir)/nsrancid.in $(srcdir)/nxrancid.in $(srcdir)/par.in \
- $(srcdir)/prancid.in $(srcdir)/rancid-fe.in \
- $(srcdir)/rancid.in $(srcdir)/rivlogin.in \
- $(srcdir)/rivrancid.in $(srcdir)/rrancid.in \
- $(srcdir)/srancid.in $(srcdir)/tlogin.in $(srcdir)/tntlogin.in \
- $(srcdir)/tntrancid.in $(srcdir)/trancid.in \
- $(srcdir)/xrancid.in $(srcdir)/xrrancid.in \
- $(srcdir)/zrancid.in
+ $(srcdir)/mrvrancid.in $(srcdir)/mtlogin.in \
+ $(srcdir)/mtrancid.in $(srcdir)/nlogin.in $(srcdir)/nrancid.in \
+ $(srcdir)/nslogin.in $(srcdir)/nsrancid.in \
+ $(srcdir)/nxrancid.in $(srcdir)/par.in $(srcdir)/prancid.in \
+ $(srcdir)/rancid-fe.in $(srcdir)/rancid.in \
+ $(srcdir)/rivlogin.in $(srcdir)/rivrancid.in \
+ $(srcdir)/rrancid.in $(srcdir)/srancid.in $(srcdir)/tlogin.in \
+ $(srcdir)/tntlogin.in $(srcdir)/tntrancid.in \
+ $(srcdir)/trancid.in $(srcdir)/xrancid.in \
+ $(srcdir)/xrrancid.in $(srcdir)/zrancid.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
@@ -77,9 +77,9 @@
clogin rancid cssrancid elogin erancid f5rancid f10rancid \
flogin francid fnlogin fnrancid hlogin hrancid htlogin \
htrancid jlogin jrancid jerancid mrancid mrvlogin mrvrancid \
- nlogin nrancid nslogin nsrancid nxrancid prancid rivlogin \
- rivrancid rrancid srancid tlogin tntlogin tntrancid trancid \
- xrancid xrrancid zrancid
+ mtrancid mtlogin nlogin nrancid nslogin nsrancid nxrancid \
+ prancid rivlogin rivrancid rrancid srancid tlogin tntlogin \
+ tntrancid trancid xrancid xrrancid zrancid
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
@@ -138,6 +138,7 @@
#CFLAGS += -g
CFLAGS = -g -O0
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
@@ -248,10 +249,10 @@
blogin brancid cat5rancid clogin control_rancid cssrancid \
elogin erancid f5rancid f10rancid flogin fnlogin fnrancid \
francid hlogin hrancid htlogin htrancid jerancid jlogin \
- jrancid mrancid mrvlogin mrvrancid nlogin nrancid nslogin \
- nsrancid nxrancid par prancid rancid-fe rancid rivlogin \
- rivrancid rrancid srancid tlogin tntlogin tntrancid trancid \
- xrancid xrrancid zrancid lg.cgi lgform.cgi rancid-cvs \
+ jrancid mrancid mrvlogin mrvrancid mtlogin mtrancid nlogin \
+ nrancid nslogin nsrancid nxrancid par prancid rancid-fe rancid \
+ rivlogin rivrancid rrancid srancid tlogin tntlogin tntrancid \
+ trancid xrancid xrrancid 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)
@@ -285,7 +286,8 @@
-e 's,@MAILPLUS\@,$(MAILPLUS),g' \
-e 's,@PACKAGE\@,$(PACKAGE),g' \
-e 's,@SVN_FSTYPE\@,$(SVN_FSTYPE),g' \
- -e 's,@VERSION\@,$(VERSION),g'
+ -e 's,@VERSION\@,$(VERSION),g' \
+ -e 's,@COPYYEARS\@,$(COPYYEARS),g'
all: all-am
@@ -387,6 +389,10 @@
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mrvrancid: $(top_builddir)/config.status $(srcdir)/mrvrancid.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+mtrancid: $(top_builddir)/config.status $(srcdir)/mtrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+mtlogin: $(top_builddir)/config.status $(srcdir)/mtlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nlogin: $(top_builddir)/config.status $(srcdir)/nlogin.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
nrancid: $(top_builddir)/config.status $(srcdir)/nrancid.in
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/agmrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: agmrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: agmrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -434,7 +434,7 @@
} 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})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "hlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "hlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "hlogin failed for $host: $!\n";
} else {
@@ -509,7 +509,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/alogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: alogin.in 2268 2010-11-16 19:11:59Z heas $
+## $Id: alogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -317,13 +317,13 @@
}
} elseif ![string compare $prog "ssh"] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -377,16 +377,20 @@
expect eof
send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -540,7 +544,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/arancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: arancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: arancid.in 2315 2011-06-24 19:59:32Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -210,6 +210,7 @@
next if (/^\/\* Configuration dump taken/i);
next if (/^\/\* Version.*Base MAC.*/i);
+ next if (/^ *esecret /);
if (/^\/?script end/) {
$found_end = 1;
@@ -227,7 +228,7 @@
# Main
@commandtable = (
- {'/info/sys' => 'ShowVersion'},
+ {'/info/sys/dump' => 'ShowVersion'},
{'/cfg/dump' => 'WriteTerm'}
);
# Use an array to preserve the order of the commands and a hash for mapping
@@ -259,7 +260,7 @@
} else {
print STDERR "executing alogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing alogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "alogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "alogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "alogin failed for $host: $!\n";
} else {
@@ -324,7 +325,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/arrancid.in
^
|
@@ -658,7 +658,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$arista_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$arista_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$arista_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -727,7 +727,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/avologin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: avologin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: avologin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -334,13 +334,13 @@
}
} elseif [string match "ssh*" $prog] {
regexp {ssh(:([^[:space:]]+))*} $prog command suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} else {
@@ -405,16 +405,20 @@
catch {close}; catch {wait};
send_user "\nError: Unknown host $router\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -689,7 +693,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/avorancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: avorancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: avorancid.in 2288 2011-02-17 17:16:50Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -200,6 +200,7 @@
{'cat /etc/network/ifcfg_eth0' => 'CatFile'},
{'cat /etc/network/st_routes' => 'CatFile'},
{'cat /etc/security.opts' => 'CatFile'},
+ {'cat /etc/pmdgrp.conf' => 'CatFile'},
);
# 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.
@@ -221,7 +222,7 @@
} else {
print STDERR "executing avologin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing avologin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "avologin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "avologin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "avologin failed for $host: $!\n";
} else {
@@ -294,7 +295,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/blogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: blogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: blogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -329,13 +329,13 @@
}
} elseif ![string compare $prog "ssh"] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -396,16 +396,20 @@
catch {close}; catch {wait};
send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -624,7 +628,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/brancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: brancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: brancid.in 2279 2011-01-31 22:41:00Z heas $
## hacked version of Hank's rancid - this one tries to deal with Bay's.
##
## @PACKAGE@ @VERSION@
@@ -249,7 +249,7 @@
} else {
print STDERR "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing blogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "blogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "blogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "blogin failed for $host: $!\n";
} else {
@@ -318,7 +318,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/cat5rancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: cat5rancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: cat5rancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -1110,7 +1110,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -1182,7 +1182,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/clogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: clogin.in 2255 2010-10-06 20:31:24Z heas $
+## $Id: clogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -84,23 +84,23 @@
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) ]} {
+if {[info exists env(CISCO_USER)]} {
set default_user $env(CISCO_USER)
-} elseif {[ info exists env(USER) ]} {
+} elseif {[info exists env(USER)]} {
set default_user $env(USER)
-} elseif {[ info exists env(LOGNAME) ]} {
+} 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 ] {
+ 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) ]} {
+if {[info exists env(CLOGINRC)]} {
set password_file $env(CLOGINRC)
}
@@ -116,26 +116,26 @@
} -u* {
if {! [regexp .\[uU\](.+) $arg ignore user]} {
incr i
- set username [ lindex $argv $i ]
+ set username [lindex $argv $i]
}
# VTY Password
} -p* {
if {! [regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
- set userpasswd [ lindex $argv $i ]
+ set userpasswd [lindex $argv $i]
}
set do_passwd 0
# ssh passphrase
} -r* {
- if {! [ regexp .\[rR\](.+) $arg ignore passphrase]} {
+ if {! [regexp .\[rR\](.+) $arg ignore passphrase]} {
incr i
- set vapassphrase [ lindex $argv $i ]
+ set vapassphrase [lindex $argv $i]
}
# VTY Password
} -v* {
if {! [regexp .\[vV\](.+) $arg ignore passwd]} {
incr i
- set passwd [ lindex $argv $i ]
+ set passwd [lindex $argv $i]
}
set do_passwd 0
# Version string
@@ -146,7 +146,7 @@
} -w* {
if {! [regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
- set enausername [ lindex $argv $i ]
+ set enausername [lindex $argv $i]
}
# Environment variable to pass to -s scripts
} -E* {
@@ -160,23 +160,23 @@
} -e* {
if {! [regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
- set enapasswd [ lindex $argv $i ]
+ set enapasswd [lindex $argv $i]
}
set do_enapasswd 0
# Command to run.
} -c* {
if {! [regexp .\[cC\](.+) $arg ignore command]} {
incr i
- set command [ lindex $argv $i ]
+ set command [lindex $argv $i]
}
set do_command 1
# Expect script to run.
} -s* {
if {! [regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
- set sfile [ lindex $argv $i ]
+ set sfile [lindex $argv $i]
}
- if { ! [ file readable $sfile ] } {
+ if { ! [file readable $sfile] } {
send_user "\nError: Can't read $sfile\n"
exit 1
}
@@ -188,27 +188,27 @@
} -y* {
if {! [regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
- set cypher [ lindex $argv $i ]
+ set cypher [lindex $argv $i]
}
# alternate cloginrc file
} -f* {
if {! [regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
- set password_file [ lindex $argv $i ]
+ set password_file [lindex $argv $i]
}
# Timeout
} -t* {
if {! [regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
- set timeoutdflt [ lindex $argv $i ]
+ set timeoutdflt [lindex $argv $i]
}
# Command file
} -x* {
if {! [regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
- set cmd_file [ lindex $argv $i ]
+ set cmd_file [lindex $argv $i]
}
- if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
+ if [catch {set cmd_fd [open $cmd_file r]} reason] {
send_user "\nError: $reason\n"
exit 1
}
@@ -258,7 +258,7 @@
}
# take host from ENV(TERM)
if [info exists env(TERM)] {
- if [ regexp \^(xterm|vs) $env(TERM) ignore ] {
+ if [regexp \^(xterm|vs) $env(TERM) ignore] {
send_user "\033]1;[lindex [split $host "."] 0]\a"
send_user "\033]2;$host\a"
}
@@ -274,7 +274,7 @@
proc include {args} {
global env
regsub -all "(^{|}$)" $args {} args
- if { [ regexp "^/" $args ignore ] == 0 } {
+ if { [regexp "^/" $args ignore] == 0 } {
set args $env(HOME)/$args
}
source_password_file $args
@@ -284,7 +284,7 @@
upvar int_$var list
if { [info exists list] } {
foreach line $list {
- if { [string match [lindex $line 0] $router ] } {
+ if { [string match [lindex $line 0] $router] } {
return [lrange $line 1 end]
}
}
@@ -308,7 +308,7 @@
send_user "\nError: $password_file must not be world readable/writable\n"
exit 1
}
- if [ catch {source $password_file} reason ] {
+ if [catch {source $password_file} reason] {
send_user "\nError: $reason\n"
exit 1
}
@@ -329,9 +329,9 @@
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog methcmd suffix port
if {"$port" == ""} {
- set retval [ catch {spawn telnet $router} reason ]
+ set retval [catch {spawn telnet $router} reason]
} else {
- set retval [ catch {spawn telnet $router $port} reason ]
+ set retval [catch {spawn telnet $router $port} reason]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
@@ -340,16 +340,16 @@
} elseif [string match "ssh*" $prog] {
# ssh to the router & try to login with or without an identfile.
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
if {"$identfile" != ""} {
set cmd "$cmd -i $identfile"
}
- set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
+ set retval [catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -369,7 +369,7 @@
set rshfail 0
for {set i 0} {$i < $num_commands && !$rshfail} { incr i} {
log_user 0
- set retval [ catch {spawn rsh $user@$router [lindex $commands $i] } reason ]
+ set retval [catch {spawn rsh $user@$router [lindex $commands $i] } reason]
if { $retval } {
send_user "\nError: rsh failed: $reason\n"
log_user 1; return 1
@@ -459,6 +459,11 @@
# then it will just send the passwd.
# if telnet fails with connection refused, try ssh
expect {
+ -re "^<-+ More -+>\[^\n\r]*" {
+ # ASA will use the pager for long banners
+ send " ";
+ exp_continue
+ }
-re "(Connection refused|Secure connection \[^\n\r]+ refused)" {
catch {close}; catch {wait};
if !$progs {
@@ -489,18 +494,22 @@
catch {close}; catch {wait};
return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue
}
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
@@ -614,22 +623,10 @@
# command is "set length 0"; otherwise its "terminal length 0".
# skip if its an extreme (since the pager can not be disabled on a
# per-vty basis).
- if { [ string compare "extreme" "$platform" ] } {
- if [ regexp -- ".*> .*enable" "$prompt" ] {
- send "set length 0\r"
- # This is ugly, but reduces code duplication, allowing the
- # subsequent expects to handle everything as normal.
- set command "set logging session disable;$command"
- } else {
- send "terminal length 0\r"
- }
+ if { [string compare "extreme" "$platform"] } {
# match cisco config mode prompts too, such as router(config-if)#,
# but catalyst does not change in this fashion.
regsub -all {^(.{1,11}).*([#>])$} $prompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
- expect {
- -re $reprompt {}
- -re "\[\n\r]+" { exp_continue }
- }
} else {
set reprompt $prompt
}
@@ -640,8 +637,8 @@
set commands [split $command \;]
set num_commands [llength $commands]
# the pager can not be turned off on the PIX, so we have to look
- # for the "More" prompt. the extreme is equally obnoxious, with a
- # global switch in the config.
+ # for the "More" prompt. the extreme is equally obnoxious in pre-12.3 XOS,
+ # with a global switch in the config.
for {set i 0} {$i < $num_commands} { incr i} {
send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
@@ -655,7 +652,7 @@
send " "
exp_continue
}
- -re "\[\n\r]+" { send_user -- "$expect_out(buffer)"
+ -re "\[^\r\n]*\[\n\r]+" { send_user -- "$expect_out(buffer)"
exp_continue
}
-re "\[^\r\n]*Press <SPACE> to cont\[^\r\n]*" {
@@ -677,7 +674,7 @@
}
log_user 1
- if { [ string compare "extreme" "$platform" ] } {
+ if { [string compare "extreme" "$platform"] } {
send -h "exit\r"
} else {
send -h "quit\r"
@@ -852,7 +849,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
@@ -903,27 +900,33 @@
regsub -all "\[\]\[\(\)]" $junk {\\&} prompt;
}
}
-
+ if { $do_command || $do_script } {
+ if { [ string compare "extreme" "$platform" ] } {
+ # If the prompt is (enable), then we are on a switch and the
+ # command is "set length 0"; otherwise its "terminal length 0".
+ if [regexp -- ".*> .*enable" "$prompt"] {
+ send "set length 0\r"
+ expect -re $prompt {}
+ send "set width 132\r"
+ expect -re $prompt {}
+ send "set logging session disable\r"
+ } else {
+ send "terminal length 0\r"
+ expect -re $prompt {}
+ send "terminal width 132\r"
+ }
+ expect -re $prompt {}
+ } else {
+ send "disable clipaging\r"
+ expect -re $prompt {}
+ }
+ }
if { $do_command } {
if {[run_commands $prompt $command]} {
incr exitval
continue
}
} elseif { $do_script } {
- # If the prompt is (enable), then we are on a switch and the
- # command is "set length 0"; otherwise its "terminal length 0".
- if [ regexp -- ".*> .*enable" "$prompt" ] {
- send "set length 0\r"
- expect -re $prompt {}
- send "set width 80\r"
- expect -re $prompt {}
- send "set logging session disable\r"
- } else {
- send "terminal length 0\r"
- expect -re $prompt {}
- send "terminal width 80\r"
- }
- expect -re $prompt {}
source $sfile
catch {close};
} else {
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/cssrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: cssrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: cssrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -612,7 +612,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -688,7 +688,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/elogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: elogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: elogin.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/erancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: erancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: erancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -266,7 +266,7 @@
} else {
print STDERR "executing elogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing elogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "elogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "elogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "elogin failed for $host: $!\n";
} else {
@@ -338,7 +338,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/f10rancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: f10rancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: f10rancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -604,7 +604,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -676,7 +676,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/f5rancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: f5rancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: f5rancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -557,7 +557,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -629,7 +629,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/flogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: flogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: flogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -335,13 +335,13 @@
}
} elseif ![string compare $prog "ssh"] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -419,16 +419,20 @@
catch {close}; catch {wait};
send_user "\nError: Unknown host $router\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send -h "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send -h "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send -h "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -518,7 +522,7 @@
set commands [split $command \;]
set num_commands [llength $commands]
for {set i 0} {$i < $num_commands} { incr i} {
- send -h -- "[subst [lindex $commands $i]]\r"
+ send -h -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
-re "^\[^\n\r]*$prompt." { exp_continue }
-re "^\[^\n\r *]*$prompt" {}
@@ -659,7 +663,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/fnlogin.in
^
|
@@ -6,7 +6,7 @@
## adapted by: Diego Ercolani <diego.ercolani at ssis.sm>
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -302,15 +302,13 @@
}
} elseif [string match "ssh*" $prog] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
+ set cmd $sshcmd
if {"$port" == ""} {
- set cmd [join [lindex $sshcmd 0] " "]
- set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
- } else {
- set cmd [join [lindex $sshcmd 0] " "]
- set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user -p $port $router" { }]} reason ]
+ set cmd "$cmd -p $port"
}
+ set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -385,17 +383,21 @@
catch {close}; catch {wait};
return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
@@ -443,7 +445,7 @@
set in_proc 1
# Disable output paging.
- send -- "config system console\r"
+ send -- "config system console\r"
expect -re $prompt; send -- "set output standard\r"
expect -re $prompt; send -- "end\r"
expect -re $prompt;
@@ -451,8 +453,7 @@
set commands [split $command \;]
set num_commands [llength $commands]
for {set i 0} {$i < $num_commands} { incr i} {
- send -- "[subst [lindex $commands $i]]\r"
-# send_user "**************** [subst [lindex $commands $i]] ************\n"
+ send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
-re "$prompt" { send "\r"
sleep 0.5
@@ -462,24 +463,23 @@
-re "\[\n\r]+" { exp_continue }
}
}
- }
-# send_user "******* fuori da ciclo for *******\n"
+ }
expect {
- -re "$prompt$" {
+ -re "$prompt$" {
send "exit\r"
sleep 0.5
exp_continue
}
- -re "\[\n\r]+" { exp_continue }
- -gl "Configuration modified, save?" {
+ -re "\[\n\r]+" { exp_continue }
+ -gl "Configuration modified, save?" {
send "n\r"
exp_continue
}
- timeout { catch {close}; catch {wait};
+ timeout { catch {close}; catch {wait};
return 0
}
- eof { return 0 }
- }
+ eof { return 0 }
+ }
set in_proc 0
}
@@ -543,7 +543,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
@@ -552,7 +552,8 @@
continue
}
- # we are logged in, now figure out the full prompt based on what the device sends us.
+ # we are logged in, now figure out the full prompt based on what the
+ # device sends us.
send "\r"
expect {
-re "\[\r\n]+" { exp_continue; }
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/fnrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: fnrancid.in 2258 2010-10-11 20:49:05Z heas $
+## $Id: fnrancid.in 2283 2011-02-04 23:15:07Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -175,12 +175,12 @@
next if /^\s*$/;
last if (/$prompt/);
- next if (/^System Time:/);
+ next if (/^system time:/i);
next if (/^\s*Virus-DB: .*/);
next if (/^\s*Extended DB: .*/);
next if (/^\s*IPS-DB: .*/);
next if (/^FortiClient application signature package:/);
- ProcessHistory("","","","!$_");
+ ProcessHistory("","","","#$_");
}
ProcessHistory("SYSTEM","","","\n");
return(0);
@@ -207,11 +207,11 @@
# System time is fortigate extraction time
next if (/^\s*!System time:/);
# remove occurrances of conf_file_ver
- next if (/^conf_file_ver=/);
+ next if (/^#?conf_file_ver=/);
# filter variabilities between configurations. password encryption
# upon each display of the configuration.
if (/^\s*(set [^\s]*)\s(Enc\s[^\s]+)(.*)/i && $filter_pwds > 0 ) {
- ProcessHistory("ENC","","","!$1 ENC <removed> $3\n");
+ ProcessHistory("ENC","","","#$1 ENC <removed> $3\n");
next;
}
ProcessHistory("","","","$_");
@@ -257,7 +257,7 @@
} else {
print STDERR "executing fnlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing fnlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "fnlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "fnlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "fnlogin failed for $host: $!\n";
} else {
@@ -285,7 +285,7 @@
$filter_pwds = 1;
}
-ProcessHistory("","","","!RANCID-CONTENT-TYPE: fortigate\n\n");
+ProcessHistory("","","","#RANCID-CONTENT-TYPE: fortigate\n\n");
TOP: while(<INPUT>) {
tr/\015//d;
if (/^Error:/) {
@@ -334,7 +334,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/francid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: francid.in 2248 2010-09-30 19:20:18Z heas $
+## $Id: francid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -451,7 +451,7 @@
} else {
print STDERR "executing flogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing flogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "flogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "flogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "flogin failed for $host: $!\n";
} else {
@@ -520,7 +520,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/hlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: hlogin.in 2251 2010-10-01 19:26:36Z heas $
+## $Id: hlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -339,7 +339,7 @@
} elseif [string match "ssh*" $prog] {
# ssh to the router & try to login with or without an identfile.
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
@@ -348,7 +348,7 @@
}
set retval [ catch {eval spawn hpuifilter -- [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -396,6 +396,10 @@
send " "
exp_continue
}
+ "Enter switch number to connect to or <CR>:" {
+ send "\r"
+ exp_continue
+ }
-re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by)" {
catch {close}; catch {wait};
if !$progs {
@@ -410,16 +414,20 @@
catch {close}; catch {wait};
send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -563,7 +571,7 @@
}
}
log_user 1
- send -h "exit\r"
+ send -h "logout\r"
expect {
"Do you want to save current configuration" {
if {$do_saveconfig} {
@@ -732,7 +740,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Adjust our path to find hpuifilter
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/hrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: hrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: hrancid.in 2328 2011-10-31 18:05:46Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -168,6 +168,22 @@
&ipaddrval($a) <=> &ipaddrval($b);
}
+# This routine parses "show config files"
+sub ShowConfigFiles {
+ print STDERR " In ShowConfigFiles: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
+ return(1) if /^(Invalid|Ambiguous) input:/i;
+
+ ProcessHistory("COMMENTS","keysort","H0",";$_");
+ }
+ return(0);
+}
+
# This routine parses "show version"
sub ShowVersion {
print STDERR " In ShowVersion: $_" if ($debug);
@@ -283,15 +299,56 @@
return(0);
}
+# This routine parses "show tech transceivers"
+sub ShowTechTransceivers {
+ print STDERR " In ShowTransceivers: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
+ return(1) if /^(Invalid|Ambiguous) input:/i;
+
+ s/ Technical Information//i;
+
+ ProcessHistory("COMMENTS","keysort","G0",";$_");
+ }
+ return(0);
+}
+
+# This routine parses "show config status"
+sub ShowConfigStatus {
+ print STDERR " In ShowConfigStatus: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
+ return(1) if /^(Invalid|Ambiguous) input:/i;
+
+ next if (/^Running configuration is same as /);
+ next if (/^$/);
+
+ ProcessHistory("COMMENTS","keysort","H0","; $_");
+ }
+ return(0);
+}
+
# This routine processes a "write term"
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
while (<INPUT>) {
tr/\015//d;
+ if (/$prompt\s*(exit|logout)\s*$/i) {
+ $clean_run=1;
+ last;
+ }
last if(/^$prompt/);
return(-1) if (/command authorization failed/i);
- # the pager can not be disabled per-session on the PIX
+ # the pager can not be disabled per-session
s/^<-+ More -+>\s*//;
s/^$/;/;
@@ -302,6 +359,7 @@
s/\$(Revision|Id):/ $1:/;
/^; (\S+) configuration editor;/i &&
ProcessHistory("COMMENTS","keysort","A0",";Chassis type: $1\n") &&
+ ProcessHistory("","","",";\n;Running config file:\n$_") &&
next;
# order logging statements - doesnt appear to do syslog as of right now
@@ -474,6 +532,9 @@
{'show system information' => 'ShowSystem'},
{'show module' => 'ShowModule'},
{'show stack' => 'ShowStack'},
+ {'show tech transceivers' => 'ShowTechTransceivers'},
+ {'show config files' => 'ShowConfigFiles'},
+ {'show config status' => 'ShowConfigStatus'},
{'write term' => 'WriteTerm'}
);
# Use an array to preserve the order of the commands and a hash for mapping
@@ -505,7 +566,7 @@
} 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})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "hlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "hlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "hlogin failed for $host: $!\n";
} else {
@@ -539,10 +600,12 @@
ProcessHistory("COMMENTS","keysort","D0",";\n"); # showflash
ProcessHistory("COMMENTS","keysort","E0",";\n"); # showmodule
ProcessHistory("COMMENTS","keysort","F0",";\n"); # showstack
-ProcessHistory("COMMENTS","keysort","G0",";\n");
+ProcessHistory("COMMENTS","keysort","G0",";\n"); # showtechtransceivers
+ProcessHistory("COMMENTS","keysort","H0",";\n"); # showconfigfiles
+ProcessHistory("COMMENTS","keysort","I0",";\n");
TOP: while(<INPUT>) {
tr/\015//d;
- if (/$prompt\s*exit\s*$/i) {
+ if (/$prompt\s*(exit|logout)\s*$/i) {
$clean_run=1;
last;
}
@@ -581,7 +644,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/htlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: htlogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: htlogin.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/htrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: htrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: htrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -227,7 +227,7 @@
} else {
print STDERR "executing htlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing htlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "htlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "htlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "htlogin failed for $host: $!\n";
} else {
@@ -294,7 +294,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/jerancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: jerancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: jerancid.in 2336 2011-11-17 21:13:20Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -444,14 +444,16 @@
# ftp host encrypted password oscillates
if (/^(host \S+ \S+ ftp) /) {
+ my($prefix) = $1;
if ($filter_pwds >= 1 || /^host \S+ \S+ ftp \d /) {
- ProcessHistory("","","","!$1 <removed>\n"); next;
+ ProcessHistory("","","","!$prefix <removed>\n"); next;
}
}
# mpls ldp encrypted password oscillates
if (/^(mpls ldp neighbor \S+ password)/) {
+ my($prefix) = $1;
if ($filter_pwds >= 1 || /^mpls ldp neighbor \S+ password \d /) {
- ProcessHistory("","","","!$1 <removed>\n"); next;
+ ProcessHistory("","","","!$prefix <removed>\n"); next;
}
}
@@ -629,7 +631,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$jnxe_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$jnxe_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$jnxe_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -701,7 +703,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/jlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: jlogin.in 2252 2010-10-01 19:27:02Z heas $
+## $Id: jlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -307,7 +307,7 @@
# We use two calls to spawn since spawn does not seem to parse
# spaces correctly.
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
@@ -385,15 +385,18 @@
sleep 1
send -- "$passphrase\r"
exp_continue }
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1 }
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1 }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1 }
@@ -525,7 +528,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/jrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: jrancid.in 2267 2010-11-12 00:04:58Z heas $
+## $Id: jrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -688,7 +688,7 @@
print(STDERR "executing echo jlogin -t $timeo -c\"$jnx_commands\" $host\n") if ($debug);
print(STDOUT "executing echo jlogin -t $timeo -c\"$jnx_commands\" $host\n") if ($debug);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "jlogin -t $timeo -c \"$jnx_commands\" $host </dev/null > $host.raw" || die "jlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "jlogin failed for $host: $!\n";
} else {
@@ -770,7 +770,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/lg.cgi.in
^
|
@@ -1,9 +1,9 @@
#! @PERLV_PATH@
##
-## $Id: lg.cgi.in 2096 2009-06-17 21:49:46Z heas $
+## $Id: lg.cgi.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/lgform.cgi.in
^
|
@@ -1,9 +1,9 @@
#! @PERLV_PATH@
##
-## $Id: lgform.cgi.in 2096 2009-06-17 21:49:46Z heas $
+## $Id: lgform.cgi.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/mrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: mrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: mrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -365,7 +365,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -432,7 +432,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/mrvlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: mrvlogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: mrvlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -336,7 +336,7 @@
}
} elseif [string match "ssh*" $prog] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
@@ -410,18 +410,22 @@
catch {close}; catch {wait};
return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue
}
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
@@ -726,7 +730,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/mrvrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: mrvrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: mrvrancid.in 2368 2012-01-30 19:02:16Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -202,6 +202,7 @@
# This routine parses "show chassis" for the gsr
# This will create arrays for hw info.
sub ShowChassis {
+ my($newfmt) = 0;
# Skip if this is not a 1200n.
print STDERR " In ShowChassis: $_" if ($debug);
@@ -212,13 +213,22 @@
return(1) if /(Invalid input detected|Type help or )/;
return(-1) if (/command authorization failed/i);
+ s/\s+$//;
+ $newfmt = 1 if (/\s+Serial Num$/);
+
if (/Chassis +Model/ || /=======/) {
- ProcessHistory("COMMENTS","keysort","C1","!$_");
+ ProcessHistory("COMMENTS","keysort","C1","!$_\n");
next;
}
# Trim the temp from the end of the slot line
- chomp; s/\s+$//;
- s/\S+$//;
+ if ($newfmt) {
+ s/(-?\d+)(\s+\w+)$//;
+ my($fmt) = "%-" . length($1) . "s";
+ $_ = $_ . sprintf($fmt, "") . $2;
+ } else {
+ # the old format
+ s/\S+$//;
+ }
ProcessHistory("COMMENTS","keysort","C1","!$_\n");
}
ProcessHistory("COMMENTS","","","!\n");
@@ -436,7 +446,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "mrvlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -507,7 +517,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Added |
rancid-2.3.8.tar.bz2/bin/mtlogin.in
^
|
@@ -0,0 +1,552 @@
+#! @EXPECT_PATH@ --
+##
+## $Id$
+##
+## @PACKAGE@ @VERSION@
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
+##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
+#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
+# mtlogin - MikroTik router login
+#
+# bootc@bootc.net wrote this (Chris Boot)
+#
+
+# Usage line
+set usage "Usage: $argv0 \[-dV\] \[-c command\] \
+\[-Evar=x\] \[-f cloginrc-file\] \
+\[-s script-file\] \[-t timeout\] \[-u username\] \
+\[-v vty-password\] \[-x command-file\] \
+\[-y ssh_cypher_type\] router \[router...\]\n"
+
+# env(CLOGIN) may contain:
+# x == do not set xterm banner or name
+
+# Password file
+set password_file $env(HOME)/.cloginrc
+# Default is to login to the router
+set do_command 0
+set do_script 0
+# The default is to automatically enable
+set avenable 1
+# The default is that you login non-enabled (tacacs can have you login already
+# enabled)
+set avautoenable 0
+# The default is to look in the password file to find the passwords. This
+# tracks if we receive them on the command line.
+set do_passwd 1
+# Sometimes routers take awhile to answer (the default is 10 sec)
+set timeout 45
+
+# 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)
+}
+
+# Process the command line
+for {set i 0} {$i < $argc} {incr i} {
+ set arg [lindex $argv $i]
+
+ switch -glob -- $arg {
+ # Expect debug mode
+ -d* {
+ exp_internal 1
+ # Username
+ } -u* -
+ -U* {
+ if {! [ regexp .\[uU\](.+) $arg ignore user]} {
+ incr i
+ set username [ lindex $argv $i ]
+ }
+ # VTY Password
+ } -v* {
+ if {! [ regexp .\[vV\](.+) $arg ignore passwd]} {
+ incr i
+ set passwd [ lindex $argv $i ]
+ }
+ set do_passwd 0
+ # Version string
+ } -V* {
+ send_user "rancid 2.3.2a9\n"
+ exit 0
+ # Enable Username
+ } -w* -
+ -W* {
+ # ignore -w
+ # Environment variable to pass to -s scripts
+ } -E*
+ {
+ if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
+ incr i
+ set E$varname $varvalue
+ } else {
+ send_user "\nError: invalid format for -E in $arg\n"
+ exit 1
+ }
+ # Enable Password
+ } -e*
+ {
+ # ignore -e
+ # Command to run.
+ } -c* -
+ -C* {
+ if {! [ regexp .\[cC\](.+) $arg ignore command]} {
+ incr i
+ set command [ lindex $argv $i ]
+ }
+ set do_command 1
+ # Expect script to run.
+ } -s* -
+ -S* {
+ if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
+ incr i
+ set sfile [ lindex $argv $i ]
+ }
+ if { ! [ file readable $sfile ] } {
+ send_user "\nError: Can't read $sfile\n"
+ exit 1
+ }
+ set do_script 1
+ # 'ssh -c' cypher type
+ } -y* -
+ -Y* {
+ if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
+ incr i
+ set cypher [ lindex $argv $i ]
+ }
+ # alternate cloginrc file
+ } -f* -
+ -F* {
+ if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ incr i
+ set password_file [ lindex $argv $i ]
+ }
+ # Timeout
+ } -t* -
+ -T* {
+ if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
+ incr i
+ set timeout [ lindex $argv $i ]
+ }
+ # Command file
+ } -x* -
+ -X {
+ if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr i
+ set cmd_file [ lindex $argv $i ]
+ }
+ if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
+ send_user "\nError: $reason\n"
+ exit 1
+ }
+ set cmd_text [read $cmd_fd]
+ close $cmd_fd
+ set command [join [split $cmd_text \n] \;]
+ set do_command 1
+ # Do we enable?
+ } -noenable {
+ # ignore -noenable
+ # Does tacacs automatically enable us?
+ } -autoenable {
+ # ignore -autoenable
+ } -* {
+ send_user "\nError: Unknown argument! $arg\n"
+ send_user $usage
+ exit 1
+ } default {
+ break
+ }
+ }
+}
+# Process routers...no routers listed is an error.
+if { $i == $argc } {
+ send_user "\nError: $usage"
+}
+
+# Only be quiet if we are running a script (it can log its output
+# on its own)
+if { $do_script } {
+ log_user 0
+} else {
+ log_user 1
+}
+
+#
+# Done configuration/variable setting. Now run with it...
+#
+
+# Sets Xterm title if interactive...if its an xterm and the user cares
+proc label { host } {
+ global env
+ # if CLOGIN has an 'x' in it, don't set the xterm name/banner
+ if [info exists env(CLOGIN)] {
+ if {[string first "x" $env(CLOGIN)] != -1} { return }
+ }
+ # take host from ENV(TERM)
+ if [info exists env(TERM)] {
+ if [regexp \^(xterm|vs) $env(TERM) ignore ] {
+ send_user "\033]1;[lindex [split $host "."] 0]\a"
+ send_user "\033]2;$host\a"
+ }
+ }
+}
+
+# This is a helper function to make the password file easier to
+# maintain. 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 int_$var ; lappend int_$var $args}
+proc include {args} {
+ global env
+ regsub -all "(^{|}$)" $args {} args
+ if { [ regexp "^/" $args ignore ] == 0 } {
+ set args $env(HOME)/$args
+ }
+ source_password_file $args
+}
+
+proc find {var router} {
+ upvar int_$var list
+ if { [info exists list] } {
+ foreach line $list {
+ if { [string match [lindex $line 0] $router ] } {
+ return [lrange $line 1 end]
+ }
+ }
+ }
+ return {}
+}
+
+# Loads the password file. Note that as this file is tcl, and that
+# it is sourced, the user better know what to put in there, as it
+# 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 { password_file } {
+ global env
+ if { ! [file exists $password_file] } {
+ send_user "\nError: password file ($password_file) does not exist\n"
+ exit 1
+ }
+ file stat $password_file fileinfo
+ if { [expr ($fileinfo(mode) & 007)] != 0000 } {
+ send_user "\nError: $password_file must not be world readable/writable\n"
+ exit 1
+ }
+ if [ catch {source $password_file} reason ] {
+ send_user "\nError: $reason\n"
+ exit 1
+ }
+}
+
+# Log into the router.
+# returns: 0 on success, 1 on failure
+proc login { router user userpswd passwd prompt cmethod cyphertype } {
+ global spawn_id in_proc do_command do_script
+ global u_prompt p_prompt sshcmd
+ set in_proc 1
+ set uprompt_seen 0
+
+ # try each of the connection methods in $cmethod until one is successful
+ set progs [llength $cmethod]
+ foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
+ if [string match "telnet*" $prog] {
+ regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
+ if {"$port" == ""} {
+ set retval [ catch {spawn telnet $router} reason ]
+ } else {
+ set retval [ catch {spawn telnet $router $port} reason ]
+ }
+ if { $retval } {
+ send_user "\nError: telnet failed: $reason\n"
+ return 1
+ }
+ } elseif ![string compare $prog "ssh"] {
+ if [ catch {spawn $sshcmd -c $cyphertype -x -l $user+ct $router} reason ] {
+ send_user "\nError: $sshcmd failed: $reason\n"
+ return 1
+ }
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue;
+ } else {
+ send_user "\nError: unknown connection method: $prog\n"
+ return 1
+ }
+ sleep 0.3
+
+ # This helps cleanup each expect clause.
+ expect_after {
+ timeout {
+ send_user "\nError: TIMEOUT reached\n"
+ catch {close}; catch {wait};
+ if { $in_proc} {
+ return 1
+ } else {
+ continue
+ }
+ } eof {
+ send_user "\nError: EOF received\n"
+ catch {close}; catch {wait};
+ if { $in_proc} {
+ return 1
+ } else {
+ continue
+ }
+ }
+ }
+
+ expect {
+ "Connection refused" {
+ catch {close}; catch {wait};
+ sleep 0.3
+ expect eof
+ send_user "\nError: Connection Refused\n"; wait; return 1
+ } eof { send_user "\nError: Couldn't login\n"; wait; return 1
+ } "Unknown host\r\n" {
+ expect eof
+ send_user "\nError: Unknown host\n"; wait; return 1
+ } "Host is unreachable" {
+ expect eof
+ send_user "\nError: Host Unreachable!\n"; wait; return 1
+ } "No address associated with name" {
+ expect eof
+ send_user "\nError: Unknown host\n"; wait; return 1
+ }
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
+ send "yes\r"
+ send_user "\nHost $router added to the list of known hosts.\n"
+ exp_continue }
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
+ send "no\r"
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1 }
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
+ send "no\r"
+ send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
+ return 1 }
+
+ -re "$u_prompt" {
+ send -- "$user+ct\r"
+ set uprompt_seen 1
+ exp_continue
+ }
+ -re "$p_prompt" {
+ sleep 1
+ if {$uprompt_seen == 1} {
+ send -- "$userpswd\r"
+ } else {
+ send -- "$passwd\r"
+ }
+ exp_continue
+ }
+ -re "^Confirm seeing above note" {
+ send "y\r"
+ exp_continue
+ }
+ "Password incorrect" { send_user "\nError: Check your password for $router\n";
+ catch {close}; catch {wait}; return 1 }
+ -re "$prompt" { break; }
+ denied { send_user "\nError: Check your passwd for $router\n"
+ catch {close}; catch {wait}; return 1
+ }
+ "\r\n" { exp_continue; }
+ }
+ }
+ set in_proc 0
+ return 0
+}
+
+# Run commands given on the command line.
+proc run_commands { prompt command } {
+ global in_proc
+ set in_proc 1
+
+ regsub -all "\[)(]" $prompt {\\&} reprompt
+
+ set commands [split $command \;]
+ set num_commands [llength $commands]
+ for {set i 0} {$i < $num_commands} { incr i} {
+ send -- "[subst -nocommands [lindex $commands $i]]\r"
+ expect {
+ -re "^\[^\n\r]*$reprompt" {}
+ -re "^\[^\n\r ]*>>.*$reprompt" { exp_continue }
+ -re "\[\n\r]+" { exp_continue }
+ }
+ }
+ send "quit\r"
+ expect {
+ -re "^WARNING: There are unsaved configuration changes." {
+ send "y\r"
+ exp_continue
+ }
+ "\n" { exp_continue }
+ "\[^\n\r *]*Session terminated" { return 0 }
+ timeout { catch {close}; catch {wait};
+ return 0
+ }
+ eof { return 0 }
+ }
+ set in_proc 0
+}
+
+#
+# For each router... (this is main loop)
+#
+source_password_file $password_file
+set in_proc 0
+set exitval 0
+foreach router [lrange $argv $i end] {
+ set router [string tolower $router]
+ send_user "$router\n"
+
+ # Figure out prompt.
+ set prompt "] > "
+ # alteon only "enables" based on the password used at login time
+ set autoenable 1
+ set enable 0
+
+ # Figure out passwords
+ if { $do_passwd } {
+ set pswd [find password $router]
+ if { [llength $pswd] == 0 } {
+ send_user "\nError - no password for $router in $password_file.\n"
+ continue
+ }
+ set passwd [join [lindex $pswd 0] ""]
+ }
+
+ # Figure out username
+ if {[info exists username]} {
+ # command line username
+ set ruser $username
+ } else {
+ set ruser [join [find user $router] ""]
+ if { "$ruser" == "" } { set ruser $default_user }
+ }
+
+ # Figure out username's password (if different from the vty password)
+ if {[info exists userpasswd]} {
+ # command line username
+ set userpswd $userpasswd
+ } else {
+ set userpswd [join [find userpassword $router] ""]
+ if { "$userpswd" == "" } { set userpswd $passwd }
+ }
+
+ # Figure out prompts
+ set u_prompt [find userprompt $router]
+ if { "$u_prompt" == "" } {
+ set u_prompt "Login:"
+ } else {
+ set u_prompt [join [lindex $u_prompt 0] ""]
+ }
+ set p_prompt [find passprompt $router]
+ if { "$p_prompt" == "" } {
+ set p_prompt "\[Pp]assword:"
+ } else {
+ set p_prompt [join [lindex $p_prompt 0] ""]
+ }
+
+ # Figure out cypher type
+ if {[info exists cypher]} {
+ # command line cypher type
+ set cyphertype $cypher
+ } else {
+ set cyphertype [find cyphertype $router]
+ if { "$cyphertype" == "" } { set cyphertype "3des" }
+ }
+
+ # Figure out connection method
+ set cmethod [find method $router]
+ if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
+
+ # Figure out the SSH executable name
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
+
+ # Login to the router
+ if {[login $router $ruser $userpswd $passwd $prompt $cmethod $cyphertype]} {
+ incr exitval
+ continue
+ }
+
+ if { $do_command } {
+ if {[run_commands $prompt $command]} {
+ incr exitval
+ continue
+ }
+ } elseif { $do_script } {
+ source $sfile
+ catch {close};
+ } else {
+ label $router
+ log_user 1
+ interact
+ }
+
+ # End of for each router
+ catch {wait};
+ sleep 0.3
+}
+exit $exitval
|
[-]
[+]
|
Added |
rancid-2.3.8.tar.bz2/bin/mtrancid.in
^
|
@@ -0,0 +1,354 @@
+#! @PERLV_PATH@
+##
+## $Id$
+##
+## @PACKAGE@ @VERSION@
+## Copyright (C) 1997-2011 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.
+##
+#
+# RANCID - Really Awesome New Cisco confIg Differ
+#
+# usage: rancid [-dV] [-l] [-f filename | $host]
+#
+# Modified by Chris Boot for MikroTik.
+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;
+$timeo = 90; # clogin timeout in seconds
+$clogin_pgm= $ENV{'RANCID_CLOGIN'} || "mtlogin";
+
+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))
+ && scalar(%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 SystemPackagePrintDetail {
+ print STDERR " In SystemPackagePrintDetail: $_" if ($debug);
+ my $buffer = "";
+ my %packages = ();
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/$prompt/);
+ next if(/^Flags:/);
+ return(1) if /(bad command name )/;
+
+ s/^\s+//g;
+ s/^\d+\s+//g;
+ s/\s+$//g;
+
+ if (/^$/) {
+ if ($buffer =~ /name="(.+)"/) {
+ $packages{$1} = $buffer;
+ }
+ $buffer = "";
+ } else {
+ $buffer .= "$_ ";
+ }
+ }
+
+ if ($buffer =~ /name="(.+)"/) {
+ $packages{$1} = $buffer;
+ }
+
+ for my $name (sort keys %packages) {
+ ProcessHistory("COMMENTS","keysort","A1","# " . $packages{$name} . "\n");
+ }
+
+ return(0);
+}
+
+sub SystemRouterboardPrint {
+ print STDERR " In SystemRouterboardPrint: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /(bad command name )/;
+ s/^\s+//g;
+
+ ProcessHistory("COMMENTS","keysort","C1","# $_");
+ }
+
+ return(0);
+}
+
+sub SystemLicensePrint {
+ print STDERR " In SystemLicensePrint: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /(bad command name )/;
+ s/^\s+//g;
+
+ ProcessHistory("COMMENTS","keysort","E1","# $_");
+ }
+
+ return(0);
+}
+
+sub Export {
+ print STDERR " In Export: $_" if ($debug);
+ my $buffer = "";
+
+ while (<INPUT>) {
+ tr/\015//d;
+ if (/$prompt/) { $found_end=1; $clean_run=1; return 0};
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ next if(/^#/);
+ return(1) if /(bad command name )/;
+ s/^\s+//g;
+
+ # RouterOS splits long lines with backslashes - this joins them
+ # back up
+ if (/\\\n$/) {
+ s/\s*\\\n$//;
+ $buffer .= $_;
+ if (!/=$/ && !/="[^"]+$/ ) {
+ $buffer .= " ";
+ }
+ } else {
+ $buffer .= $_;
+
+ # Fix quoted strings
+ $buffer =~ s/(\S+)="(\S+)"/$1=$2/g;
+
+ ProcessHistory("","","","$buffer");
+ $buffer = "";
+ }
+ }
+}
+
+# Main
+@commandtable=(
+ {'system package print detail without-paging' => "SystemPackagePrintDetail"},
+ {'system routerboard print' => "SystemRouterboardPrint"},
+ {'system license print' => "SystemLicensePrint"},
+ {'export' => "Export"},
+);
+
+# Use array to preserve order of commands, and hash for mapping to subroutine
+my (%commands, @commands);
+foreach (@commandtable) {
+ push @commands, (keys(%{$_}))[0];
+ $commands{$commands[$#commands]}= (values(%{$_}))[0];
+};
+
+$cisco_cmds=join(";",@commands);
+$cmds_regexp=join("|",@commands);
+
+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 $clogin_pgm -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
+ print STDOUT "executing $clogin_pgm -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
+ if (defined($ENV{NOPIPE})) {
+ system "$clogin_pgm -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "$clogin_pgm failed for $host: $!\n";
+ open(INPUT, "< $host.raw") || die "$clogin_pgm failed for $host: $!\n";
+ } else {
+ open(INPUT,"$clogin_pgm -t $timeo -c \"$cisco_cmds\" $host </dev/null |") || die "$clogin_pgm failed for $host: $!\n";
+ }
+}
+
+# determine password filtering mode
+if ($ENV{"FILTER_PWDS"} =~ /no/i) {
+ $filter_pwds = 0;
+} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
+ $filter_pwds = 2;
+} else {
+ $filter_pwds = 1;
+}
+
+ProcessHistory("","","","#RANCID-CONTENT-TYPE: mikrotik\n#\n");
+ProcessHistory("COMMENTS","keysort","B0","#\n");
+ProcessHistory("COMMENTS","keysort","D0","#\n");
+ProcessHistory("COMMENTS","keysort","F0","#\n");
+ProcessHistory("COMMENTS","keysort","G0","#\n");
+TOP: while(<INPUT>) {
+ tr/\015//d;
+ if (/[>#]\s*quit$/) {
+ $clean_run=1;
+ last;
+ }
+ if (/^Error:/) {
+ print STDOUT ("$host $clogin_pgm error: $_");
+ print STDERR ("$host $clogin_pgm error: $_") if ($debug);
+ $clean_run=0;
+ last;
+ }
+ while (/\s*($cmds_regexp)\s*$/) {
+ $cmd = $1;
+ if (!defined($prompt)) {
+ $prompt = "\] > "; # crude but effective
+ 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;
+ }
+ }
+}
+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 "$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);
+}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/nlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: nlogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: nlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -77,23 +77,23 @@
set timeoutdflt 45
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ]} {
+if {[info exists env(CISCO_USER)]} {
set default_user $env(CISCO_USER)
-} elseif {[ info exists env(USER) ]} {
+} elseif {[info exists env(USER)]} {
set default_user $env(USER)
-} elseif {[ info exists env(LOGNAME) ]} {
+} 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 ] {
+ 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) ]} {
+if {[info exists env(CLOGINRC)]} {
set password_file $env(CLOGINRC)
}
@@ -107,15 +107,15 @@
exp_internal 1
# Username
} -u* {
- if {! [ regexp .\[uU\](.+) $arg ignore user]} {
+ if {! [regexp .\[uU\](.+) $arg ignore user] } {
incr i
- set username [ lindex $argv $i ]
+ set username [lindex $argv $i]
}
# VTY Password
} -p* {
- if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
+ if {! [regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
- set userpasswd [ lindex $argv $i ]
+ set userpasswd [lindex $argv $i]
}
set do_passwd 0
# ssh passphrase
@@ -123,7 +123,7 @@
# ignore -r
# Environment variable to pass to -s scripts
} -E* {
- if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
+ if {[regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
send_user "\nError: invalid format for -E in $arg\n"
@@ -131,18 +131,18 @@
}
# Command to run.
} -c* {
- if {! [ regexp .\[cC\](.+) $arg ignore command]} {
+ if {! [regexp .\[cC\](.+) $arg ignore command]} {
incr i
- set command [ lindex $argv $i ]
+ set command [lindex $argv $i]
}
set do_command 1
# Expect script to run.
} -s* {
- if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
+ if {! [regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
- set sfile [ lindex $argv $i ]
+ set sfile [lindex $argv $i]
}
- if { ! [ file readable $sfile ] } {
+ if { ! [file readable $sfile] } {
send_user "\nError: Can't read $sfile\n"
exit 1
}
@@ -151,39 +151,41 @@
} -S* {
set do_saveconfig 1
# cypher type
- } -y* {
- if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
- incr i
- set cypher [ lindex $argv $i ]
- }
+ } -y* {
+ if {! [regexp .\[eE\](.+) $arg ignore cypher]} {
+ incr i
+ set cypher [lindex $argv $i]
+ }
# alternate cloginrc file
} -f* {
- if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ if {! [regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
- set password_file [ lindex $argv $i ]
+ set password_file [lindex $argv $i]
}
+ # Timeout
} -t* {
incr i
- set timeoutdflt [ lindex $argv $i ]
- } -x* {
- if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
- incr i
- set cmd_file [ lindex $argv $i ]
- }
- if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
+ set timeoutdflt [lindex $argv $i]
+ # Command file
+ } -x* {
+ if {! [regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr i
+ set cmd_file [lindex $argv $i]
+ }
+ if [catch {set cmd_fd [open $cmd_file r]} reason] {
send_user "\nError: $reason\n"
exit 1
}
- set cmd_text [read $cmd_fd]
- close $cmd_fd
- set command [join [split $cmd_text \n] \;]
- set do_command 1
+ set cmd_text [read $cmd_fd]
+ close $cmd_fd
+ set command [join [split $cmd_text \n] \;]
+ set do_command 1
# Version string
} -V* {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Does tacacs automatically enable us?
- } -autoenable {
+ } -autoenable {
# ignore autoenable
} -* {
send_user "\nError: Unknown argument! $arg\n"
@@ -223,20 +225,20 @@
if [regexp \^(xterm|vs) $env(TERM) ignore ] {
send_user "\033]1;[lindex [split $host "."] 0]\a"
send_user "\033]2;$host\a"
- }
+ }
}
}
# This is a helper function to make the password file easier to
# maintain. Using this the password file has the form:
-# add password sl* pete cow
-# add password at* steve
+# add password sl* pete cow
+# add password at* steve
# add password * hanky-pie
proc add {var args} { global int_$var ; lappend int_$var $args}
proc include {args} {
global env
regsub -all "(^{|}$)" $args {} args
- if { [ regexp "^/" $args ignore ] == 0 } {
+ if { [regexp "^/" $args ignore] == 0 } {
set args $env(HOME)/$args
}
source_password_file $args
@@ -246,7 +248,7 @@
upvar int_$var list
if { [info exists list] } {
foreach line $list {
- if { [string match [lindex $line 0] $router ] } {
+ if { [string match [lindex $line 0] $router] } {
return [lrange $line 1 end]
}
}
@@ -270,7 +272,7 @@
send_user "\nError: $password_file must not be world readable/writable\n"
exit 1
}
- if [ catch {source $password_file} reason ] {
+ if [catch {source $password_file} reason] {
send_user "\nError: $reason\n"
exit 1
}
@@ -278,35 +280,40 @@
# Log into the firewall.
# returns: 0 on success, 1 on failure
-proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
- global spawn_id in_proc do_command do_script sshcmd
+proc login { router user userpswd passwd enapasswd cmethod cyphertype identfile } {
+ global command spawn_id in_proc do_command do_script passphrase
+ global prompt prompt_match u_prompt p_prompt sshcmd
set in_proc 1
set uprompt_seen 0
- # Telnet to the firewall & try to login.
+ # try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
incr progs -1
if [string match "telnet*" $prog] {
- regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
+ regexp {telnet(:([^[:space:]]+))*} $prog methcmd suffix port
if {"$port" == ""} {
- set retval [ catch {spawn telnet $router} reason ]
+ set retval [catch {spawn telnet $router} reason]
} else {
- set retval [ catch {spawn telnet $router $port} reason ]
+ set retval [catch {spawn telnet $router $port} reason]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
return 1
}
} elseif [string match "ssh*" $prog] {
+ # ssh to the router & try to login with or without an identfile.
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
- set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
+ if {"$identfile" != ""} {
+ set cmd "$cmd -i $identfile"
+ }
+ set retval [catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -328,19 +335,19 @@
send_user "\nError: TIMEOUT reached\n"
catch {close}; catch {wait};
if { $in_proc} {
- return 1
+ return 1
} else {
- continue
+ continue
}
- } eof {
+ } eof {
send_user "\nError: EOF received\n"
catch {close}; catch {wait};
if { $in_proc} {
- return 1
+ return 1
} else {
- continue
+ continue
}
- }
+ }
}
# Here we get a little tricky. There are several possibilities:
@@ -381,17 +388,22 @@
catch {close}; catch {wait};
return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ exp_continue
+ }
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
catch {close}; catch {wait};
@@ -402,7 +414,7 @@
catch {close}; catch {wait}; return 1
}
"Login failed" {
- send_user "\nError: Check your passwd for $router\n";
+ send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
}
-re "(login:)" {
@@ -429,6 +441,7 @@
-- "$prompt" { break; }
}
}
+
set in_proc 0
return 0
}
@@ -444,10 +457,10 @@
set commands [split $command \;]
set num_commands [llength $commands]
for {set i 0} {$i < $num_commands} { incr i} {
- send -- "[subst [lindex $commands $i]]\r"
+ send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
-re "\[\n\r]+" { exp_continue }
- -re "$prompt" {}
+ -re "$prompt" {}
-gl "--- more ---" { send " "
exp_continue
}
@@ -480,7 +493,7 @@
set exitval 0
foreach router [lrange $argv $i end] {
set router [string tolower $router]
- send_user "$router\n"
+ send_user -- "$router\n"
# device timeout
set timeout [find timeout $router]
@@ -492,13 +505,13 @@
# Figure out passwords
if { $do_passwd || $do_enapasswd } {
- set pswd [find password $router]
- if { [llength $pswd] == 0 } {
- send_user "\nError: no password for $router in $password_file.\n"
- continue
- }
- set passwd [join [lindex $pswd 0] ""]
- set enapasswd [join [lindex $pswd 1] ""]
+ set pswd [find password $router]
+ if { [llength $pswd] == 0 } {
+ send_user -- "\nError: no password for $router in $password_file.\n"
+ continue
+ }
+ set passwd [join [lindex $pswd 0] ""]
+ set enapasswd [join [lindex $pswd 1] ""]
} else {
set passwd $userpasswd
set enapasswd $enapasswd
@@ -522,14 +535,16 @@
if { "$userpswd" == "" } { set userpswd $passwd }
}
+ # Figure out identity file to use
+ set identfile [join [lindex [find identity $router] 0] ""]
# Figure out cypher type
if {[info exists cypher]} {
- # command line cypher type
- set cyphertype $cypher
+ # command line cypher type
+ set cyphertype $cypher
} else {
- set cyphertype [find cyphertype $router]
- if { "$cyphertype" == "" } { set cyphertype "3des" }
+ set cyphertype [find cyphertype $router]
+ if { "$cyphertype" == "" } { set cyphertype "3des" }
}
# Figure out connection method
@@ -537,12 +552,13 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
- if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} {
+ if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype $identfile]} {
incr exitval
+ # if login failed, move on to the next device
continue
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/nrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: nrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: nrancid.in 2362 2012-01-26 16:20:02Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -191,8 +191,10 @@
/^Feature: (\S+)$/ &&
ProcessHistory("SYSTEM","","", "#Feature: $1\n") && next;
/^File Name: (\S+), Checksum: (\S+)$/ &&
- ProcessHistory("SYSTEM","","", "#File Name: $1, Checksum: $2\n") && next;
-
+ ProcessHistory("SYSTEM","","", "#File Name: $1, Checksum: $2\n")
+ && next;
+ /^, Total Memory: (\S+)$/ &&
+ ProcessHistory("SYSTEM","","", "#Memory: $1\n") && next;
}
ProcessHistory("SYSTEM","","","#\n");
return(0);
@@ -297,7 +299,7 @@
} else {
print STDERR "executing nlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing nlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "nlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "nlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "nlogin failed for $host: $!\n";
} else {
@@ -359,7 +361,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/nslogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: nslogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: nslogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -325,13 +325,13 @@
incr progs -1
if ![string compare $prog "ssh"] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "telnet"] {
@@ -400,17 +400,21 @@
catch {close}; catch {wait};
send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue
}
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -619,7 +623,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/nsrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: nsrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: nsrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -245,7 +245,7 @@
} else {
print STDERR "executing nslogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing nslogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "nslogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "nslogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "nslogin failed for $host: $!\n";
} else {
@@ -307,7 +307,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/nxrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: nxrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: nxrancid.in 2321 2011-07-29 20:40:40Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -169,18 +169,19 @@
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
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 (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
if (/^Cisco Nexus Operating System/) { $type = "NXOS";}
if (/^Software$/) {
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
next if (/^\s*$cmd\s*$/);
if (/^$/) {
@@ -193,7 +194,7 @@
if (/^Hardware$/) {
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
next if (/^\s*$cmd\s*$/);
if (/^$/) {
@@ -235,11 +236,12 @@
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
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 (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
/^Built By / && ProcessHistory("COMMENTS","","", "!Build: $_");
@@ -262,6 +264,7 @@
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /(Invalid input detected|Type help or )/;
return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
/^-+$/ && next; # Skip lines of all dashes.
@@ -282,7 +285,8 @@
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 (/\% Invalid command at /);
+ return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
s/ +$//; # Drop trailing ' '
@@ -298,11 +302,12 @@
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last; };
+ last if (/^$prompt/);
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 (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
s/ +$//; # Drop trailing ' '
@@ -318,11 +323,12 @@
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
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 (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
# Cut out CurTemp - drop the 2nd to last field.
@@ -346,11 +352,13 @@
while (<INPUT>) {
tr/\015//d;
- if (/^$prompt/) { last};
+ last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
+ next if (/^\s*\^\s*$/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
- return(-1) if (/\% Invalid command at /);
+ return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
# Cut out Actual Output/Draw.
@@ -396,6 +404,7 @@
return(1) if /(Invalid input detected|Type help or )/;
return(1) if /Ambiguous command/i;
return(-1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
s/ variable = / = /;
@@ -425,6 +434,7 @@
return(1) if / is either not present or not formatted/;
return(-1) if /\%Error calling/;
return(-1) if /(: device being squeezed|ATA_Status time out)/i; # busy
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
return(1) if /(Open device \S+ failed|Error opening \S+:)/;
@@ -450,6 +460,7 @@
last if (/^$prompt/);
next if (/^\s*$cmd\s*$/);
return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
s/(.*) \*$/$1/; # Drop a trailing '*'
@@ -474,6 +485,7 @@
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
if (/^(NAME: "[^"]*",)\s+(DESCR: "[^"]+")/) {
@@ -520,6 +532,7 @@
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
next if (/^Configuration last modified by/);
# the pager can not be disabled per-session on the PIX
@@ -555,6 +568,7 @@
# newer releases (~12.1(9)) place the vlan config in the normal
# configuration (write term).
return(1) if ($type =~ /^(3550|4500)$/);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
@@ -580,6 +594,7 @@
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(-1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
/^No matching debug flags set$/ && next;
@@ -604,6 +619,7 @@
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
ProcessHistory("COMMENTS","","","!CORES: $_");
@@ -623,6 +639,7 @@
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(-1) if (/\% Invalid command at /);
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
ProcessHistory("COMMENTS","","","!PROC_LOGS: $_");
@@ -643,6 +660,7 @@
return(1) if (/(Invalid input detected|Type help or )/i);
return(-1) if (/\% Invalid command at /);
return(0) if ($found_end); # Only do this routine once
+ return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);
# /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
@@ -1011,6 +1029,7 @@
{'show system redundancy status' => 'ShowRedundancy'},
{'show environment clock' => 'ShowEnv'},
{'show environment fan' => 'ShowEnv'},
+ {'show environment fex all fan' => 'ShowEnv'},
{'show environment temperature' => 'ShowEnvTemp'},
{'show environment power' => 'ShowEnvPower'},
{'show boot' => 'ShowBoot'},
@@ -1060,7 +1079,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -1137,7 +1156,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/prancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: prancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: prancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -524,7 +524,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -594,7 +594,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rancid-cvs.in
^
|
@@ -1,9 +1,9 @@
#! /bin/sh
##
-## $Id: rancid-cvs.in 2096 2009-06-17 21:49:46Z heas $
+## $Id: rancid-cvs.in 2340 2011-11-29 22:30:30Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -39,7 +39,7 @@
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.
-#
+#
# Create all of the misc files & dirs needed for each group and import them
# into CVS or Subversion.
#
@@ -93,11 +93,20 @@
fi
# Top level CVS stuff
-if [ ! -d $CVSROOT ]; then
- if [ $RCSSYS = cvs ]; then
+if [ $RCSSYS = cvs ]; then
+ if [ ! -d $CVSROOT ]; then
cvs -d $CVSROOT init
+ fi
+else
+ if echo "$CVSROOT" | grep -q "://"; then
+ # do nothing because CVSROOT is some sort of a URL
+ # also assume the repository has already been provisioned
+ :
else
- svnadmin create $CVSROOT @SVN_FSTYPE@
+ if ! svn ls "file://$CVSROOT" >/dev/null 2>&1; then
+ svnadmin create $CVSROOT @SVN_FSTYPE@
+ fi
+ CVSROOT="file://$CVSROOT"
fi
fi
@@ -128,9 +137,11 @@
cd $BASEDIR
cvs checkout $GROUP
else
- svn import -m "$GROUP" . file:///$CVSROOT/$GROUP
+ svn import -m "$GROUP" . $CVSROOT/$GROUP
cd $BASEDIR
- svn checkout file:///$CVSROOT/$GROUP $GROUP
+ svn checkout $CVSROOT/$GROUP $GROUP
+ cd $DIR
+ svn update
fi
fi
cd $DIR
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rancid-fe.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rancid-fe.in 2178 2010-04-08 20:03:01Z heas $
+## $Id: rancid-fe.in 2296 2011-04-27 18:18:56Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -72,6 +72,7 @@
'hitachi' => 'htrancid',
'hp' => 'hrancid',
'juniper' => 'jrancid',
+ 'mikrotik' => 'mtrancid',
'mrtd' => 'mrancid',
'mrv' => 'mrvrancid',
'netopia' => 'trancid',
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rancid-run.in
^
|
@@ -1,9 +1,9 @@
#! /bin/sh
##
-## $Id: rancid-run.in 2096 2009-06-17 21:49:46Z heas $
+## $Id: rancid-run.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rancid.in 2272 2011-01-10 20:01:58Z heas $
+## $Id: rancid.in 2377 2012-01-31 22:55:13Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
@@ -68,6 +68,8 @@
my($config_register); # configuration register value
my($filter_commstr); # SNMP community string filtering
my($filter_pwds); # password filtering mode
+my($supbootdisk) = 0; # skip sup-bootflash if sup-bootdisk
+ # worked
# This routine is used to print out the router configuration
sub ProcessHistory {
@@ -231,7 +233,7 @@
ProcessHistory("COMMENTS","keysort","B1", "!Memory: $2\n");
}
/^serial number:\s+(.*)$/i &&
- ProcessHistory("COMMENTS","keysort","C1", "!Serial Number: $1") &&
+ ProcessHistory("COMMENTS","keysort","C1", "!Serial Number: $1\n") &&
next;
# More PIX stuff
/^Encryption hardware device\s+:\s+(.*)/ &&
@@ -399,7 +401,8 @@
/^(\d+[kK]) bytes of (non-volatile|NVRAM)/ &&
ProcessHistory("COMMENTS","keysort","B3",
"!Memory: nvram $1\n") && next;
- /^(\d+[kK]) bytes of flash memory/ &&
+ /^(\d+[kK]) bytes of (flash memory|processor board System flash|ATA Comp
+actFlash)/ &&
ProcessHistory("COMMENTS","keysort","B5","!Memory: flash $1\n") &&
next;
/^(\d+[kK]) bytes of .*flash partition/ &&
@@ -744,6 +747,12 @@
return(-1) if (/\%Error opening \S+:\S+ \(Device or resource busy\)/i);
return(-1) if (/command authorization failed/i);
return(1) if (/(Open device \S+ failed|Error opening \S+:)/);
+ # skip dir sup-bootflash if dir sup-bootdisk was successful, duplicates
+ if ($cmd =~ / sup-bootdisk/) {
+ $supbootdisk++;
+ } elsif ($supbootdisk && $cmd =~ / sup-bootflash/) {
+ return(0);
+ }
# filter frequently changing files from IOX bootflash
if ($dev =~ /bootflash/) {
next if (/temp_cont\s*$/);
@@ -757,7 +766,7 @@
if ($tmp >= (1024 * 1024 * 1024)) {
$tmp = int($tmp / (1024 * 1024 * 1024));
s/$1 bytes free/$tmp GB free/;
- } else {
+ } else {
$tmp = int($tmp / (1024 * 1024));
s/$1 bytes free/$tmp MB free/;
}
@@ -1343,10 +1352,18 @@
}
# split PID/VID/SN line
if (/^PID: (\S*)\s*,\s*VID: (\S*)\s*,\s*SN: (\S*)\s*$/) {
+ my($pid,$vid,$sn) = ($1, $2, $3);
my($entries) = "";
- $entries .= "!PID: $1\n" if ($1);
- $entries .= "!VID: $2\n" if ($2);
- $entries .= "!SN: $3\n" if ($3);
+ # filter <empty>, "0x" and "N/A" lines
+ if ($pid !~ /^(|0x|N\/A)$/) {
+ $entries .= "!PID: $pid\n";
+ }
+ if ($vid !~ /^(|0x|N\/A)$/) {
+ $entries .= "!VID: $vid\n";
+ }
+ if ($sn !~ /^(|0x|N\/A)$/) {
+ $entries .= "!SN: $sn\n";
+ }
ProcessHistory("INVENTORY","","", "$entries");
next;
}
@@ -1480,6 +1497,38 @@
return(0);
}
+# This routine parses "show capture". Intended for ASA/PIXes.
+sub ShowCapture {
+ print STDERR " In ShowCapture: $_" if ($debug);
+ my $capture_found = 0;
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ return(1) if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(1) if (/Line has invalid autocommand /);
+ return(1) if (/(Invalid (input|command) 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 -+>)/) {
+ my($len) = length($1);
+ s/^$1\s{$len}//;
+ }
+
+ if (/capture (.*) type/) {
+ my $cap_name = $1;
+ s/\d+ bytes/<COUNTER> bytes/;
+ ProcessHistory("CAPTURE","","","!Capture: $cap_name\n");
+ ProcessHistory("CAPTURE","","","!Capture: $_");
+ } else {
+ ProcessHistory("CAPTURE","","","!Capture: $_");
+ }
+ $capture_found = 1
+ }
+ ProcessHistory("CAPTURE","","","!\n") if ($capture_found == 1);
+ return(0);
+}
+
# This routine parses "show vtp status"
sub ShowVTP {
print STDERR " In ShowVTP: $_" if ($debug);
@@ -1536,6 +1585,31 @@
return(0);
}
+# This routine processes a "show shun". Intended for ASA/PIXes.
+sub ShowShun {
+ print STDERR " In ShowShun: $_" if ($debug);
+ my $shun_found = 0;
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ return(1) if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(1) if (/Line has invalid autocommand /);
+ return(1) if (/(Invalid (input|command) 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 -+>)/) {
+ my($len) = length($1);
+ s/^$1\s{$len}//;
+ }
+
+ ProcessHistory("SHUN","","","!Shun: $_");
+ $shun_found = 1;
+ }
+ ProcessHistory("SHUN","","","!\n") if ($shun_found == 1);
+ return(0);
+}
+
# This routine processes a "write term"
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
@@ -1582,6 +1656,8 @@
}
tr/\015//d;
}
+ # config timestamp on MDS/NX-OS
+ /Time: / && next;
# skip ASA 5520 configuration author line
/^: written by /i && next;
# some versions have other crap mixed in with the bits in the
@@ -1669,7 +1745,10 @@
ProcessHistory("","","","! neighbor $1 password <removed>\n");
next;
}
- if (/^(ppp .* password) 7 .*/ && $filter_pwds >= 1) {
+ if (/^(\s*ppp .* hostname) .*/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 <removed>\n"); next;
+ }
+ if (/^(\s*ppp .* password) \d .*/ && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed>\n"); next;
}
if (/^(ip ftp password) / && $filter_pwds >= 1) {
@@ -1695,7 +1774,7 @@
&& $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed>\n"); next;
}
- if (/^((crypto )?isakmp key) \S+ / && $filter_pwds >= 1) {
+ if (/^((crypto )?isakmp key) (\d )?\S+ / && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed> $'"); next;
}
# filter HSRP passwords
@@ -1722,9 +1801,14 @@
if (/^( pre-shared-key | key |failover key ).*/ && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed> $'"); next;
}
+ # ASA/PIX keys in more system:running-config
if (/(\s+ldap-login-password )\S+(.*)/ && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed> $'"); next;
}
+ # filter WPA password such as on cisco 877W ISR
+ if (/^\s+(wpa-psk ascii|hex \d) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 <removed>\n"); next;
+ }
#
if (/^( cable shared-secret )/ && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed>\n");
@@ -1828,7 +1912,7 @@
}
}
# prune tacacs/radius server keys
- if (/^((tacacs|radius)-server\s(\w*[-\s(\s\S+])*\s?key) (\d )?\w+/
+ if (/^((tacacs|radius)-server\s(\w*[-\s(\s\S+])*\s?key) (\d )?\S+/
&& $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed>$'"); next;
}
@@ -1917,6 +2001,7 @@
{'dir /all harddisk:' => 'DirSlotN'},
{'dir /all harddiska:' => 'DirSlotN'},
{'dir /all harddiskb:' => 'DirSlotN'},
+ {'dir /all sup-bootdisk:' => 'DirSlotN'}, # 6500 sup32
{'dir /all sup-bootflash:' => 'DirSlotN'}, # cat 6500-ios
{'dir /all sup-microcode:' => 'DirSlotN'}, # cat 6500-ios
{'dir /all slavenvram:' => 'DirSlotN'},
@@ -1940,6 +2025,7 @@
{'show controllers cbus' => 'ShowContCbus'},
{'show diagbus' => 'ShowDiagbus'},
{'show diag' => 'ShowDiag'},
+ {'show capture' => 'ShowCapture'}, # ASA/PIX
{'show module' => 'ShowModule'}, # cat 6500-ios
{'show spe version' => 'ShowSpeVersion'},
{'show c7200' => 'ShowC7200'},
@@ -1948,7 +2034,10 @@
{'show vlan' => 'ShowVLAN'},
{'show vlan-switch' => 'ShowVLAN'},
{'show debug' => 'ShowDebug'},
+ {'show shun' => 'ShowShun'}, # ASA/PIX
{'more system:running-config' => 'WriteTerm'}, # ASA/PIX
+ {'show running-config view full'=> 'WriteTerm'}, # workaround for
+ # role-based CLI
{'show running-config' => 'WriteTerm'},
{'write term' => 'WriteTerm'},
);
@@ -1981,7 +2070,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -2054,7 +2143,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rivlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: rivlogin.in 2245 2010-08-19 07:20:48Z heas $
+## $Id: rivlogin.in 2334 2011-11-17 21:09:37Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rivrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rivrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: rivrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -290,7 +290,7 @@
} else {
print STDERR "executing rivlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing rivlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "rivlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "rivlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "rivlogin failed for $host: $!\n";
} else {
@@ -367,7 +367,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/rrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: rrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -351,7 +351,7 @@
print STDERR "executing clogin -t $timeo -c\"$redback_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$redback_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$redback_cmds\" $host </dev/null > $host.raw" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -423,7 +423,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/srancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: srancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: srancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -368,7 +368,7 @@
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})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "hlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "hlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "hlogin failed for $host: $!\n";
} else {
@@ -434,7 +434,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/tlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: tlogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: tlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -323,13 +323,13 @@
}
} elseif [string match "ssh*" $prog] {
regexp {ssh(:([^[:space:]]+))*} $prog command suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
exit 1
}
} elseif [string match "usercmd" $prog] { # user supplies connect cmd
@@ -416,15 +416,19 @@
catch {close};
send_user "\nError: Unknown host $router\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1 }
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1 }
@@ -766,7 +770,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# If user provides a router-specific connection method, use it
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/tntlogin.in
^
|
@@ -1,9 +1,9 @@
#! @EXPECT_PATH@ --
##
-## $Id: tntlogin.in 2254 2010-10-01 19:27:48Z heas $
+## $Id: tntlogin.in 2376 2012-01-31 22:42:14Z heas $
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
+## Copyright (c) @COPYYEARS@ by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -310,13 +310,13 @@
}
} elseif ![string compare $prog "ssh"] {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
- set cmd [join [lindex $sshcmd 0] " "]
+ set cmd $sshcmd
if {"$port" != ""} {
set cmd "$cmd -p $port"
}
set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
if { $retval } {
- send_user "\nError: $sshcmd failed: $reason\n"
+ send_user "\nError: $cmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -370,17 +370,21 @@
expect eof
send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).* \\(yes/no\\)\\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
exp_continue
}
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED.* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1
}
- -re "Offending key for .* \(yes\/no\)\?" {
+ -re "HOST IDENTIFICATION HAS CHANGED\[^\n\r]+" {
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ return 1
+ }
+ -re "Offending key for .* \\(yes/no\\)\\?" {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1
@@ -532,7 +536,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/tntrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: tntrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: tntrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -243,7 +243,7 @@
} else {
print STDERR "executing tntlogin -t $timeo -c\"$tnt_cmds\" $host\n" if ($debug);
print STDOUT "executing tntlogin -t $timeo -c\"$tnt_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "tntlogin -t $timeo -c \"$tnt_cmds\" $host </dev/null > $host.raw 2>&1" || die "tntlogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "tntlogin failed for $host: $!\n";
} else {
@@ -314,7 +314,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/trancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: trancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: trancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -253,7 +253,7 @@
} else {
print STDERR "executing $clogin_pgm -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing $clogin_pgm -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "$clogin_pgm -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "$clogin_pgm failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "$clogin_pgm failed for $host: $!\n";
} else {
@@ -315,7 +315,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/xrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: xrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: xrancid.in 2349 2011-12-07 23:47:09Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -280,6 +280,9 @@
/^(boot |next reboot)/i && next;
/^(auto |qos mode|sys\S*:|temperature|time)/i && next;
+ /^system type\s*:\s*(.+)/i &&
+ ProcessHistory("COMMENTS","keysort","A0","#Chassis type: $1\n") &&
+ next;
/^power supply: (.*)/i &&
ProcessHistory("COMMENTS","keysort","C0","#$1") && next;
/^license/i && ProcessHistory("COMMENTS","keysort","D0","#Image: $_")
@@ -304,7 +307,9 @@
tr/\015//d;
last if(/^$prompt/);
next if(/^\s*$/);
- return(0) if(/^syntax error at token /i);
+ return(0) if (/^syntax error at token /i);
+ return(0) if (/^%% Invalid input detected at /i);
+ return(0) if (/^%% Ambiguous command:/i);
# the pager can not be disabled per-session on the PIX
s/^<-+ More -+>\s*//;
return(0) if ($found_end);
@@ -449,7 +454,7 @@
} else {
print STDERR "executing clogin -t $timeo -c \"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c \"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -531,7 +536,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/xrrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: xrrancid.in 2264 2010-11-04 23:35:17Z heas $
+## $Id: xrrancid.in 2369 2012-01-30 21:06:03Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2010 by Terrapin Communications, Inc.
@@ -168,7 +168,7 @@
&ipaddrval($a) <=> &ipaddrval($b);
}
-# This routine parses "show version"
+# This routine parses "admin show version"
sub ShowVersion {
print STDERR " In ShowVersion: $_" if ($debug);
my($slaveslot);
@@ -427,7 +427,7 @@
/^$/ && next;
s/^NODE //;
- # wtf are those?
+ # wtf are these?
next if (/(New Deviation|UDI_VID|Board State)/);
# skip insertion time
next if (/insertion time/i);
@@ -440,7 +440,34 @@
return(0);
}
-# This routine parses "show redundancy"
+# This routine parses "admin show running".
+# This will create arrays for hw info.
+sub AdminShowRunning {
+ print STDERR " In ShowRunning: $_" if ($debug);
+
+ while (<INPUT>) {
+ 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|command) detected|Type help or )/i);
+ return(-1) if (/command authorization failed/i);
+ /^$/ && next;
+
+ /^building configuration/i && next;
+ if (/^(\s*secret) / && $filter_pwds >= 2) {
+ ProcessHistory("SLOT","","","!$1 <removed>\n");
+ next;
+ }
+ /^end$/ && last;
+
+ ProcessHistory("SLOT","","","!$_");
+ }
+ ProcessHistory("SLOT","","","!\n");
+ return(0);
+}
+
+# This routine parses "admin show redundancy"
sub ShowRedundancy {
print STDERR " In ShowRedundancy: $_" if ($debug);
@@ -485,7 +512,7 @@
return(0);
}
-# This routine parses "show env all"
+# This routine parses "admin show env all"
sub ShowEnv {
# Skip if this is not a 7500, 7200, or 7000.
print STDERR " In ShowEnv: $_" if ($debug);
@@ -529,82 +556,6 @@
return(0);
}
-# This routine parses "show boot"
-sub ShowBoot {
- # Pick up boot variables if 7000/7200/7500/12000/2900/3500;
- # otherwise pick up bootflash.
- print STDERR " In ShowBoot: $_" if ($debug);
-
- while (<INPUT>) {
- 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|command) detected|Type help or )/i);
- return(1) if (/Ambiguous command/i);
- return(1) if (/(Open device \S+ failed|Error opening \S+:)/);
- return(-1) if (/command authorization failed/i);
-
- next if /CONFGEN variable/;
- if (!defined($H0)) {
- $H0 = 1; ProcessHistory("COMMENTS","keysort","H0","!\n");
- }
- if ($type !~ /^(12[04]|7)/) {
- if ($type !~ /^(29|35)00/) {
- ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
- } else {
- ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
- }
- } elsif (/(variable|register)/) {
- ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
- }
- }
- ProcessHistory("COMMENTS","","","!\n");
- 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 (<INPUT>) {
- tr/\015//d;
- last if (/^$prompt/);
- next if (/^(\s*|\s*$cmd\s*)$/);
- return(1) if (/(Invalid (input|command) detected|Type help or )/i);
- return(-1) if (/command authorization failed/i);
- # return(1) if ($type !~ /^12[40]/);
- # the pager can not be disabled per-session on the PIX
- if (/^(<-+ More -+>)/) {
- my($len) = length($1);
- s/^$1\s{$len}//;
- }
- /^$/ && next;
-
- /^\s+Chassis: type (\S+) Fab Ver: (\S+)/ &&
- 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 "dir /all ((disk|slot)N|bootflash|nvram):"
sub DirSlotN {
print STDERR " In DirSlotN: $_" if ($debug);
@@ -659,6 +610,32 @@
return(0);
}
+# This routine parses "admin show variables boot"
+sub ShowBootVar {
+ print STDERR " In ShowBootVar: $_" if ($debug);
+
+ while (<INPUT>) {
+ # delete non-ascii chars, except new line
+ tr/ -~\n//cd;
+ last if (/^$prompt/);
+ next if (/\s*$cmd\s*$/);
+ return(1) if (/^\s*\^\s*$/);
+ return(1) if (/Line has invalid autocommand /);
+ return(1) if (/(Invalid (input|command) detected|Type help or )/i);
+ return(1) if (/Ambiguous command/i);
+ return(1) if (/(Open device \S+ failed|Error opening \S+:)/);
+ return(-1) if (/command authorization failed/i);
+
+ # skip blank lines
+ next if (/^\s*$/);
+
+ ProcessHistory("COMMENTS", "keysort", "C30", "! $_");
+ }
+ ProcessHistory("COMMENTS", "keysort", "C39", "!\n");
+
+ return(0);
+}
+
# This routine parses "show controllers"
sub ShowContAll {
# Skip if this is a 70[01]0, 7500, or 12000.
@@ -742,12 +719,40 @@
return(0);
}
+# This routine parses "admin show install summary"
+sub ShowInstallSummary {
+ print STDERR " In ShowInstallSummary: $_" if ($debug);
+
+ while (<INPUT>) {
+ # delete non-ascii chars, except new line
+ tr/ -~\n//cd;
+ last if (/^$prompt/);
+ next if (/\s*$cmd\s*$/);
+ return(1) if (/^\s*\^\s*$/);
+ return(1) if (/Line has invalid autocommand /);
+ return(1) if (/(Invalid (input|command) detected|Type help or )/i);
+ return(1) if (/Ambiguous command/i);
+ return(1) if (/(Open device \S+ failed|Error opening \S+:)/);
+ return(-1) if (/command authorization failed/i);
+
+ # skip blank lines
+ next if (/^\s*$/);
+
+ ProcessHistory("COMMENTS", "keysort", "C15", "! $_");
+ }
+ ProcessHistory("COMMENTS", "keysort", "C10", "!\n");
+ ProcessHistory("COMMENTS", "keysort", "C19", "!\n");
+
+ return(0);
+}
+
# This routine parses "show inventory".
sub ShowInventory {
print STDERR " In ShowInventory: $_" if ($debug);
while (<INPUT>) {
- tr/\015//d;
+ # delete non-ascii chars, except new line
+ tr/ -~\n//cd;
return if (/^\s*\^$/);
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
@@ -755,16 +760,26 @@
return(1) if (/(Invalid (input|command) detected|Type help or )/i);
return(-1) if (/command authorization failed/i);
+ # remove spaces after quotes
+ s/\"\s+/\"/g;
if (/^(NAME: "[^"]*",) (DESCR: "[^"]+")/) {
ProcessHistory("INVENTORY","","", sprintf("!%-30s %s\n", $1, $2));
next;
}
# split PID/VID/SN line
if (/^PID: (\S*)\s*, VID: (\S*)\s*, SN: (\S*)\s*$/) {
+ my($pid,$vid,$sn) = ($1, $2, $3);
my($entries) = "";
- $entries .= "!PID: $1\n" if ($1);
- $entries .= "!VID: $2\n" if ($2);
- $entries .= "!SN: $3\n" if ($3);
+ # filter <empty>, "0x" and "N/A" lines
+ if ($pid !~ /^(|0x|N\/A)$/) {
+ $entries .= "!PID: $pid\n";
+ }
+ if ($vid !~ /^(|0x|N\/A)$/) {
+ $entries .= "!VID: $vid\n";
+ }
+ if ($sn !~ /^(|0x|N\/A)$/) {
+ $entries .= "!SN: $sn\n";
+ }
ProcessHistory("INVENTORY","","", "$entries");
next;
}
@@ -775,6 +790,52 @@
return(0);
}
+# This routine parses "admin show license"
+sub ShowLicense {
+ print STDERR " In ShowLicense: $_" if ($debug);
+
+ while (<INPUT>) {
+ # delete non-ascii chars, except new line
+ tr/ -~\n//cd;
+ last if (/^$prompt/);
+ next if (/\s*$cmd\s*$/);
+ return(1) if (/^\s*\^\s*$/);
+ return(1) if (/Line has invalid autocommand /);
+ return(1) if (/(Invalid (input|command) detected|Type help or )/i);
+ return(1) if (/Ambiguous command/i);
+ return(1) if (/(Open device \S+ failed|Error opening \S+:)/);
+ return(-1) if (/command authorization failed/i);
+
+ # skip blank lines
+ next if (/^\s*$/);
+
+ ProcessHistory("COMMENTS", "keysort", "C20", "! $_");
+ }
+ ProcessHistory("COMMENTS", "keysort", "C29", "!\n");
+
+ return(0);
+}
+
+# This routine parses "show rpl maximum"
+sub ShowRPL {
+ print STDERR " In ShowRPL: $_" if ($debug);
+
+ while (<INPUT>) {
+ 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|command) detected|Type help or )/i);
+ return(1) if (/Ambiguous command/i);
+ return(-1) if (/command authorization failed/i);
+
+ ProcessHistory("COMMENTS","keysort","RPLMAX","! $_");
+ }
+ ProcessHistory("COMMENTS","keysort","RPLMAX","!\n");
+ return(0);
+}
+
# This routine parses "show vlan"
sub ShowVLAN {
print STDERR " In ShowVLAN: $_" if ($debug);
@@ -984,7 +1045,7 @@
ProcessHistory("EXPATH","keysort","$key","$expath");
$key = $1;
$expath = $_;
- } else {
+ } else {
$expath .= $_;
}
}
@@ -1001,7 +1062,7 @@
ProcessHistory("ROUTEMAP","keysort","$key","$routemap");
$key = $1;
$routemap = $_;
- } else {
+ } else {
$routemap .= $_;
}
}
@@ -1021,15 +1082,18 @@
ProcessHistory("EACL $1 $2","$aclsort","0.0.0.0","$_") && next;
# sort ipv{4,6} access-lists
if (/^ipv(4|6) access-list (\S+)\s*$/) {
- my($nlri, $key) = ($1,$2);
- ProcessHistory("ACL $nlri $key","keysort","$key","$_");
+ my($nlri, $key) = ($1, $2);
+ my($seq, $cmd);
+ ProcessHistory("ACL $nlri $key","","","$_");
while (<INPUT>) {
tr/\015//d;
last if (/^$prompt/ || /^\S/);
- if (/^\s+(\d+) (permit|deny) /) {
- ProcessHistory("ACL $nlri $key","keysort","$2"," $2 $'");
- } else {
- ProcessHistory("ACL $nlri $key","keysort","$key","$_");
+ ($seq, $cmd, $misc, $ip) = ($_ =~ /^\s+(\d+) (\w+) (.*\s)(\w+)/);
+ if ($cmd =~ /(permit|deny)/) {
+ ProcessHistory("ACL $nlri $key $cmd","$aclsort","$ip",
+ " $cmd $misc$ip\n");
+ } else {
+ ProcessHistory("ACL $nlri $key","",""," $cmd $misc$ip\n");
}
}
}
@@ -1161,11 +1225,15 @@
{'terminal exec prompt no-timestamp' => 'FilterAll' }, # XR 3.8 style
{'admin show version' => 'ShowVersion'},
+
+ # XR IMAGE commands
+ {'admin show install summary' => 'ShowInstallSummary'},
+ {'admin show license' => 'ShowLicense'},
+ {'admin show variables boot' => 'ShowBootVar'},
+
{'show redundancy secondary' => 'ShowRedundancy'},
{'show install active' => 'ShowInstallActive'},
{'admin show env all' => 'ShowEnv'},
- {'show diag chassis-info' => 'ShowGSR'},
- {'admin show variables boot' => 'ShowBoot'},
{'dir /all nvram:' => 'DirSlotN'},
{'dir /all bootflash:' => 'DirSlotN'},
{'dir /all compactflash:' => 'DirSlotN'},
@@ -1198,10 +1266,12 @@
{'dir /all sec-slot2:' => 'DirSlotN'},
{'dir /all sec-disk2:' => 'DirSlotN'},
{'show controllers' => 'ShowContAll'},
+ {'admin show running' => 'AdminShowRunning'},
{'admin show diag' => 'AdminShowDiag'},
{'admin show inventory raw' => 'ShowInventory'},
{'show vlan' => 'ShowVLAN'},
{'show debug' => 'ShowDebug'},
+ {'show rpl maximum' => 'ShowRPL'},
{'show running-config' => 'WriteTerm'},
);
# Use an array to preserve the order of the commands and a hash for mapping
@@ -1233,7 +1303,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -1306,7 +1376,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/bin/zrancid.in
^
|
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: zrancid.in 2246 2010-09-08 01:36:07Z heas $
+## $Id: zrancid.in 2279 2011-01-31 22:41:00Z heas $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -370,7 +370,7 @@
} else {
print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
- if (defined($ENV{NOPIPE})) {
+ if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
system "clogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "clogin failed for $host: $!\n";
open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
} else {
@@ -442,7 +442,7 @@
close(INPUT);
close(OUTPUT);
-if (defined($ENV{NOPIPE})) {
+if (defined($ENV{NOPIPE}) && $ENV{NOPIPE} =~ /^YES/i) {
unlink("$host.raw") if (! $debug);
}
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/configure
^
|
@@ -669,6 +669,7 @@
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+COPYYEARS
PACKAGE
VERSION
target_alias
@@ -2205,6 +2206,8 @@
PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '`
+COPYYEARS="1997-2011"
+
am__api_version='1.11'
@@ -6057,6 +6060,8 @@
ac_config_files="$ac_config_files bin/mrancid bin/mrvlogin bin/mrvrancid"
+ac_config_files="$ac_config_files bin/mtrancid bin/mtlogin"
+
ac_config_files="$ac_config_files bin/nlogin bin/nrancid"
ac_config_files="$ac_config_files bin/nslogin bin/nsrancid"
@@ -6846,6 +6851,8 @@
"bin/mrancid") CONFIG_FILES="$CONFIG_FILES bin/mrancid" ;;
"bin/mrvlogin") CONFIG_FILES="$CONFIG_FILES bin/mrvlogin" ;;
"bin/mrvrancid") CONFIG_FILES="$CONFIG_FILES bin/mrvrancid" ;;
+ "bin/mtrancid") CONFIG_FILES="$CONFIG_FILES bin/mtrancid" ;;
+ "bin/mtlogin") CONFIG_FILES="$CONFIG_FILES bin/mtlogin" ;;
"bin/nlogin") CONFIG_FILES="$CONFIG_FILES bin/nlogin" ;;
"bin/nrancid") CONFIG_FILES="$CONFIG_FILES bin/nrancid" ;;
"bin/nslogin") CONFIG_FILES="$CONFIG_FILES bin/nslogin" ;;
@@ -7576,6 +7583,8 @@
"bin/mrancid":F) chmod a+x $ac_file ;;
"bin/mrvlogin":F) chmod a+x $ac_file ;;
"bin/mrvrancid":F) chmod a+x $ac_file ;;
+ "bin/mtrancid":F) chmod a+x $ac_file ;;
+ "bin/mtlogin":F) chmod a+x $ac_file ;;
"bin/nlogin":F) chmod a+x $ac_file ;;
"bin/nrancid":F) chmod a+x $ac_file ;;
"bin/nslogin":F) chmod a+x $ac_file ;;
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/configure.in
^
|
@@ -9,6 +9,8 @@
PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '`
AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
+COPYYEARS="1997-2011"
+AC_SUBST(COPYYEARS)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, rancid@shrubbery.net)
@@ -462,6 +464,7 @@
AC_CONFIG_FILES(bin/htlogin bin/htrancid, [chmod a+x $ac_file])
AC_CONFIG_FILES(bin/jlogin bin/jrancid bin/jerancid, [chmod a+x $ac_file])
AC_CONFIG_FILES(bin/mrancid bin/mrvlogin bin/mrvrancid, [chmod a+x $ac_file])
+AC_CONFIG_FILES(bin/mtrancid bin/mtlogin, [chmod a+x $ac_file])
AC_CONFIG_FILES(bin/nlogin bin/nrancid, [chmod a+x $ac_file])
AC_CONFIG_FILES(bin/nslogin bin/nsrancid, [chmod a+x $ac_file])
AC_CONFIG_FILES(bin/nxrancid, [chmod a+x $ac_file])
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/etc/Makefile.in
^
|
@@ -86,6 +86,7 @@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/etc/rancid.conf.sample.in
^
|
@@ -5,6 +5,9 @@
#
TERM=network;export TERM
#
+# Collating locale
+LC_COLLATE="POSIX"; export LC_COLLATE
+#
# Create files w/o world read/write/exec permissions, but read/exec permissions
# for group.
umask 027
@@ -17,10 +20,18 @@
# Use a full path (no sym-links) for BASEDIR.
#
TMPDIR=/tmp; export TMPDIR
-# Be careful changing this, it affects CVSROOT below.
+# Be careful changing this, it affects CVSROOT below. It should be a FQPN, not
+# relative.
BASEDIR=@localstatedir@; export BASEDIR
PATH=@bindir@:@ENV_PATH@; export PATH
# Location of the CVS/SVN repository. Be careful changing this.
+# If RCSSYS is svn, this can be:
+# - an (absolute) path (a subdirectory of BASEDIR by default).
+# - any URL that subversion understands, but beware that:
+# - no attempt will be made to create the repository when running rancid-cvs.
+# - authentication credentials, if necessary, MUST be cached (see the SVN
+# book, Ch. 3, Network Model, Caching credentials) before non-interactive
+# commands can run, e.g. by running rancid-cvs after installation.
CVSROOT=$BASEDIR/CVS; export CVSROOT
# Location of log files produced by rancid-run(1).
LOGDIR=$BASEDIR/logs; export LOGDIR
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/include/Makefile.in
^
|
@@ -68,6 +68,7 @@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/include/version.h
^
|
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.6";
+char version[] = "2.3.8";
#endif
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/include/version.h.in
^
|
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.6";
+char version[] = "2.3.8";
#endif
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/man/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 2261 2010-10-11 21:11:02Z heas $
+## $Id: Makefile.am 2294 2011-04-26 18:11:32Z heas $
##
## Copyright (c) 1997-2007 by Terrapin Communications, Inc.
## All rights reserved.
@@ -55,11 +55,12 @@
cloginrc.5 control_rancid.1 cssrancid.1 elogin.1 erancid.1 \
f5rancid.1 f10rancid.1 flogin.1 fnlogin.1 fnrancid.1 francid.1 \
hlogin.1 hrancid.1 htlogin.1 htrancid.1 jerancid.1 jlogin.1 \
- jrancid.1 mrancid.1 mrvlogin.1 mrvrancid.1 nlogin.1 nrancid.1 \
- nslogin.1 nsrancid.1 nxrancid.1 par.1 prancid.1 rancid-cvs.1 \
- rancid-run.1 rancid.1 rancid_intro.1 rivlogin.1 rivrancid.1 \
- router.db.5 rrancid.1 srancid.1 tlogin.1 tntlogin.1 \
- tntrancid.1 trancid.1 xrancid.1 xrrancid.1 zrancid.1
+ jrancid.1 mrancid.1 mrvlogin.1 mrvrancid.1 mtlogin.1 \
+ mtrancid.1 nlogin.1 nrancid.1 nslogin.1 nsrancid.1 nxrancid.1 \
+ par.1 prancid.1 rancid-cvs.1 rancid-run.1 rancid.1 \
+ rancid_intro.1 rivlogin.1 rivrancid.1 router.db.5 rrancid.1 \
+ srancid.1 tlogin.1 tntlogin.1 tntrancid.1 trancid.1 xrancid.1 \
+ xrrancid.1 zrancid.1
man_MANS = $(man_nogen_MANS) $(man_gen_MANS)
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/man/Makefile.in
^
|
@@ -90,6 +90,7 @@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
@@ -200,11 +201,12 @@
cloginrc.5 control_rancid.1 cssrancid.1 elogin.1 erancid.1 \
f5rancid.1 f10rancid.1 flogin.1 fnlogin.1 fnrancid.1 francid.1 \
hlogin.1 hrancid.1 htlogin.1 htrancid.1 jerancid.1 jlogin.1 \
- jrancid.1 mrancid.1 mrvlogin.1 mrvrancid.1 nlogin.1 nrancid.1 \
- nslogin.1 nsrancid.1 nxrancid.1 par.1 prancid.1 rancid-cvs.1 \
- rancid-run.1 rancid.1 rancid_intro.1 rivlogin.1 rivrancid.1 \
- router.db.5 rrancid.1 srancid.1 tlogin.1 tntlogin.1 \
- tntrancid.1 trancid.1 xrancid.1 xrrancid.1 zrancid.1
+ jrancid.1 mrancid.1 mrvlogin.1 mrvrancid.1 mtlogin.1 \
+ mtrancid.1 nlogin.1 nrancid.1 nslogin.1 nsrancid.1 nxrancid.1 \
+ par.1 prancid.1 rancid-cvs.1 rancid-run.1 rancid.1 \
+ rancid_intro.1 rivlogin.1 rivrancid.1 router.db.5 rrancid.1 \
+ srancid.1 tlogin.1 tntlogin.1 tntrancid.1 trancid.1 xrancid.1 \
+ xrrancid.1 zrancid.1
man_MANS = $(man_nogen_MANS) $(man_gen_MANS)
EXTRA_DIST = $(man_nogen_MANS) $(man_gen_MANS:%=%.in)
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/man/clogin.1
^
|
@@ -1,8 +1,8 @@
.\"
.hys 50
-.TH "clogin" "1" "8 October 2010"
+.TH "clogin" "1" "26 April 2011"
.SH NAME
-clogin \- Cisco/Foundry login script
+clogin \- Cisco login script
.SH SYNOPSIS
.B clogin
[\fB\-autoenable\fP]
@@ -59,10 +59,11 @@
Bay Networks (nortel),
ADC-kentrox EZ-T3 mux,
Foundry,
-HP Procurve Switches and Cisco AGMs,
-Hitachi Routers,
+HP Procurve switches and Cisco AGMs,
+Hitachi routers,
Juniper Networks,
MRV optical switch,
+Mikrotik routers,
Netscreen firewalls,
Netscaler,
Riverstone,
@@ -79,6 +80,7 @@
.B htlogin,
.B jlogin,
.B mrvlogin,
+.B mtlogin,
.B nlogin,
.B nslogin,
.B rivlogin,
|
[-]
[+]
|
Added |
rancid-2.3.8.tar.bz2/man/mtlogin.1
^
|
@@ -0,0 +1 @@
+.so man1/clogin.1
|
[-]
[+]
|
Added |
rancid-2.3.8.tar.bz2/man/mtrancid.1
^
|
@@ -0,0 +1 @@
+.so man1/rancid.1
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/man/rancid.1
^
|
@@ -1,6 +1,6 @@
.\"
.hys 50
-.TH "rancid" "1" "8 April 2010"
+.TH "rancid" "1" "26 April 2011"
.SH NAME
rancid \- Cisco configuration filter
.SH SYNOPSIS
@@ -77,6 +77,9 @@
.B mrvrancid
MRV optical switches
.TP
+.B mtrancid
+Mikrotik routesrs
+.TP
.B nrancid
Netscreen firewalls
.TP
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/man/router.db.5
^
|
@@ -1,6 +1,6 @@
.\"
.hys 50
-.TH "router.db" "5" "8 April 2010"
+.TH "router.db" "5" "24 April 2011"
.SH NAME
router.db \- rancid group configuration file
.SH DESCRIPTION
@@ -142,6 +142,9 @@
.B juniper
A Juniper router.
.TP
+.B mikrotik
+A Mikrotik router.
+.TP
.B mrtd
A host running the (Merit) MRTd daemon.
.TP
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/share/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 1955 2008-03-06 07:49:59Z heas $
+## $Id: Makefile.am 2301 2011-05-26 20:55:24Z heas $
##
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
@@ -48,14 +48,14 @@
#AUTOMAKE_OPTIONS=foreign no-dependencies
AUTOMAKE_OPTIONS=foreign
-pkgdata_SCRIPTS= rtrfilter downreport
+pkgdata_SCRIPTS= rancid-cvspurge rtrfilter downreport
dist_pkgdata_SCRIPTS=getipacctg
dist_pkgdata_DATA=README.misc cisco-load.exp cisco-reload.exp \
index.html lgnotes.html
-EXTRA_DIST = rancid.spec rtrfilter.in downreport.in
+EXTRA_DIST = rancid-cvspurge.in rancid.spec rtrfilter.in downreport.in
-CLEANFILES= downreport
+CLEANFILES= rancid-cvspurge downreport
all:
@@ -76,3 +76,9 @@
$(auto_edit) $(srcdir)/downreport.in >downreport.tmp; \
chmod +x downreport.tmp; \
mv downreport.tmp downreport
+
+rancid-cvspurge: Makefile $(srcdir)/rancid-cvspurge.in
+ rm -f rancid-cvspurge rancid-cvspurge.tmp; \
+ $(auto_edit) $(srcdir)/rancid-cvspurge.in >rancid-cvspurge.tmp; \
+ chmod +x rancid-cvspurge.tmp; \
+ mv rancid-cvspurge.tmp rancid-cvspurge
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/share/Makefile.in
^
|
@@ -91,6 +91,7 @@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMM = @COMM@
+COPYYEARS = @COPYYEARS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
@@ -197,13 +198,13 @@
#AUTOMAKE_OPTIONS=foreign no-dependencies
AUTOMAKE_OPTIONS = foreign
-pkgdata_SCRIPTS = rtrfilter downreport
+pkgdata_SCRIPTS = rancid-cvspurge rtrfilter downreport
dist_pkgdata_SCRIPTS = getipacctg
dist_pkgdata_DATA = README.misc cisco-load.exp cisco-reload.exp \
index.html lgnotes.html
-EXTRA_DIST = rancid.spec rtrfilter.in downreport.in
-CLEANFILES = downreport
+EXTRA_DIST = rancid-cvspurge.in rancid.spec rtrfilter.in downreport.in
+CLEANFILES = rancid-cvspurge downreport
# auto_edit does the autoconf variable substitution. This allows the
# substitution to have the full expansion of the variables, e.g.: $sysconfdir
@@ -503,6 +504,12 @@
chmod +x downreport.tmp; \
mv downreport.tmp downreport
+rancid-cvspurge: Makefile $(srcdir)/rancid-cvspurge.in
+ rm -f rancid-cvspurge rancid-cvspurge.tmp; \
+ $(auto_edit) $(srcdir)/rancid-cvspurge.in >rancid-cvspurge.tmp; \
+ chmod +x rancid-cvspurge.tmp; \
+ mv rancid-cvspurge.tmp rancid-cvspurge
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
|
[-]
[+]
|
Added |
rancid-2.3.8.tar.bz2/share/rancid-cvspurge.in
^
|
@@ -0,0 +1,80 @@
+#! /bin/sh
+##
+## $Id: downreport.in 2096 2009-06-17 21:49:46Z heas $
+##
+## Copyright (c) 1997-2007 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
+##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
+#
+# The expect login scripts were based on Erik Sherk's gwtn, by permission.
+#
+# The original looking glass software was written by Ed Kern, provided by
+# permission and modified beyond recognition.
+#
+# Purges old versions of configurations from the CVS repostiory.
+#
+# From Matthew J. Grossman
+#
+
+ENVFILE="@sysconfdir@/rancid.conf"
+
+. $ENVFILE
+
+if [ $RCSSYS != "cvs" ] ; then
+ echo "$0 is for CVS only. RCSSYS is not set to CVS in rancid.conf." >&2
+ exit 1
+fi
+
+if [ $# -ge 1 ] ; then
+ LIST_OF_GROUPS="$*"
+elif [ "$LIST_OF_GROUPS" = "" ] ; then
+ echo "LIST_OF_GROUPS is empty in $ENVFILE" >&2
+ exit 1
+fi
+
+for GROUP in $LIST_OF_GROUPS; do
+ cd $BASEDIR/$GROUP/configs > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ echo "$BASEDIR/$GROUP/configs not found" >&2
+ continue;
+ fi
+ for ENTRY in `grep ^/ CVS/Entries | cut -d/ -f2,3`
+ do
+ ROUTER=`echo $ENTRY | cut -d/ -f1`
+ VERSION=`echo $ENTRY | cut -d/ -f2`
+ cvs admin -o ::$VERSION $ROUTER
+ done
+done
|
[-]
[+]
|
Changed |
rancid-2.3.8.tar.bz2/share/rancid.spec
^
|
@@ -1,5 +1,5 @@
Name: rancid
-Version: 2.3.6
+Version: 2.3.7
Release: 1%{?dist}
Summary: Really Awesome New Cisco confIg Differ
@@ -72,7 +72,7 @@
%defattr(-,root,root,0755)
%doc BUGS CHANGES COPYING FAQ README UPGRADING Todo
%doc share/cisco-load.exp share/cisco-reload.exp
-%doc share/downreport share/getipacctg share/rtrfilter
+%doc share/rancid-cvspurge share/downreport share/getipacctg share/rtrfilter
%config(noreplace) /etc/rancid.conf
%{_bindir}/*
%{_mandir}/man1/[a-k]*
|