防DDOS攻击SHELL脚本

 

echo ———————————————————————-
netstat -anpt |grep :80 |awk ‘{print $5 }’|sort | awk -F: ‘{print $1}’|uniq -c |awk ‘$1 >100 {print $1,$2}’ >/etc/nginx/iplist.txt
for ip in `awk ‘{print $2}’ /etc/nginx/iplist.txt`
do
echo “$ip”;
/sbin/iptables -I INPUT -s “$ip” -j DROP;
done
echo ———————————————————————-

 

#ddos_shell
*/1 * * * * /etc/nginx/ddos.sh >/dev/null;sleep 20;/etc/nginx/ddos.sh >/dev/null;sleep 20;/etc/nginx/ddos.sh >/dev/null;
*/10 * * * * service iptables restart;

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注