#!/bin/sh
/bin/netstat -an|grep ESTABLISHED|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -rn|grep -v -E ‘172.10|127.0′|awk ‘{if ($2!=null && $1>100) {print $2}}’>/tmp/ddosip
for i in $(cat /tmp/ddosip)
do
/sbin/iptables -I INPUT -p tcp -m tcp -s $i –dport 80 –syn -j REJECT
done |
#!/bin/sh
/bin/netstat -an|grep ESTABLISHED|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -rn|grep -v -E ‘172.10|127.0′|awk ‘{if ($2!=null && $1>100) {print $2}}’>/tmp/ddosip
for i in $(cat /tmp/ddosip)
do
/sbin/iptables -I INPUT -p tcp -m tcp -s $i –dport 80 –syn -j REJECT
done
Related Posts
不知道会不会将百度、Google等蜘蛛也给屏蔽了?
它们爬到网站上应该不会这么多并发