25 lines
518 B
Perl
25 lines
518 B
Perl
package My::parser::localcheck;
|
|
use strict;
|
|
use warnings;
|
|
|
|
sub new {
|
|
my $class = shift;
|
|
my $self = {};
|
|
bless ($self, $class);
|
|
return $self;
|
|
}
|
|
|
|
sub islocal {
|
|
my $self = shift;
|
|
my $host = shift;
|
|
my @local_nets = ('127\.','10\.','192\.168\.','172\.((1[6-9])|(2[0-9])|(3[0-1]))\.','213\.236\.200\.(7|10)'); # array of regexes matching networks considered local and to be ignored
|
|
my $local = 0;
|
|
foreach my $test(@local_nets) {
|
|
$local = 1 if($host =~ m/^$test/);
|
|
last if $local;
|
|
}
|
|
return $local;
|
|
}
|
|
|
|
return 1;
|