linux 防暴力破解

#!/bin/bash
SCANIP=`grep "Failed" /var/log/secure* | awk '{print $(NF-3)}'| sort |uniq -c | awk '{print $1":"$2}' |awk -F: '$1 >= 50 {print $2}'`
for i in $SCANIP
do
if [ -z "`iptables -vnL INPUT | grep $i`" ];then
iptables -I INPUT -s $i -j DROP
fi
done

原文地址:https://www.cnblogs.com/guxiaobei/p/8063818.html