Anti DDOS - Please Update or Suggest for this script
10-28-2010, 11:07 AM
|
Anti DDOS - Please Update or Suggest for this script
|
Posts: 68
|
Hello there, i work today for anti ddos for my website ...
the code is this
PHP Code:
<?php if (preg_match("~66.249~i", $_SERVER["REMOTE_ADDR"]) || preg_match("~66.196~i", $_SERVER["REMOTE_ADDR"])) { echo ""; } else {
// --------------- Setup $on_cookie1 = $_COOKIE['g3gh3h22ff6']; // Cookie 1 $on_cookie2 = $_COOKIE['r2rd15r1e13']; // Cookie 2 $on_cookie3 = $_COOKIE['g3hf3yy5y7y']; // Cookie 3 $on_cookie4 = $_COOKIE['f3g3ty33t2r']; // Cookie 4
$on_cookie_time1 = time()+5; // 5 Sec - Time What Ip Can Refresh Website Or Hit Another Page On Website $on_cookie_time2 = time()+5; // 5 Sec - Time What Ip Can Refresh Website Or Hit Another Page On Website $on_cookie_time3 = time()+60*60; // 1 Hour - Time What Visitator Is Not Scanned After First Scan $on_cookie_time4 = time()+60*5; // 5 Min - Time What Visitator Is Block From Website
$hit_cookiegen1 = $_COOKIE['ftrertre1']; // Hit Cookie General 1 $hit_cookiegen2 = $_COOKIE['ftrertre2']; // Hit Cookie General 1
$hit_cookie1 = $_COOKIE['fdftgytr1']; // Hit Cookie 1 $hit_cookie2 = $_COOKIE['fdftgytr2']; // Hit Cookie 2 $hit_cookie3 = $_COOKIE['fdftgytr3']; // Hit Cookie 3 $hit_cookie4 = $_COOKIE['fdftgytr4']; // Hit Cookie 4 $hit_cookie5 = $_COOKIE['fdftgytr5']; // Hit Cookie 5
// --------------- Logs Function $log['ip_scan'] = "iplog/iplogscan.dat"; // Log Ip Scan List $log['ip'] = "iplog/iplog.dat"; // Log Banned Ips List
// Add Text On Logs function addText( $log, $ip_address ) { $ip_array = file($log); $fp = fopen($log, "a"); fputs($fp, $ip_address."\n"); fclose($fp); }
// Find Text From Logs function findText( $log, $ip_address ) { $fp = file_get_contents($log,NULL); if(stristr($fp, $ip_address) === FALSE) { return 'no'; } else { return 'yes'; } fclose($fp); }
// Delete Text From Logs function deleteText( $log, $ip_address ) { $fp1 = file_get_contents($log,NULL); $fp1 = str_replace($ip_address." ", '', $fp1); $fp2 = fopen($log, 'w+') or die('ERROR: Delet Line'); fwrite($fp2,$fp1); fclose($fp); }
// --------------- Cookies Php if (isset($hit_cookiegen1) && isset($hit_cookiegen2)) { } else { setcookie("ftrertre1", "on", time()+60*1); setcookie("ftrertre2", "on", time()+10); }
if (isset($hit_cookiegen1) && isset($hit_cookiegen2)) { setcookie("fdftgytr1", "on", time()+60*1); } if (isset($hit_cookie1)) { if (isset($hit_cookiegen1)) { setcookie("f3g3ty33t2r", "off", $on_cookie_time4); setcookie("fdftgytr1", "on", time()-60*60); die('<META HTTP-EQUIV="refresh" content="2;URL=http://www.google.com" />We Are Sorry ! We Dont Accept Hits So Fast ! Your Ip Is Block For 5 Minutes !'); exit(); } else { setcookie("fdftgytr1", "on", time()-60*60); } setcookie("fdftgytr2", "on", time()+60*1); } if (isset($hit_cookie2)) { setcookie("fdftgytr2", "on", time()-60*60); setcookie("fdftgytr3", "on", time()+60*1); } if (isset($hit_cookie3)) { if (isset($hit_cookiegen1) && isset($hit_cookiegen2)) { setcookie("f3g3ty33t2r", "off", $on_cookie_time4); setcookie("fdftgytr1", "on", time()-60*60); setcookie("fdftgytr2", "on", time()-60*60); setcookie("fdftgytr3", "on", time()-60*60); setcookie("ftrertre1", "on", time()-60*60); setcookie("ftrertre2", "on", time()-60*60); die('<META HTTP-EQUIV="refresh" content="2;URL=http://www.google.com" />We Are Sorry ! We Dont Accept Hits So Fast ! Your Ip Is Block For 5 Minutes !'); exit(); } else { setcookie("fdftgytr1", "on", time()-60*60); setcookie("fdftgytr2", "on", time()-60*60); setcookie("fdftgytr3", "on", time()-60*60); setcookie("ftrertre1", "on", time()-60*60); setcookie("ftrertre2", "on", time()-60*60); } }
if (isset($on_cookie4)) { die('<META HTTP-EQUIV="refresh" content="2;URL=http://www.google.com" />We Are Sorry ! We Dont Accept Hits So Fast ! Your Ip Is Block For 5 Minutes !'); exit(); } if (isset($on_cookie3)) { deleteText( $log['ip_scan'], $_SERVER["REMOTE_ADDR"] ); if (isset($on_cookie1) && isset($on_cookie2)) { setcookie("f3g3ty33t2r", "off", $on_cookie_time4); die('<META HTTP-EQUIV="refresh" content="2;URL=http://www.google.com" />We Are Sorry ! We Dont Accept Hits So Fast ! Your Ip Is Block For 5 Minutes !'); exit(); } else { setcookie("g3gh3h22ff6", "on", $on_cookie_time1); setcookie("r2rd15r1e13", "on", $on_cookie_time2); } } else { if (findText( $log['ip'], $_SERVER["REMOTE_ADDR"] ) == "yes") { die('Your Ip "' . $_SERVER["REMOTE_ADDR"] . '" Is Bloket!'); exit(); } else { if (findText( $log['ip_scan'], $_SERVER["REMOTE_ADDR"] ) == "yes") { addText( $log['ip'], $_SERVER["REMOTE_ADDR"] ); die('Your Ip "' . $_SERVER["REMOTE_ADDR"] . '" Is Bloket! Your Browser Not Accept Cookies'); exit(); } else { addText( $log['ip_scan'], $_SERVER["REMOTE_ADDR"] ); setcookie("g3gh3h22ff6", "on", $on_cookie_time1); setcookie("r2rd15r1e13", "on", $on_cookie_time2); setcookie("g3hf3yy5y7y", "ip_scan", $on_cookie_time3); } } } } ?>
This script is working but how i see some ips still make many connection ... can someone suggest or update this script ? thanks and hope this script can help many people
|
|
|
|
10-28-2010, 05:52 PM
|
Re: Anti DDOS - Please Update or Suggest for this script
|
Posts: 52
Name: Alex
|
// Find Text From Logs
function findText( $log, $ip_address )
{
$fp = file_get_contents($log,NULL);
if(stristr($fp, $ip_address) === FALSE) {
return 'no';
} else {
return 'yes';
}
fclose($fp);
}
// Delete Text From Logs
function deleteText( $log, $ip_address )
{
$fp1 = file_get_contents($log,NULL);
$fp1 = str_replace($ip_address."
", '', $fp1);
$fp2 = fopen($log, 'w+') or die('ERROR: Delet Line');
fwrite($fp2,$fp1);
fclose($fp);
}
with this your site is really under threats 
|
|
|
|
10-28-2010, 08:16 PM
|
Re: Anti DDOS - Please Update or Suggest for this script
|
Posts: 68
|
and what you suggest for this ?
|
|
|
|
10-30-2010, 05:16 PM
|
Re: Anti DDOS - Please Update or Suggest for this script
|
Posts: 195
Name: Jim
Location: Ohio
|
if you have a dedicated server use iptables
stop before script execution
|
|
|
|
10-30-2010, 05:22 PM
|
Re: Anti DDOS - Please Update or Suggest for this script
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
USE A FIREWALL!!!
As I pointed out in this thread http://www.webmaster-talk.com/php-fo...k-ips-who.html, if PHP is running the IP has already made the connection.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
|
« Reply to Anti DDOS - Please Update or Suggest for this script
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|