首页 > 系统服务 > 详细

shell黑名单

时间:2019-02-25 13:10:30      阅读:156      评论:0      收藏:0      [点我收藏+]
#/bin/bash
netstat -ant | grep "EST" | grep -v "22000" | awk {print $5} | grep -v "^10" | cut -d ":" -f1 | sort | uniq -c | sort -nr | awk $1 > 4 {print $1,$2} > /root/root/black.txt

for i in `awk {print $2} /root/root/black.txt`
do
COUNT=`grep $i /root/root/black.txt | awk {print \$1}`
DEFINE="4"
ZERO="0"
if [ $COUNT -gt $DEFINE ];
  then
  grep $i /root/root/white.txt > /dev/null
    if [ $? -gt $ZERO ];
      then
      echo "$COUNT $i"
      iptables -F
      iptables -I INPUT -i em1 -p tcp -s $i -j DROP
    fi
fi
done    


iptables -I INPUT -i em1 -p tcp --dport 80 -m connlimit  --connlimit-above 10 -j DROP

 

shell黑名单

原文:https://www.cnblogs.com/icemonkey/p/10430316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!