Wednesday, December 21, 2011

// // 4 comments

Anti-DDoS PHP Script

Create a directory anti_ddos and throw all the scripts there:

index.php (DDOS attacks detection module):



anti_ddos.php (module redemption DDOS attacks):
 PHP Code: 


Also, for the script will need 4 files check.txt, white_ip.txt, black_ip.txt all_ip.txt and create them in the same directory and all the rights set 666 (read and write).

It is also desirable during the attack lists of IP addresses the attackers machine, the file transfer black_ip.txt gradually. Htaccess file and block them out, then the load is still considerably lower.

Example of a file. Htaccess
Code:
Deny from 11.11.11.11 22.22.22.22 etc. through gap

To connect the script at the beginning of each file, which can be subjected to attack, add the line:
PHPCode:
require ("anti_ddos/index.php");

4 comments:

  1. Just bookmarked this blog. Big thanks for great and useful articles. Keep posting :)

    ReplyDelete
  2. BTW is the index.php and i cant replace on the index ~~ how to do help me

    ReplyDelete
  3. Please correct your Scripts. There are a lot of Spaces !

    Example:

    if (! file_exists ("{$ ad_dir} / {$ ad_check_file}")...

    must be:

    if (!file_exists("{$ ad_dir}/{$ ad_check_file}") ...

    Thank You

    ReplyDelete
  4. i have also posted an effective anti ddos plugin. please check it out here: http://www.w3tools.info/2012/05/protect-ddos-attack-with-medialayer.html

    ReplyDelete