=================================================================== RCS file: /cvs/trango/Net-Telnet-Trango/scripts/update_trango.pl,v retrieving revision 1.5 retrieving revision 1.7 diff -u -r1.5 -r1.7 --- trango/Net-Telnet-Trango/scripts/update_trango.pl 2005/11/16 21:39:51 1.5 +++ trango/Net-Telnet-Trango/scripts/update_trango.pl 2005/11/17 20:09:45 1.7 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $RedRiver: update_trango.pl,v 1.4 2005/11/16 21:13:39 andrew Exp $ +# $RedRiver: update_trango.pl,v 1.6 2005/11/17 00:40:06 andrew Exp $ ######################################################################## # update_trango.pl *** Updates trango foxes with a new firmware # @@ -44,14 +44,20 @@ my $host = new Net::Telnet (Timeout => 5, Prompt => '/#> *$/'); mylog("Connecting to $fox"); - $host->open($fox); + unless ( $host->open( Host => $fox, Errmode => 'return') ) { + mylog("Couldn't connect to $fox. Connection timed out.", LOG_SAVE); + next; + } $host->dump_log('dump.log'); ## Login to remote host. - $host->waitfor( + unless ($host->waitfor( -match => '/password: ?$/i', -errmode => "return", - ) or die "problem connecting to host ($fox): ", $host->lastline; + ) ) { + mylog("problem connecting to host ($fox): " . $host->lastline, LOG_SAVE); + next; + } my $login_banner = $host->lastline; my ($type, $version) = $login_banner =~ @@ -327,7 +333,11 @@ next if /^#/; next if /^$/; if ($in_ip_list) { - push @{ $conf{'ips'} }, $_; + if (/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)(\d{1,3})-(\d{1,3})/) { + push @{ $conf{'ips'} }, $1 . $_ for ($2..$3); + } else { + push @{ $conf{'ips'} }, $_; + } } else { my ($key, $val) = split /\s+/, $_, 2; @@ -351,6 +361,8 @@ if (not exists $conf{$_}); } + #print Dump \%conf; + #exit; return \%conf; }