Mayk0

#; [BOT] Spider indexador!~

May 13th, 2013
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.18 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. error_reporting(0);
  4. /*
  5. @Coder: Linkgl
  6.   @Fecha: 14/08/2011
  7. */
  8. function simpleono($cadena)
  9. {
  10.   $p1=strpos($cadena,"\"");
  11.   $p2=strpos($cadena,"'");
  12.   if($p1!==false && $p2!==false)
  13.   {
  14.     if($p1<$p2)
  15.       return $p1;
  16.     else
  17.       return $p2;
  18.   }
  19.   else
  20.     return 0;
  21. }
  22.  
  23. function searchanddestroy($cadena,$buscar,$separador)
  24. {
  25.   $arr=explode($cadena,$separador);
  26.   for($i=0;$i<count($arr);$i++)
  27.   {
  28.     if($arr[$i]==$buscar)
  29.       return true;
  30.   }
  31.   return false;
  32. }
  33. function generador($direccion)
  34. {  
  35. $p_inicio=$direccion;
  36. $enlaces=file_get_contents("enlaces.txt");
  37. $c_inicio=file_get_contents($p_inicio);
  38. $c1=strpos($c_inicio,"<a href=");
  39. //BUSCAMOS UN ENLACE
  40. while($c1!==false)
  41. {
  42.   $curret_pos=$c1;
  43.   //INTENTAMOS EXTRAER EL ENLACE
  44.   $url=substr($c_inicio,$c1+9);
  45.   $c2=simpleono($url);
  46.   $enlaces=file_get_contents("enlaces.txt");
  47.   if($c2!==false)
  48.   {
  49.     //echo $url."before";
  50.     $url=substr($url,0,$c2);
  51.     if(strpos($url,"http://")===0 || strpos($url,"www.")===0 || strpos($url,"https://")===0)
  52.     {
  53.       if($url!=$p_inicio)
  54.       {
  55.         if(strpos($enlaces,$url)===false)
  56.         {
  57.           $fp=fopen("enlaces.txt","a");
  58.           fwrite($fp,$url."\n");
  59.           fclose($fp);
  60.           flush();sleep(1);flush();
  61.           echo $url."<br>";
  62.           generador($url);
  63.         }
  64.       }
  65.     }
  66.     else
  67.     {
  68.       $newurl=$p_inicio.$url; //lolz.com/#
  69.       if($url!="")
  70.       {  
  71.         if(searchanddestroy($enlaces,$newurl,"\n")===false && $url!="#")
  72.         {
  73.           $fp=fopen("enlaces.txt","a");
  74.           fwrite($fp,$newurl."\n");
  75.           fclose($fp);
  76.           flush();sleep(1);flush();
  77.           echo $newurl."<br>";
  78.           generador($newurl);
  79.         }
  80.       }
  81.     }
  82.   }
  83.   else
  84.   {
  85.     echo "Cierre de etiqueta no encontrado<br>";
  86.   }
  87.   $c1=strpos($c_inicio,"<a href=",$c1+1);
  88. }
  89. }
  90. if(!isset($_POST['sitioweb']) || empty($_POST['sitioweb']))
  91. {
  92. ?>
  93. <form action="#" method="post">
  94. <input type="text" name="sitioweb">
  95. <input type="submit" value="indexar!">
  96. </form>
  97. <?php
  98. }
  99. else
  100. {
  101. echo "Iniciando<br>";
  102. generador($_POST['sitioweb']);
  103. echo "No hay más enlaces<br>";
  104. }
  105. ?>
Advertisement
Add Comment
Please, Sign In to add comment