init II
This commit is contained in:
122
CISCO backup config via Perl telnet modul/router.pl
Normal file
122
CISCO backup config via Perl telnet modul/router.pl
Normal file
@@ -0,0 +1,122 @@
|
||||
#!/bin/perl
|
||||
|
||||
use Net::Telnet::Cisco;
|
||||
|
||||
$wait="";
|
||||
open RTR, "<router_list.txt";
|
||||
while (<RTR>) {
|
||||
next if ($_ =~ /^#/);
|
||||
chomp;
|
||||
($ip,$user,$pass,$enable,$wait)=$_=~/^(.*),(.*),(.*),(.*),(.*)$/i;
|
||||
$wait=5 if ($wait eq "");
|
||||
@routers=(@routers,[$ip,$user,$pass,$enable,$wait]);
|
||||
}
|
||||
close RTR;
|
||||
|
||||
my $session;
|
||||
my @output;
|
||||
|
||||
my ($ss,$mm,$hh,$dd,$mon,$yy,$we,$doy,$st)=localtime;
|
||||
$mon++;
|
||||
$yy+=1900;
|
||||
$dd = '0' . $dd if ($dd < 10);
|
||||
$mon = '0' . $mon if ($mon < 10);
|
||||
my $date=$yy . "-" . $mon . "-" . $dd;
|
||||
mkdir $date;
|
||||
|
||||
foreach my $router (@routers) {
|
||||
print "$$router[0] connect\n";
|
||||
|
||||
next unless ($session = Net::Telnet::Cisco->new(Host => "$$router[0]", Errmode=>'return'));
|
||||
|
||||
if ($$router[1] eq '') {
|
||||
print "$$router[0] send pw\n";
|
||||
$session->login(Password => "$$router[2]");
|
||||
}
|
||||
else {
|
||||
print "$$router[0] send user, pw\n";
|
||||
$session->login(Name => "$$router[1]", Password => "$$router[2]");
|
||||
}
|
||||
|
||||
print "$$router[0] enable\n";
|
||||
$session->cmd("enable\n$$router[3]") if ($$router[3] ne "");
|
||||
|
||||
print "$$router[0] sh runn\n";
|
||||
@output = $session->cmd('show running');
|
||||
|
||||
open OUT, ">$date\\$$router[0]_running.txt";
|
||||
print OUT @output;
|
||||
close OUT;
|
||||
|
||||
sleep($$router[4]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#$ok = $obj->login($username, $password);#
|
||||
#
|
||||
# $ok = $obj->login([Name => $username,]
|
||||
# [Password => $password,]
|
||||
# [Passcode => $passcode,] # for Secur-ID/XTACACS
|
||||
# [Prompt => $match,]
|
||||
# [Timeout => $secs,]);
|
||||
|
||||
|
||||
|
||||
#$session = Net::Telnet::Cisco->new(
|
||||
# [Autopage => $boolean,] # 1
|
||||
# [More_prompt => $matchop,] # '/(?m:^\s*--More--)/',
|
||||
# [Always_waitfor_prompt => $boolean,] # 1
|
||||
# [Waitfor_pause => $milliseconds,] # 0.1
|
||||
# [Normalize_cmd => $boolean,] # 1
|
||||
# [Send_wakeup => $when,] # 0
|
||||
# [Ignore_warnings => $boolean,] # 0
|
||||
# [Warnings => $matchop,] # see docs
|
||||
#
|
||||
# # Net::Telnet arguments
|
||||
# [Binmode => $mode,]
|
||||
# [Cmd_remove_mode => $mode,]
|
||||
# [Dump_Log => $filename,]
|
||||
# [Errmode => $errmode,]
|
||||
# [Fhopen => $filehandle,]
|
||||
# [Host => $host,]
|
||||
# [Input_log => $file,]
|
||||
# [Input_record_separator => $char,]
|
||||
# [Option_log => $file,]
|
||||
# [Output_log => $file,]
|
||||
# [Output_record_separator => $char,]
|
||||
# [Port => $port,]
|
||||
# [Prompt => $matchop,] # see docs
|
||||
# [Telnetmode => $mode,]
|
||||
# [Timeout => $secs,]
|
||||
# );
|
||||
|
||||
|
||||
|
||||
#if ($session->enable("enable_password"))
|
||||
#$session->errmsg;
|
||||
|
||||
|
||||
|
||||
# my $protocol = ''; # default value
|
||||
# my $ip = '10.0.0.1';
|
||||
# my $repeat = 10;
|
||||
# my $datagram = 1500;
|
||||
# my $timeout = ''; # default value
|
||||
# my $extended = ''; # default value
|
||||
# my $sweep = ''; # default value
|
||||
|
||||
# $session->cmd(
|
||||
# "ping
|
||||
# $protocol
|
||||
# $ip
|
||||
# $repeat
|
||||
# $datagram
|
||||
# $timeout
|
||||
# $extended
|
||||
# $sweep
|
||||
# ");
|
||||
158
CISCO backup config via Perl telnet modul/router_list.txt
Normal file
158
CISCO backup config via Perl telnet modul/router_list.txt
Normal file
@@ -0,0 +1,158 @@
|
||||
10.10.10.3,robin,LTBEsal37,prog,
|
||||
10.10.10.4,robin,LTBEsal37,prog,
|
||||
10.10.10.5,robin,LTBEsal37,prog,
|
||||
10.10.10.6,robin,LTBEsal37,prog,
|
||||
10.10.10.7,robin,LTBEsal37,prog,
|
||||
10.10.10.8,robin,LTBEsal37,prog,
|
||||
10.10.10.9,robin,LTBEsal37,prog,
|
||||
10.10.10.12,robin,LTBEsal37,prog,
|
||||
10.10.10.17,robin,LTBEsal37,prog,
|
||||
10.10.10.18,robin,LTBEsal37,prog,
|
||||
10.10.10.21,robin,LTBEsal37,prog,
|
||||
10.10.10.23,robin,LTBEsal37,prog,
|
||||
10.10.10.25,robin,LTBEsal37,prog,
|
||||
10.10.10.26,robin,LTBEsal37,prog,
|
||||
10.10.10.27,robin,LTBEsal37,prog,
|
||||
10.10.10.29,robin,LTBEsal37,prog,
|
||||
10.10.10.34,robin,LTBEsal37,prog,
|
||||
10.10.10.35,robin,LTBEsal37,prog,
|
||||
10.10.10.37,robin,LTBEsal37,prog,
|
||||
10.10.10.46,robin,LTBEsal37,prog,
|
||||
10.10.10.47,robin,LTBEsal37,prog,
|
||||
10.10.10.48,robin,LTBEsal37,prog,
|
||||
10.10.10.49,robin,LTBEsal37,prog,
|
||||
10.10.10.50,robin,LTBEsal37,prog,
|
||||
10.10.10.101,robin,LTBEsal37,prog,
|
||||
10.10.10.102,robin,LTBEsal37,prog,
|
||||
10.10.10.107,robin,LTBEsal37,prog,
|
||||
10.10.10.108,robin,LTBEsal37,prog,
|
||||
10.10.10.109,robin,LTBEsal37,prog,
|
||||
10.10.10.125,robin,LTBEsal37,prog,
|
||||
10.10.10.177,robin,LTBEsal37,prog,
|
||||
10.10.10.250,robin,LTBEsal37,prog,
|
||||
10.10.10.251,robin,LTBEsal37,prog,
|
||||
10.10.10.252,robin,LTBEsal37,prog,
|
||||
10.10.12.1,robin,LTBEsal37,prog,
|
||||
10.10.12.251,robin,LTBEsal37,prog,
|
||||
10.10.12.252,robin,LTBEsal37,prog,
|
||||
10.10.12.253,robin,LTBEsal37,prog,
|
||||
10.10.30.17,robin,LTBEsal37,prog,
|
||||
10.10.30.97,robin,LTBEsal37,prog,
|
||||
10.10.30.98,robin,LTBEsal37,prog,
|
||||
10.10.30.99,robin,LTBEsal37,prog,
|
||||
10.10.70.21,robin,LTBEsal37,prog,
|
||||
10.10.70.24,robin,LTBEsal37,prog,
|
||||
10.10.70.25,robin,LTBEsal37,prog,
|
||||
10.10.70.27,robin,LTBEsal37,prog,
|
||||
10.10.70.28,robin,LTBEsal37,prog,
|
||||
10.10.70.250,robin,LTBEsal37,prog,
|
||||
10.10.70.251,robin,LTBEsal37,prog,
|
||||
10.10.70.254,robin,LTBEsal37,prog,
|
||||
10.60.1.100,robin,LTBEsal37,,
|
||||
10.80.1.2,robin,LTBEsal37,prog,
|
||||
10.80.1.253,robin,LTBEsal37,prog,
|
||||
10.80.1.254,robin,LTBEsal37,prog,
|
||||
10.80.13.11,robin,LTBEsal37,prog,
|
||||
10.80.13.12,robin,LTBEsal37,prog,
|
||||
10.80.13.21,robin,LTBEsal37,prog,
|
||||
10.80.13.22,robin,LTBEsal37,prog,
|
||||
10.90.1.1,robin,LTBEsal37,prog,
|
||||
10.90.1.2,robin,LTBEsal37,prog,
|
||||
10.90.1.3,robin,LTBEsal37,prog,
|
||||
130.35.0.1,robin,LTBEsal37,prog,
|
||||
130.35.0.253,robin,LTBEsal37,prog,
|
||||
130.35.0.17,robin,LTBEsal37,,
|
||||
130.35.0.18,robin,LTBEsal37,prog,
|
||||
130.35.0.19,robin,LTBEsal37,prog,
|
||||
130.35.0.28,robin,LTBEsal37,prog,
|
||||
130.35.0.29,robin,LTBEsal37,prog,
|
||||
192.169.1.13,robin,LTBEsal37,prog,
|
||||
192.169.1.21,robin,LTBEsal37,prog,
|
||||
192.169.1.22,robin,LTBEsal37,prog,
|
||||
192.169.1.23,robin,LTBEsal37,prog,
|
||||
192.169.1.81,robin,LTBEsal37,prog,
|
||||
192.169.1.82,robin,LTBEsal37,prog,
|
||||
192.169.1.83,robin,LTBEsal37,prog,
|
||||
193.169.55.248,robin,LTBEsal37,prog,
|
||||
193.169.55.249,robin,LTBEsal37,prog,
|
||||
170.250.1.22,robin,LTBEsal37,prog,
|
||||
170.250.1.101,robin,LTBEsal37,prog,
|
||||
170.250.1.102,robin,LTBEsal37,prog,
|
||||
170.250.1.253,robin,LTBEsal37,prog,
|
||||
170.11.1.1,robin,LTBEsal37,prog,
|
||||
170.11.1.4,robin,LTBEsal37,prog,
|
||||
170.11.1.5,robin,LTBEsal37,prog,
|
||||
170.11.1.6,robin,LTBEsal37,prog,
|
||||
170.11.1.253,robin,LTBEsal37,prog,
|
||||
170.11.1.254,robin,LTBEsal37,prog,
|
||||
170.15.1.1,robin,LTBEsal37,prog,
|
||||
170.20.1.1,robin,LTBEsal37,prog,
|
||||
170.20.1.2,robin,LTBEsal37,prog,
|
||||
170.20.1.3,robin,LTBEsal37,prog,
|
||||
170.20.1.9,robin,LTBEsal37,prog,
|
||||
170.21.1.1,robin,LTBEsal37,prog,
|
||||
170.24.1.2,robin,LTBEsal37,prog,
|
||||
170.24.1.3,robin,LTBEsal37,prog,
|
||||
170.40.1.1,robin,LTBEsal37,prog,
|
||||
170.40.1.4,robin,LTBEsal37,prog,
|
||||
170.40.1.5,robin,LTBEsal37,prog,
|
||||
170.40.1.253,robin,LTBEsal37,prog,
|
||||
170.40.1.254,robin,LTBEsal37,prog,
|
||||
170.43.1.1,robin,LTBEsal37,prog,
|
||||
170.43.1.2,robin,LTBEsal37,prog,
|
||||
170.45.1.1,robin,LTBEsal37,prog,
|
||||
170.45.1.2,robin,LTBEsal37,prog,
|
||||
170.45.1.4,robin,LTBEsal37,prog,
|
||||
170.45.2.4,robin,LTBEsal37,prog,
|
||||
170.45.1.3,robin,LTBEsal37,prog,
|
||||
170.50.1.1,robin,LTBEsal37,prog,
|
||||
170.50.1.2,robin,LTBEsal37,prog,
|
||||
170.50.1.3,robin,LTBEsal37,prog,
|
||||
170.60.2.1,robin,LTBEsal37,prog,
|
||||
170.60.2.3,robin,LTBEsal37,prog,
|
||||
170.60.2.5,robin,LTBEsal37,prog,
|
||||
170.60.2.7,robin,LTBEsal37,prog,
|
||||
170.60.2.8,robin,LTBEsal37,prog,
|
||||
170.60.2.10,robin,LTBEsal37,prog,
|
||||
170.60.2.14,robin,LTBEsal37,prog,
|
||||
170.60.2.15,robin,LTBEsal37,prog,
|
||||
170.60.2.19,robin,LTBEsal37,prog,
|
||||
170.60.2.20,robin,LTBEsal37,prog,
|
||||
170.61.3.1,robin,LTBEsal37,prog,
|
||||
170.61.4.1,robin,LTBEsal37,prog,
|
||||
170.61.5.1,robin,LTBEsal37,prog,
|
||||
170.61.6.1,robin,LTBEsal37,prog,
|
||||
170.61.7.1,robin,LTBEsal37,prog,
|
||||
170.250.1.22,robin,LTBEsal37,prog,
|
||||
170.250.1.101,robin,LTBEsal37,prog,
|
||||
170.250.1.102,robin,LTBEsal37,prog,
|
||||
170.250.1.253,robin,LTBEsal37,prog,
|
||||
170.250.2.1,robin,LTBEsal37,prog,
|
||||
170.250.2.101,robin,LTBEsal37,prog,
|
||||
170.250.2.102,robin,LTBEsal37,prog,
|
||||
170.253.4.16,robin,LTBEsal37,prog,
|
||||
170.253.4.17,robin,LTBEsal37,prog,
|
||||
192.168.99.25,robin,LTBEsal37,prog,
|
||||
192.168.104.42,,actissec,actisen,
|
||||
192.168.104.43,,actissec,actisen,
|
||||
10.1.6.1,robin,LTBEsal37,prog,
|
||||
10.1.6.2,robin,LTBEsal37,prog,
|
||||
10.1.6.3,robin,LTBEsal37,prog,
|
||||
10.1.7.1,robin,LTBEsal37,prog,
|
||||
10.1.8.1,robin,LTBEsal37,prog,
|
||||
10.1.8.254,robin,LTBEsal37,prog,
|
||||
91.33.211.21,robin,LTBEsal37,prog,
|
||||
91.33.211.22,robin,LTBEsal37,prog,
|
||||
91.33.211.31,robin,LTBEsal37,prog,
|
||||
91.33.211.32,robin,LTBEsal37,prog,
|
||||
92.254.253.25,robin,LTBEsal37,prog,
|
||||
92.254.253.26,robin,LTBEsal37,prog,
|
||||
92.254.253.31,robin,LTBEsal37,prog,
|
||||
92.254.253.33,robin,LTBEsal37,prog,
|
||||
92.254.253.253,robin,LTBEsal37,prog,
|
||||
94.200.15.22,robin,LTBEsal37,prog,
|
||||
94.200.15.23,robin,LTBEsal37,prog,
|
||||
90.201.238.21,robin,LTBEsal37,prog,
|
||||
90.201.238.21,robin,LTBEsal37,prog,
|
||||
193.169.55.252,mao,peking08,,
|
||||
193.169.55.253,mao,peking08,,
|
||||
Reference in New Issue
Block a user