#!/usr/bin/perl
# ref spoof
# usage: perl refspoof.pl file_with_urls
# format for urls: www.whatever.com
# no http://
use IO::Socket qw(:DEFAULT :crlf);
use Parallel::ForkManager;
my $self = {}; bless $self;
my $pm = new Parallel::ForkManager();
our %config;
%config= (
threads => 200, # max threads
referer => 'http://www.YOURURL.com', # uhhh, your url? :D
debug => '0', #set to 1 to print server response
);
$pm = new Parallel::ForkManager($config{threads});
main();
sub main {
open(FH,"$ARGV[0]");
while(<FH>) {
s/\n//g;
$url = $_;
my $pid = $pm->start and next;
$self->post_http($url);
$pm->finish;
$pm->wait_all_children;
}
}
sub post_http {
my($self,$server) = @_;
my $remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => $server,
PeerPort => "http(80)",
Timeout => 5
);
if ( $remote )
{
$remote->autoflush(1); # No buffering
print "Connected: $server\n";
print $remote "GET / HTTP/1.1$CRLF";
print $remote "Accept: */*$CRLF";
print $remote "Accept-Language: en-us$CRLF";
print $remote "Accept-Encoding: gzip, deflate$CRLF";
print $remote "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; AOL 7.0; Windows 98)$CRLF";
print $remote "Referer: $config{referer}$CRLF";
print $remote "Host: $server$CRLF";
print $remote "Connection: Close$CRLF$CRLF";
# Read the response
$sockResp = "";
while ( <$remote> ) {
$sockResp = $sockResp . $_;
}
print "$sockResp" if ($config{debug} == 1 );
close $remote; # Close the socket
}
else
{
print "Cannot connect to $server\n";
open(ERR,">>ERROR");
print ERR "$server\n";
close(ERR);
}
return();
}