自动屏蔽访问异常的ip脚本

#!/bin/bash
netstat -an|grep 80 |awk -F[:' ']+ '{print $6}'  |sort -rn |uniq -c|awk '{ if($1>=25)print $2}'>/tmp/dropip
#netstat -an|grep EST |awk -F[:' ']+ '{print $6}'  |sort -rn |uniq -c |sort -rn |head -10 |awk '{ if($1>15)print $2}'>/tmp/dropip
for i in $(cat /tmp/dropip|grep -v '127.0.0.1')
do
/sbin/iptables -I INPUT -p tcp --dport 80 -s $i -j DROP
echo "$i kill at `date`" >>/var/log/gua_ip.txt
done

本文标题:自动屏蔽访问异常的ip脚本
本文链接:http://www.xwwzsj.com/article/jeghdp.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款