Showing posts with label DDOS. Show all posts
Showing posts with label DDOS. Show all posts

Thursday, December 15, 2011

Three ways to prevent DDOS

DDOS attack, also called denial of service attack simply means creating a massive virtual visitor to a website address at the same time it was intended to "demolish" host storage makes it run slowly or can not run anymore.

A denial-of-service attack (DoS attack) or distributed denial-of-service attack (DDoS attack) is an attempt to make a computer or network resource unavailable to its intended users.

 Method 1: Anti iframe
Code:
 
 


Method 2: Anti-reload malicious website
If you are attacked like this, you set up your files .htaccess with the content:
Code:
RewriteEngine on
 RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
 RewriteRule !antiddos.phtml http://www.domain.com/antiddos.phtml?%{REQUEST_URI} [QSA]

Then create a file antiddos.phtml with content 
Code:
 $text = $HTTP_SERVER_VARS['QUERY_STRING'];
 $text = preg_replace("#php\&#si",'php?',$text);
 echo("
[CLICK HERE TO ENTER]

'');

 ?>
Method 3: Limit number of connections at a time website
You add the following code to the home page of the website.
Code:
function server_busy($numer) {
      if (THIS_IS == 'WEBSITE' && PHP_OS == 'Linux' and @file_exists (  '/proc/loadavg' ) and $filestuff = @file_get_contents ( '/proc/loadavg'  )) {
         $loadavg = explode ( ' ', $filestuff );
         if (trim ( $loadavg [0] ) > $numer) {
             print '';
             print 'Traffic is overloaded, please come back after a few minutes.';
             exit ( 0 );
         }
     }
 }
 $srv = server_busy ( 1000 ); // 1000 is the number of visitors at a time


 

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews