Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Anti DDOS - Please Update or Suggest for this script
Old 10-28-2010, 11:07 AM Anti DDOS - Please Update or Suggest for this script
ZoC
Skilled Talker

Posts: 68
Trades: 0
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
ZoC is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-28-2010, 05:52 PM Re: Anti DDOS - Please Update or Suggest for this script
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
// 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
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-28-2010, 08:16 PM Re: Anti DDOS - Please Update or Suggest for this script
ZoC
Skilled Talker

Posts: 68
Trades: 0
and what you suggest for this ?
ZoC is offline
Reply With Quote
View Public Profile
 
Old 10-30-2010, 05:16 PM Re: Anti DDOS - Please Update or Suggest for this script
jim1228's Avatar
Extreme Talker

Posts: 195
Name: Jim
Location: Ohio
Trades: 0
if you have a dedicated server use iptables
stop before script execution
jim1228 is offline
Reply With Quote
View Public Profile Visit jim1228's homepage!
 
Old 10-30-2010, 05:22 PM Re: Anti DDOS - Please Update or Suggest for this script
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Anti DDOS - Please Update or Suggest for this script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.61544 seconds with 12 queries