
Код: Выделить всё
#!/usr/bin/perl
use HTTP::Request::Common;
require LWP::UserAgent;
use Getopt::Std;
usage()
if ($ARGV[0] eq "-h");
getopt("sctln");
$pageshow= $opt_s || 'http://xakepy.ru/index.php';
$pageclick= $opt_c || 'http://top.list.ru/counter?id=953756&t=130&js=13&r=<REF>&j=true&s=<_SW>*<_SH>&d=<_SC>&rand=<RND>';
$t= $opt_t || 50;
$n= $opt_n || 200;
$proxylist= $opt_l || 'proxy.txt';
$counter= 0;
sub click{
($p)=@_;
$p=substr($p,0,length($p)-1);
$ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)");
$ua->timeout(30);
$ua->proxy('http',"http://".$p);
$h1 = new HTTP::Headers
Accept => 'application/vnd.ms-excel, application/msword, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-comet, */*',
User_Agent => 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)',
Referer => $pageshow;
$req1 = new HTTP::Request ('GET', "$pageclick", $h1);
$response=$ua->request($req1);
$suc=$response->is_success;
($suc) || print " $p - :".$response->code."\n";
if ($suc) {
open(FH,">>goodproxy.txt");
print FH $p."\n";
close FH;
};
($suc) && print "$p +\n";
sleep(5);
}
print "\n
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Page, we'll show:\n $pageshow\nLink, we'll click:\n $pageclick
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
open(PROXY, "$proxylist");
@xproxy=<PROXY>;
chomp(@xproxy);
$suc=1;
if ($t>$n) {$t=$n;}
while (1) {
for ($i=1;$i<=$t;$i++) {
if (($xproxy[$counter] == '') or ($counter == $n)) {
killpidz();
print "\nDone !!!\n";
exit;
}
if ($pid=fork()) {
push(@forked,$pid);
} else {
click($xproxy[$counter]);
exit;
}
$counter++;
}
killpidz();
}
sub usage {
print & #34;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
Usage: perl $0 [options]...\n";
print "Options are:
-s: Page to show (page with the banner)
-c: Link to click
-t: Number of treads(def: 50)
-n: Number of clicks(def: 200)
-l: Proxy list (def: pxoxy.txt)
-h: This help
\nExample:
perl $0 -s \"site.ru\" -c \"site.ru/banner.php?id=777\" -t 250
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
exit;
}
sub killpidz {
foreach (@forked) {
chomp;
waitpid($_,0);
kill("TERM" => $_)
}
undef @forked;
}
exit;