#!/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