init II
This commit is contained in:
BIN
CISCO ACL edit/Vollbild anzeigen.jpg
Normal file
BIN
CISCO ACL edit/Vollbild anzeigen.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
CISCO ACL edit/aedit.exe
Normal file
BIN
CISCO ACL edit/aedit.exe
Normal file
Binary file not shown.
35
CISCO ACL edit/aedit.perlapp
Normal file
35
CISCO ACL edit/aedit.perlapp
Normal file
@@ -0,0 +1,35 @@
|
||||
#!C:\Program Files (x86)\ActiveState Perl Dev Kit 9.0\bin\perlapp-gui.exe
|
||||
PAP-Version: 1.0
|
||||
Packer: C:\Program Files (x86)\ActiveState Perl Dev Kit 9.0\bin\perlapp.exe
|
||||
Script: aedit.pl
|
||||
Cwd: G:\Skripte\cisco ACL edit
|
||||
Bind: editor.exe[file=editor.exe,extract,mode=777]
|
||||
Clean: 1
|
||||
Date: 2011-08-12 14:15:50
|
||||
Debug:
|
||||
Dependent: 0
|
||||
Dyndll: 0
|
||||
Exe: aedit.exe
|
||||
Force: 1
|
||||
Gui: 0
|
||||
Hostname: NETICFSYS03
|
||||
Icon: cisco.ico
|
||||
Manifest:
|
||||
No-Compress: 0
|
||||
No-Logo: 0
|
||||
Runlib:
|
||||
Shared: none
|
||||
Tmpdir:
|
||||
Verbose: 0
|
||||
Version-Comments:
|
||||
Version-CompanyName:
|
||||
Version-FileDescription:
|
||||
Version-FileVersion: 1.1
|
||||
Version-InternalName: aedit
|
||||
Version-LegalCopyright: Andre Wisniewski
|
||||
Version-LegalTrademarks:
|
||||
Version-OriginalFilename: ACL Editor
|
||||
Version-ProductName: aedit
|
||||
Version-ProductVersion: 1.1
|
||||
Warnings: 0
|
||||
Xclude: 0
|
||||
183
CISCO ACL edit/aedit.pl
Normal file
183
CISCO ACL edit/aedit.pl
Normal file
@@ -0,0 +1,183 @@
|
||||
#!/usr/bin/perl
|
||||
use Net::Telnet::Cisco;
|
||||
use Digest::MD5::File;
|
||||
use Env qw(TEMP USERNAME PID);
|
||||
use strict;
|
||||
|
||||
AGAIN:
|
||||
print "\n\nx beendet\n\n";
|
||||
print "IP:";
|
||||
my $HOST=<STDIN>;
|
||||
chomp $HOST;
|
||||
|
||||
exit if ($HOST eq "x");
|
||||
|
||||
my $session = Net::Telnet::Cisco->new(Host => "$HOST", Errmode=>'return');
|
||||
$session->login(Name => "batman", Password => "LTBTTTra25");
|
||||
my @rcon = $session->cmd('show running');
|
||||
$session->close;
|
||||
|
||||
my @rconfig=(); # führende returns entfernen
|
||||
foreach my $line (@rcon) {
|
||||
chomp $line;
|
||||
if ($line eq "") {next;}
|
||||
elsif ($line =~ /^\n/) {
|
||||
my ($l) = $line =~ /\n(.*)/;
|
||||
push @rconfig,$l;
|
||||
}
|
||||
else {
|
||||
push @rconfig,$line;
|
||||
}
|
||||
}
|
||||
|
||||
my $inint=0;
|
||||
my $intname="";
|
||||
my $inlist="";
|
||||
my $outlist="";
|
||||
my @INTERFACES=();
|
||||
|
||||
foreach my $line (@rconfig) {
|
||||
chomp $line;
|
||||
if ($inint==0) {
|
||||
if ($line =~ /^[\s]*interface/) {
|
||||
($intname)=$line=~/interface (.*)/;
|
||||
$inint=1;
|
||||
#print "$line\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($line =~ /\bip access-group .* in$/) {
|
||||
($inlist)=$line=~/access-group (.*) in/;
|
||||
}
|
||||
if ($line =~ /\bip access-group .* out$/) {
|
||||
($outlist)=$line=~/access-group (.*) out/;
|
||||
}
|
||||
if ($line =~ /^[\s]*!/) {
|
||||
if ($inlist ne "" or $outlist ne "") {
|
||||
push @INTERFACES, "$intname#$inlist#$outlist";
|
||||
}
|
||||
$intname=""; $inlist=""; $outlist="";
|
||||
$inint=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#printf "%2s %20s %20s %20s\n", "ID", "Interface", "ACL in", "ACL out";
|
||||
my $i=0;
|
||||
my @MENU=();
|
||||
print "\n";
|
||||
foreach (@INTERFACES) {
|
||||
my ($int,$in,$out)=split /#/, $_;
|
||||
if ($in ne "") {
|
||||
printf "%2d %30s %30s (in)\n", $i, $int, $in;
|
||||
push @MENU, "$int#$in#in";
|
||||
$i++;
|
||||
|
||||
}
|
||||
if ($out ne "") {
|
||||
printf "%2d %30s %30s(out)\n", $i, $int, $out;
|
||||
push @MENU, "$int#$out#out";
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print "\nWhich ACL do you want to edit?";
|
||||
my $choice=<STDIN>;
|
||||
chomp $choice;
|
||||
exit if ($choice eq "x");
|
||||
print "\n";
|
||||
|
||||
my $int;
|
||||
my $acl;
|
||||
my $dir;
|
||||
($int,$acl,$dir)=split/#/,$MENU[$choice];
|
||||
|
||||
my $rc;
|
||||
$rc=join "\n",@rconfig;
|
||||
|
||||
my $ACCESS="";
|
||||
my $CONTENT=""; #[\s]*
|
||||
($ACCESS,$CONTENT)= $rc =~ /(ip access-list extended $acl\n(([\s]+[permit|deny|remark].*\n)*))/m;
|
||||
my @CONT=split/\n/,$CONTENT;
|
||||
|
||||
open TEMPF, ">temp$$.txt";
|
||||
foreach (@CONT) {
|
||||
printf TEMPF "$_\n";
|
||||
}
|
||||
close TEMPF;
|
||||
|
||||
#print "$TEMP\\pdk-$USERNAME-$$\\"; <STDIN>;
|
||||
|
||||
my $olddigest = Digest::MD5::File::file_md5_hex("temp$$.txt");
|
||||
system "$TEMP\\pdk-$USERNAME-$$\\editor.exe temp$$.txt";
|
||||
#system "editor.exe temp$$.txt";
|
||||
my $newdigest = Digest::MD5::File::file_md5_hex("temp$$.txt");
|
||||
|
||||
if ($newdigest ne $olddigest) {
|
||||
print "Save changes? YES saves!";
|
||||
my $save=<STDIN>;
|
||||
chomp $save;
|
||||
if ($save eq "YES") {
|
||||
print "SAVING\n";
|
||||
# telnet
|
||||
$session = Net::Telnet::Cisco->new(Host => "$HOST", Errmode=>'return');
|
||||
$session->login(Name => "batman", Password => "LTBTTTra25");
|
||||
|
||||
# conf t
|
||||
$session->cmd('conf t');
|
||||
|
||||
# int $int
|
||||
$session->cmd("interface $int");
|
||||
|
||||
# no ip access-group $acl $dir
|
||||
$session->cmd("no ip access-group $acl $dir");
|
||||
|
||||
# exit
|
||||
$session->cmd("exit");
|
||||
|
||||
# no ip access-l ext $acl
|
||||
$session->cmd("no ip access-list extended $acl");
|
||||
|
||||
# ip access-l ext $acl
|
||||
$session->cmd("ip access-list extended $acl");
|
||||
|
||||
# <temp.txt
|
||||
open EDIT, "<temp$$.txt";
|
||||
my @NEWACL=<EDIT>;
|
||||
close EDIT;
|
||||
|
||||
foreach (@NEWACL) {
|
||||
$session->cmd("$_");
|
||||
}
|
||||
|
||||
# int $int
|
||||
$session->cmd("interface $int");
|
||||
|
||||
# ip access-group $acl $dir
|
||||
$session->cmd("ip access-group $acl $dir");
|
||||
|
||||
# end
|
||||
$session->cmd("end");
|
||||
|
||||
# wr mem
|
||||
$session->cmd("wr mem");
|
||||
|
||||
$session->close;
|
||||
|
||||
print "SAVED";
|
||||
}
|
||||
else {
|
||||
print "CANCELED";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "NO CHANGES";
|
||||
}
|
||||
unlink "temp$$.txt";
|
||||
print "\n\nNochmal? (y)";
|
||||
|
||||
my $again=<STDIN>;
|
||||
chomp $again;
|
||||
exit if ($again ne "y");
|
||||
goto AGAIN if ($again eq "y");
|
||||
BIN
CISCO ACL edit/c5d65b9f57bb0eed58907f8e3743554e.ico
Normal file
BIN
CISCO ACL edit/c5d65b9f57bb0eed58907f8e3743554e.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
BIN
CISCO ACL edit/cisco.ico
Normal file
BIN
CISCO ACL edit/cisco.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
BIN
CISCO ACL edit/editor.exe
Normal file
BIN
CISCO ACL edit/editor.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user