I need to modify this script to have also an external txt file with urls instead of having only one url from the form that is created by the script. Just like the proxy.txt and agents.txt.
Please help me... :confused:

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;
####Proxy addresses#####
$proxy="proxy.txt";
####How many proxies are in this file####
$number='350';
##################################################DO NOT EDIT BELOW THIS LINE!#############################
print "Content-type: text/html\n\n";
$agents="agents.txt";
$nagents='21';
$buffer = $ENV{'QUERY_STRING'};
if ($buffer eq 'new'){
&newinfo();
}
sub newinfo{
print <<ENDHTML;
<form action=bot.cgi?hitsnow method=post>
URL to send hits to:<input type=text name=url><br>
Refferring URL:<input type=text name=refer><br>
How many hits to send:<input type=text name=howmany><br>
<input type=submit value=Submit></form>
ENDHTML
;
exit;
}
if ($buffer eq 'hitsnow'){
&sendthemhits();
}
sub sendthemhits{
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
for($count=1;$count<$FORM{howmany};$count++){
open(QQ,"$proxy");
@proxies=<QQ>;
close(QQ);
open(WE,"$agents");
@agents=<WE>;
close(WE);
srand;
@run = (0..$number);
$run = rand(@run);
@ug = (0..$nagent);
$ug = rand(@ug);
my $ua = LWP::UserAgent->new(agent => "@agents[$ug[$ug]]" , keep_alive => 1 , timeout => 10);
$ua->proxy('http',"http://@proxies[$run[$run]]");
my $res = HTTP::Request->new( GET => "$FORM{url}");
$res->referer("$FORM{refer}");
my $response= $ua->request($res);
if ($response->is_success){
print "Connection: $count - @proxies[$run[$run]] - Success<br>\n";
}
}
}

I'm not 100% sure that I understand what you are asking. I know that you want to use a text file to be read into the script, but what I'm lost at, is are you wanting for the HTML that accepts the URL and number of hits to no longer exist, and have that information be replaced by the text file?

I'm not 100% sure that I understand what you are asking. I know that you want to use a text file to be read into the script, but what I'm lost at, is are you wanting for the HTML that accepts the URL and number of hits to no longer exist, and have that information be replaced by the text file?

Hello,

Yes that's exactly what I want. Cause I would like better to call this script by cron and have set all those variables in txt files so the script would work when it's called by cron and not when I call it from the browser as it works now.

Thanks for your help and time.

James

Ok, The information that the web page retrieves, I need to know what kind of file format they are in. I understand they will be text, but I need to know the format of it, such as:

url <TAB> referer <TAB> howmany

or will it be something like:

url
referer
howmany

or will they be in different text files, or how is this supposed to work. I can modify the script to work with the text files, but I need to understand how you will have it laid out. Let me know.

Hi,

They'll be in different text files. One URL per line. The "how many hits will be just a number in a txt file let's say for 30 hits per url (i.e. 30).
I need it to run from cron.

Now(the way the script works) I need to call the script http://myurl.com/test.cgi?new to run the script and it waits for user input. I want to be able to upload the txt files and set the script to work lets say every night at 12:00 with a cron command.

Look the start of this code:

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;
####Proxy addresses#####
$proxy="proxy.txt";
####How many proxies are in this file####
$number='350';
##################################################DO NOT EDIT BELOW THIS LINE!#############################
print "Content-type: text/html\n\n";
$agents="agents.txt";
$nagents='21';
$buffer = $ENV{'QUERY_STRING'};
if ($buffer eq 'new'){
&newinfo();


Thanks

James

This article has been dead for over six months. Start a new discussion instead.