StarMedia
Va asteptam in grupul nostru de pe facebook: Click

Distribuiţi
Vezi subiectul anteriorIn josVezi subiectul urmator
avatar
Mr.Bonu$s
V.I.P
V.I.P
Mesaje : 2900
Varsta : 23
Localizare : -=[Italy]=-
Sunt pe forum din : 06/08/2009

Anti DDOS [not tested]

la data de Sam 07 Ian 2012, 01:52

i found on my pc some DDOS protection , files are from L2Exile.com ( a L2 Server ) !

you must add that in you index.php
Cod:
require("anti_ddos/index.php");

Anti_DDOS Folder /


index.php
Cod:
<?php

$ad_ddos_query=12;
$ad_check_file='check.txt';
$ad_temp_file='all_ip.txt';
$ad_black_file='black_ip.txt';
$ad_white_file='white_ip.txt';
$ad_dir='anti_ddos';
$ad_num_query=0;
$ad_sec_query=0;
$ad_end_defense=0;
$ad_sec=date("s");
$ad_date=date("mdHis");
$ad_defense_time=360;



if(!file_exists("{$ad_dir}/{$ad_check_file}") or !file_exists("{$ad_dir}/{$ad_temp_file}") or !file_exists("{$ad_dir}/{$ad_black_file}") or !file_exists("{$ad_dir}/{$ad_white_file}") or !file_exists("{$ad_dir}/anti_ddos.php")){
die("File Not Exist");
}

require("{$ad_dir}/{$ad_check_file}");

if ($ad_end_defense and $ad_end_defense>$ad_date){
require("{$ad_dir}/anti_ddos.php");
} else {
if($ad_sec==$ad_sec_query){
$ad_num_query++;
} else {
$ad_num_query='1';
}

if ($ad_num_query>=$ad_ddos_query){
$ad_file=fopen("{$ad_dir}/{$ad_check_file}","w");
$ad_end_defense=$ad_date+$ad_defense_time;
$ad_string='<?php $ad_end_defense='.$ad_end_defense.'; ?>';
fputs($ad_file,$ad_string);
fclose($ad_fp);
} else {
$ad_file=fopen("{$ad_dir}/{$ad_check_file}","w");
$ad_string='<?php $ad_num_query='.$ad_num_query.'; $ad_sec_query='.$ad_sec.'; ?>';
fputs($ad_file,$ad_string);
fclose($ad_fp);
}
}
?>

anti_ddos.php
Cod:
<?php
function getIP() {
if(getenv("HTTP_CLIENT_IP") and preg_match("/^[0-9\.]*?[0-9\.]+$/is",getenv("HTTP_CLIENT_IP")) and getenv("HTTP_CLIENT_IP")!='127.0.0.1') {
$ip = getenv("HTTP_CLIENT_IP");
} elseif(getenv("HTTP_X_FORWARDED_FOR") and preg_match("/^[0-9\.]*?[0-9\.]+$/is",getenv("HTTP_X_FORWARDED_FOR")) and getenv("HTTP_X_FORWARDED_FOR")!='127.0.0.1') {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} else {
$ip = getenv("REMOTE_ADDR");
}
return $ip;
}
$ad_ip=getIP();

$ad_source=file("{$ad_dir}/{$ad_black_file}");
$ad_source=explode(' ',$ad_source[0]);
if (in_array($ad_ip,$ad_source)){die();}

$ad_source=file("{$ad_dir}/{$ad_white_file}");
$ad_source=explode(' ',$ad_source[0]);
if (!in_array($ad_ip,$ad_source)){

$ad_source=file("{$ad_dir}/{$ad_temp_file}");
$ad_source=explode(' ',$ad_source[0]);
if (!in_array($ad_ip,$ad_source)){
$ad_file=fopen("{$ad_dir}/{$ad_temp_file}","a+");
$ad_string=$ad_ip.' ';
fputs($ad_file,"$ad_string");
fclose($ad_fp);
?>

Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!
Attacked From (<?=$ad_ip?>) !!!!!

<form method="post">
<input type="submit" name="ad_white_ip" value="Sucker">
</form>

<?php
die();
}
elseif ($_POST['ad_white_ip']){
$ad_file=fopen("{$ad_dir}/{$ad_white_file}","a+");
$ad_string=$ad_ip.' ';
fputs($ad_file,"$ad_string");
fclose($ad_fp);
}
else {
$ad_file=fopen("{$ad_dir}/{$ad_black_file}","a+");
$ad_string=$ad_ip.' ';
fputs($ad_file,"$ad_string");
fclose($ad_fp);
die();
}
}
?>


.htaccess

Cod:
<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)">
    Order allow,deny
    Deny from all
</Files>

after that create 4 text files with that names ....


  • black_ip.txt
  • all_ip.txt
  • white_ip.txt


And last text files must be check.txt and in that file put :

Cod:
<?php $ad_num_query=1; $ad_sec_query=53; ?>

Credits:
FCV2005

Source:
who-design.us


Vezi subiectul anteriorSusVezi subiectul urmator
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum