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. Method 1: Anti iframe [/B][COLOR=#333333][FONT=Times New Roman][I]<script language="JavaScript">[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]if (top.location != self.location)[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]{top.location = self.location}[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]</script>[/I][/FONT][/COLOR][B] Code (markup): Method 2: Anti-reload malicious website If you are attacked like this, you set up your files .htaccess with the content: [COLOR=#333333][FONT=Times New Roman][I]RewriteEngine on[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC][/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]RewriteRule !antiddos.phtml http://www.domain.com/antiddos.phtml?%{REQUEST_URI} [QSA][/I][/FONT][/COLOR] Code (markup): Then create a file antiddos.phtml with content [COLOR=#333333][FONT=Times New Roman][I]<?[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]$text = $HTTP_SERVER_VARS['QUERY_STRING'];[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]$text = preg_replace("#php\&#si",'php?',$text);[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]echo('<center><a href=http://www.domain.com/?'.$text.'><font color=red size=5 face=Monotype>[CLICK HERE TO ENTER]</font></a</center>');[/I][/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman][I]?>[/I][/FONT][/COLOR] Code (markup): Method 3: Limit number of connections at a time website You add the following code to the home page of the website. [COLOR=#333333][FONT=Times New Roman]function server_busy($numer) {[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] if (THIS_IS == 'WEBSITE' && PHP_OS == 'Linux' and @file_exists ( '/proc/loadavg' ) and $filestuff = @file_get_contents ( '/proc/loadavg' )) {[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] $loadavg = explode ( ' ', $filestuff );[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] if (trim ( $loadavg [0] ) > $numer) {[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] print '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] print '[/FONT][/COLOR]Traffic is overloaded, please come back after a few minutes.[COLOR=#333333][FONT=Times New Roman]';[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] exit ( 0 );[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] }[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman] }[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman]}[/FONT][/COLOR] [COLOR=#333333][FONT=Times New Roman]$srv = server_busy ( 1000 ); // 1000 [/FONT][/COLOR]is the number of visitors at a time Code (markup):
While these methods are very effective for this type of attack, a large scale ddos would result in the need of a special provider capable of accepting this much bandwidth and ddos mitigation hardware
Has anyone had any experience with method 3? I'm thinking about using it as precaution in case some low life decides to get bored..
I've used that technique before. But something different from yours, I like to deny busy connections, but it's not always the greatest idea!