| Server IP : 164.90.182.227 / Your IP : 216.73.217.47 Web Server : Apache/2.4.29 (Ubuntu) System : Linux wordpress-kuzoconsulting 4.15.0-122-generic #124-Ubuntu SMP Thu Oct 15 13:03:05 UTC 2020 x86_64 User : www-data ( 33) PHP Version : 7.4.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /sbin/ |
Upload File : |
#!/usr/bin/perl -w
#
#
# A script that generates text output of the ebtables rules.
# Similar to iptables-save.
#
# It can be used to store active configuration to /etc/sysconfig/ebtables
use strict;
my $table;
my $ebtables = "/sbin/ebtables";
my $cnt = "";
my $version = "1.0";
my $table_name;
# ========================================================
# Process filter table
# ========================================================
sub process_table {
my $chain = "";
my $rules = "";
my $chains = "";
my $line = "";
foreach $line (split("\n",$_[0])) {
if ($line =~ m/Bridge table: (.*)/) {
print "*$1\n";
next;
}
if ($line =~ m/Bridge chain: (.*?), entries:.* policy: (.*)/) {
$chains = $chains . ":$1 $2\n";
$chain = $1;
next;
}
if ($line =~ m/^$/) {
next;
}
if ($cnt eq "--Lc") {
$line =~ s/, pcnt = (.*) -- bcnt = (.*)/-c $1 $2/;
} else {
$line =~ s/ $//;
}
$rules = $rules . "-A $chain $line\n";
}
print $chains;
print $rules;
print "\n";
}
# ========================================================
unless (-x $ebtables) { exit -1 };
print "# Generated by ebtables-save v$version on " . `date`;
if (defined($ENV{'EBTABLES_SAVE_COUNTER'}) && $ENV{'EBTABLES_SAVE_COUNTER'} eq "yes") {
$cnt = "--Lc";
}
foreach $table_name (split("\n", `grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//`)) {
$table =`$ebtables -t $table_name -L $cnt`;
unless ($? == 0) { print $table; exit -1 };
&process_table($table);
}