Add more checking around xaddr parsing

This commit is contained in:
Jon Burgess 2016-03-19 14:15:51 +00:00
parent 16cf1b6245
commit ed7e3e47b7
1 changed files with 8 additions and 0 deletions

View File

@ -114,12 +114,20 @@ sub interpret_messages
my $xaddr;
foreach my $l_xaddr (split ' ', $result->get_ProbeMatch()->get_XAddrs()) {
# find IPv4 address
if($verbose) {
print "l_xaddr = $l_xaddr\n";
}
if($l_xaddr =~ m|//[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[:/]|) {
$xaddr = $l_xaddr;
last;
} else {
print STDERR "Unable to find IPv4 address from xaddr $l_xaddr\n";
}
}
# No usable address found
next if not $xaddr;
# ignore multiple responses from one service
next if defined $services{$xaddr};
$services{$xaddr} = 1;