version 1.26, 2024/04/24 21:34:44
|
version 1.27, 2024/06/13 17:18:38
|
Line 332 sub firewall_is_port_open {
|
Line 332 sub firewall_is_port_open {
|
while(<PIPE>) { |
while(<PIPE>) { |
if ($port eq $lond_port) { |
if ($port eq $lond_port) { |
if (ref($iphost) eq 'HASH') { |
if (ref($iphost) eq 'HASH') { |
if (/^ACCEPT\s+tcp\s+\-{2}\s+(\S+)\s+\S+\s+tcp\s+dpt\:\Q$port\E/) { |
if (/^ACCEPT\s+(?:tcp|6)\s+\-{2}\s+(\S+)\s+\S+\s+tcp\s+dpt\:\Q$port\E/) { |
my $ip = $1; |
my $ip = $1; |
if ($iphost->{$ip}) { |
if ($iphost->{$ip}) { |
$count ++; |
$count ++; |
Line 470 sub firewall_close_port {
|
Line 470 sub firewall_close_port {
|
while (<PIPE>) { |
while (<PIPE>) { |
chomp(); |
chomp(); |
next unless (/dpt:\Q$port\E/); |
next unless (/dpt:\Q$port\E/); |
if (/^ACCEPT\s+tcp\s+\-{2}\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+/) { |
if (/^ACCEPT\s+(?:tcp|6)\s+\-{2}\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+/) { |
my $ip = $1; |
my $ip = $1; |
my $keepopen = 0; |
my $keepopen = 0; |
if (ref($iphost) eq 'HASH') { |
if (ref($iphost) eq 'HASH') { |
Line 625 sub firewall_close_anywhere {
|
Line 625 sub firewall_close_anywhere {
|
while (<PIPE>) { |
while (<PIPE>) { |
next unless (/dpt:\Q$port\E/); |
next unless (/dpt:\Q$port\E/); |
chomp(); |
chomp(); |
if (/^(\d+)\s+ACCEPT\s+tcp\s+\-{2}\s+0\.0\.0\.0\/0\s+0\.0\.0\.0\/0/) { |
if (/^(\d+)\s+ACCEPT\s+(?:tcp|6)\s+\-{2}\s+0\.0\.0\.0\/0\s+0\.0\.0\.0\/0/) { |
my $firewall_command = "$iptables -D $fw_chain $1"; |
my $firewall_command = "$iptables -D $fw_chain $1"; |
system($firewall_command); |
system($firewall_command); |
my $return_status = $?>>8; |
my $return_status = $?>>8; |