1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
sub parseHosts {
my ($url) = @_;
my $content = `curl --header "User-agent: " $url 2>&1`;
my $hostpattern = "[a-z0-9][a-z0-9-]*[.][a-z.]+[a-z]";
my $p1 = "value=[\"]($hostpattern)[\"]";
my $p2 = "<li>($hostpattern)";
my $p3 = "<a>($hostpattern)";
my $c = 0;
while ($content =~ m/($p1)|($p2)|($p3)/igs) {
if ($maxhostsperurl > 0 && ++$c > $maxhostsperurl) {
print "<b>Thread " . threads->self()->tid() . " exiting, after $maxhostsperurl hosts in test mode.</b> Set \$maxhostsperurl to 0 for a full run. <br/>\n";
return;
}
if ($2) {
processHost($2);
} elsif ($4) {
processHost($4);
} elsif ($6) {
processHost($6);
}
}
} |
Partager