|
|
|
@ -26,9 +26,10 @@ EOF |
|
|
|
|
|
|
|
|
|
# Check if port is valid |
|
|
|
|
sub is_valid_port($){ |
|
|
|
|
my $port = shift; |
|
|
|
|
my $ports = shift; |
|
|
|
|
my $ret = 0; |
|
|
|
|
if ($port =~ m/^(\d+)[\-:](\d+)$/){ |
|
|
|
|
foreach my $port (split /,/, $ports){ |
|
|
|
|
if ($port =~ m/^(\d+):(\d+)$/){ |
|
|
|
|
$ret = 1 if ($1 >= 0 && |
|
|
|
|
$1 < 65636 && |
|
|
|
|
$2 >= 0 && |
|
|
|
@ -38,6 +39,7 @@ sub is_valid_port($){ |
|
|
|
|
$ret = 1 if ($port > 0 && |
|
|
|
|
$port < 65636); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -65,7 +67,7 @@ GetOptions( |
|
|
|
|
"host=s" => \$opts{host}, |
|
|
|
|
"unban" => \$opts{unban}, |
|
|
|
|
"protocol=s" => \$opts{proto}, |
|
|
|
|
"port=i" => \$opts{port} |
|
|
|
|
"port=s" => \$opts{port} |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
# special "undef" value for port and proto |
|
|
|
|