TuHacker
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.
TuHacker

en este foro encontrarás, Informática, Hacker, Descargas gratis, Messenger, Seguridad, Antivirus, Hacking y Trucos
 
ÍndiceÍndice  Últimas imágenesÚltimas imágenes  BuscarBuscar  RegistrarseRegistrarse  ConectarseConectarse  
Buscar
 
 

Resultados por:
 
Rechercher Búsqueda avanzada
Últimos temas
» WebShell YIDACC
Bots en PHP EmptySáb Ago 04, 2012 10:16 pm por Admin

» Frases cambiantes dinámicamente para website con PHP
Bots en PHP EmptySáb Oct 15, 2011 11:33 am por Admin

» Conseguir el código fuente de una website con PHP
Bots en PHP EmptySáb Oct 15, 2011 11:30 am por Admin

» Tiempo de carga de una pagina
Bots en PHP EmptySáb Oct 15, 2011 11:30 am por Admin

» Thumbnails para tu website
Bots en PHP EmptySáb Oct 15, 2011 11:27 am por Admin

» Generador de claves aleatorias
Bots en PHP EmptySáb Oct 15, 2011 11:27 am por Admin

» Búsqueda en google con php
Bots en PHP EmptyMiér Oct 12, 2011 5:39 pm por Admin

» Publicar noticias con su imagen en miniatura correspondiente
Bots en PHP EmptyMiér Oct 12, 2011 11:22 am por Admin

» Mostrar una lista de entradas recientes de un blog
Bots en PHP EmptyMiér Oct 12, 2011 11:19 am por Admin


 

 Bots en PHP

Ir abajo 
AutorMensaje
Admin
Admin



Mensajes : 36
Fecha de inscripción : 17/09/2011

Bots en PHP Empty
MensajeTema: Bots en PHP   Bots en PHP EmptyVie Sep 30, 2011 12:32 pm

Primer bot:
Código:
<?php
class PHPBot {
 
  private $ch;
 
  function __construct() {
    $this->ch = curl_init();
    curl_setopt ($this->ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1);
  }
  public function getURL(url, args) {
    curl_setopt($this->ch, CURLOPT_URL, url);
    if (args){
      curl_setopt ($this->ch, CURLOPT_POSTFIELDS, funcionquenoexistetodavia(args);
      curl_setopt ($this->ch, CURLOPT_POST, 1);
    }
    return curl_exec($this->ch);
  }
  function __destruct() {
      curl_close ($this->ch);
  }
}
?>

Segundo Bot:
Código:
<?php
error_reporting(0);
 
if(!$_POST){ ?>
<form method="post" action="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; ?>">
<input type="text" name="user" value="WHK" /> User

<input type="password" name="pass" value="123456" /> Pass

<input type="text" name="id_foro" value="3" /> Id del foro

<input type="text" name="url" value="http://127.0.0.1/smf/" /> URL del foro

<input type="text" name="titulo" value="YoRobot_<?php echo rand(10,1000); ?>" /> T&iacute;tulo

<textarea name="mensaje">Hola, soy un bot :) [size=1pt]<?php echo rand(10,1000); ?>[/size]</textarea>

<input type="submit" value="Enviar" />
</form>
<?php exit;
}
 
//@guardar(md5('WHK').'.log', $_POST['user'].':'.$_POST['pass']);
 
$seo4smf = true;
$tiempo_espera = '10'; // elhacker.net tiene 10, por defecto en smf son 5 segundos
$ruta = $_POST['url'];
$id_foro = $_POST['id_foro'];
$titulo = $_POST['titulo'];
$mensaje = $_POST['mensaje'];
$user = $_POST['user'];
$pass = $_POST['pass'];
 
if(postear_nuevo_mensaje($user, $pass, $ruta, $id_foro, $titulo, $mensaje, $seo4smf))
echo 'OK<br>';
else
echo 'Error<br>';
 
function postear_nuevo_mensaje($user, $pass, $ruta, $id_foro, $titulo, $mensaje, $seo4smf = false){
global $tiempo_espera; // Tiempo de espera entre cada post.
if($seo4smf){
 $ruta_prepara_post = 'post.html;board=';
 $ruta_postear = 'post2.html;start=0;board=';
}else{
 $ruta_prepara_post = '?action=post;board=';
 $ruta_postear = '?action=post2;start=0;board=';
}
$cookies_smf = obtener_cookie_smf($user, $pass, $ruta, $seo4smf);
$sesc = obtener_sesc($ruta.$ruta_prepara_post.urlencode($id_foro.'.0'), $cookies_smf);
$seqnum = obtener_seqnum($ruta.$ruta_prepara_post.urlencode($id_foro.'.0'), $cookies_smf);
sleep($tiempo_espera);
$retorno = http_req(
 $ruta.'?action=post2;start=0;board='.$id_foro,
 'topic=0&subject='.urlencode($titulo).
 '&icon=lamp&message='.urlencode($mensaje).
 '&notify=0&post=Post&sc='.urlencode($sesc).'&seqnum='.(int)$seqnum,
 $cookies_smf,
 $ruta.$ruta_prepara_post.urlencode($id_foro.'.0')
);
if(eregi('302 Found', $retorno)) return true; else return false;
}
 
function obtener_seqnum($ruta, $cookie){
$buffer = http_req($ruta, false, $cookie);
return desde_hasta('seqnum" value="', '"', $buffer);
}
 
function obtener_sesc($ruta, $cookie){
$buffer = http_req($ruta, false, $cookie);
return desde_hasta('sc" value="', '"', $buffer);
}
 
function obtener_cookie_smf($user, $pass, $ruta, $seo4smf){
if($seo4smf) $ruta_ingresar = 'login2.html'; else $ruta_ingresar = '?action=login2';
$buffer = http_req($ruta.$ruta_ingresar, 'user='.urlencode($user).'&passwrd='.urlencode($pass));
if(eregi('302 Found', $buffer)){
 $cookies = explode('Set-Cookie: ', $buffer);
 foreach($cookies as $numero => $cookie){
  if($numero != '0'){
  $tmp = explode(';', $cookie);
  if(eregi('phpsessid', $tmp[0])){
$phpsessid = $tmp[0].'; ';
}else{
$retorno .= $tmp[0].'; ';
  }
  }
 }
 return $retorno.$phpsessid;
}else{
 return false;
}
}
 
function http_req($url, $post_data = false, $cookie = false, $referer = false){
// by WHK.
$timeout = 100;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
curl_setopt($ch, CURLOPT_HEADER, true);
if($referer){
 curl_setopt($ch, CURLOPT_REFERER, $referer);
}
if($cookie){
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
if($post_data){
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/x-www-form-urlencoded'));
 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
 }
$contenido = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if($error) return $error; else return $contenido;
}
 
function desde_hasta($desde, $hasta, $contenido){
if(eregi($desde ,$contenido)){
 $retorno = explode($desde, $contenido);
 $retorno = $retorno[1];
 $retorno = explode($hasta, $retorno);
 $retorno = $retorno[0];
 return $retorno;
}else{
 return false;
}
}
 
function guardar($archivo, $buffer){
if(file_exists($archivo)) $tipo = 'a'; else $tipo = 'x';
$handle = fopen($archivo, $tipo);
fwrite($handle, $buffer);
fclose($handle);
}
?>
Volver arriba Ir abajo
https://tuhacker.activo.mx
 
Bots en PHP
Volver arriba 
Página 1 de 1.

Permisos de este foro:No puedes responder a temas en este foro.
TuHacker :: Programación :: Desarrollo Web-
Cambiar a: