in reply to Re: Get Title ip's list browser -- suggestions for a newcomer
in thread Get Title ip's list browser

hi Discipulus , if can help to me for run this code please
#!/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("2000"); $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; 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; } }

Replies are listed 'Best First'.
Re^3: Get Title ip's list browser -- suggestions for a newcomer
by alaa21a (Novice) on Oct 30, 2017 at 21:21 UTC
    hi Discipulus i'm tested your code but i have problem show this massege
    Global symbol "$ip_fh" requires explicit package name at ./run.pl line + 15. Missing comma after first argument to open function at ./run.pl line 1 +5, near "$ip_file or" Global symbol "$ip_fh" requires explicit package name at ./run.pl line + 19. Execution of ./run.pl aborted due to compilation errors.

      Try replacing

      open $ip_fh '<', $ip_file or die "Unable to open $ip_file for reading! +";

      with

      open my $ip_fh, '<', $ip_file or die "Unable to open $ip_file for read +ing: $!";