<?php $real_ip = getenv('HTTP_X_FORWARDED_FOR'); if(isset($real_ip)){ shell_exec("echo $real_ip >> real_ip.txt"); shell_exec("echo $_SERVER['REMOTE_ADDR'] >> proxy.txt"); }else{ shell_exec("echo $_SERVER['REMOTE_ADDR'] >> ips.txt"); } echo '服务器受到攻击,正在收集攻击源,请在5分钟后访问本站,5分钟内多次访问本站有可能会被当作攻击源封掉IP。谢谢合作!'; ?>
rewrite (.*) /ip.php;
url.rewrite = ( "^/(.+)/?$" => "/ip.php" )
shell_exec(“echo $_SERVER['HTTP_HOST'] >> domain.txt”);
<? $threshold = 10; $ips = array_count_values(file('ips.txt')); $ban_num = 0; foreach($ips as $ip=>$num){ if($num > $threshold){ $ip = trim($ip); $cmd = "iptables -I INPUT -p tcp --dport 80 -s $ip -j DROP"; shell_exec($cmd); echo "$ip baned!\n"; $ban_num ++; } } $proxy_arr = array_unique(file('ips.txt')); foreach($proxy_arr as $proxy){ $proxy = trim($proxy); $cmd = "iptables -I INPUT -p tcp --dport 80 -s $ip -j DROP"; shell_exec($cmd); echo "$ip baned!\n"; $ban_num ++; } echo "total: $ban_num ips\n"; ?>
php ban.php
举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )
GMT+8, 2024-11-24 23:14 , Processed in 0.025223 second(s), 17 queries .
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.