init III
This commit is contained in:
1020
Perl Cisco konfigurieren/connect.log
Normal file
1020
Perl Cisco konfigurieren/connect.log
Normal file
File diff suppressed because it is too large
Load Diff
87
Perl Cisco konfigurieren/router.pl
Normal file
87
Perl Cisco konfigurieren/router.pl
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/bin/perl
|
||||
|
||||
use Net::Telnet::Cisco;
|
||||
|
||||
sub LOG ($);
|
||||
|
||||
open RTR, "<router_list.txt";
|
||||
while (<RTR>) {
|
||||
if ($_ =~ /^#/) {
|
||||
print $_;
|
||||
next;
|
||||
}
|
||||
chomp;
|
||||
($ip,$user,$pass,$enable,$wait)=$_=~/^(.*),(.*),(.*),(.*),(.*)$/i;
|
||||
$wait=10 if ($wait eq "");
|
||||
# print "$ip,$user,$pass,$enable,$wait\n";
|
||||
@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;
|
||||
|
||||
my @commands;
|
||||
open CMD, "<router_config.txt";
|
||||
foreach (<CMD>) {
|
||||
if ($_ =~ /^#/) {
|
||||
print $_;
|
||||
next;
|
||||
}
|
||||
chomp unless ($_ =~ /^\n$/);
|
||||
@commands=(@commands,$_);
|
||||
}
|
||||
close CMD;
|
||||
|
||||
|
||||
foreach my $router (@routers) {
|
||||
print "\nVerbinde zu $$router[0]\n";
|
||||
|
||||
# LOG "Verbindungsversuch zu $$router[0]";
|
||||
|
||||
next unless ($session = Net::Telnet::Cisco->new(Host => "$$router[0]", Errmode=>'return'));
|
||||
|
||||
# LOG "Verbindung zu $$router[0] erfolgreich hergestellt";
|
||||
|
||||
if ($$router[1] eq '') {
|
||||
print "sende Passwort\n";
|
||||
$session->login(Password => "$$router[2]");
|
||||
}
|
||||
else {
|
||||
print "sende user, pw\n";
|
||||
$session->login(Name => "$$router[1]", Password => "$$router[2]");
|
||||
}
|
||||
|
||||
print "enable\n";
|
||||
$session->cmd("enable\n$$router[3]") if ($$router[3] ne "");
|
||||
|
||||
# LOG "$$router[0] !!! Sende Befehle";
|
||||
|
||||
foreach (@commands) {
|
||||
print "$$router[0] $_\n";
|
||||
@output = $session->cmd(String=>"$_", Timeout => 1);
|
||||
}
|
||||
|
||||
# LOG "Ausgabe des Routers\n@output";
|
||||
|
||||
# LOG "Ende und Speichern\n-------------------------------------------";
|
||||
$session->cmd("end");
|
||||
$session->cmd("wr");
|
||||
sleep ($$router[4]);
|
||||
|
||||
print "\n\n";
|
||||
|
||||
}
|
||||
|
||||
sub LOG {
|
||||
open LOGG, ">>connect.log";
|
||||
printf LOGG "$_[0]\n";
|
||||
close LOGG;
|
||||
}
|
||||
34
Perl Cisco konfigurieren/router_config.txt
Normal file
34
Perl Cisco konfigurieren/router_config.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
#Alle Befehle wie auf der Router Konsole eingeben
|
||||
#Für ip accounting auf f0/0 aktivierung also
|
||||
#conf t
|
||||
#int f0/0
|
||||
#ip acco
|
||||
#
|
||||
#Abschließend wird ein automatisches 'end' 'write' durchgeführt
|
||||
#
|
||||
#Benötigt ein Befehl eine besondere Bestätigung wie z.b. reload, clear count
|
||||
#einfach eine leerzeile (keine leerzeichen) eingeben
|
||||
#bsp
|
||||
#clear count
|
||||
#LEERZEILE
|
||||
#reload
|
||||
#Hier auch nur eine neue Zeile
|
||||
conf t
|
||||
no access-list 99
|
||||
access-list 99 remark ---- monitoring
|
||||
access-list 99 permit 10.10.12.32 0.0.0.15
|
||||
access-list 99 remark ---- ICF_SYS
|
||||
access-list 99 permit 10.61.1.8 0.0.0.7
|
||||
access-list 99 remark ---- Zugang ueber Bismarck, Barschel, Hades
|
||||
access-list 99 permit 62.80.98.68
|
||||
access-list 99 permit 62.80.98.69
|
||||
access-list 99 permit 62.80.98.81
|
||||
access-list 99 remark ---- Zugriff aus dem Netz in dem Router ist 248 - 254
|
||||
access-list 99 permit 0.0.0.248 255.255.255.7
|
||||
access-list 99 remark ---- Zugriff vom DGW
|
||||
access-list 99 permit 0.0.0.0 255.255.255.3
|
||||
access-list 99 remark ---- Zugriff aus Transfernetz ueber DDV vom anderen Router
|
||||
access-list 99 permit 192.168.20.0 0.0.0.255
|
||||
access-list 99 permit 192.168.21.0 0.0.0.255
|
||||
access-list 99 remark ---- Alle anderen Verbindungsversuche werden geblockt
|
||||
access-list 99 deny any
|
||||
158
Perl Cisco konfigurieren/router_list.txt
Normal file
158
Perl Cisco konfigurieren/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