#!/usr/bin/perl use Parallel::ForkManager; use LWP::UserAgent; use LWP::Protocol::https; use Net::SSL; my @foundip; my $save = "result.txt"; my $i = 0; my $forkmanager = new Parallel::ForkManager->new("20"); $forkmanager->run_on_finish(sub { # must be declared before first 'start' my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data) = @_; $out{ $data->[0] } = $data->[1]; #print "[onfinish]". $data->[0] ."\n"; if (($data->[1] == -1) or ($data->[1] == 1)) { push(@foundip,$data->[0]); } }); my $foundstring; my $cnt =0; my $match_found = 0; open($foundipFILE, "< ip"); while (<$foundipFILE>) { $line = $_; $line =~ s/\x0a//g; if (!grep {$_ eq $line} @foundip) { $cnt++; my $pid = $forkmanager->start and next; alarm("20"); $rez = 0; $rez = do_shit($line); #print "$cnt\r\n"; $forkmanager->finish(0, [ $line, $rez ]); # Child exits }else{ #print "!!!!! $line was here\n"; } } close($foundipFILE); $forkmanager->wait_all_children(); print "\n!!!!! FINISH !!!!!!\n"; exit; sub do_shit{ my $line = shift; my ($ip,$port) = split (/:/, $line, 2); $link = "https://$line"; #print "$link\n\r"; $link = "http://$line"; print "\e[31mScaning $link\r\e[0m"; #start here my $browser = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 },); $browser->timeout(60000); my $response = $browser->get("$link"); my $head = $response->as_string(); #print $head; @types = ('google', 'yahoo', ); foreach(@types){ #print $type; if($head =~ m/(.*)$_(.*)/i) { #search for the key word print "\e[33mFound $link $_\r\n\e[0m"; open(OUTPUT,">>$save"); print OUTPUT "$link $_\r\n"; print OUTPUT "###################\r\n"; close (OUTPUT); } else { next; } } }