#! /bin/bashcat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > /root/black.txtDEFINE="100"for i in `cat /root/black.txt`doIP=`echo $i |awk -F= '{print $1}'`NUM=`echo $i|awk -F= '{print $2}'`if [ $NUM -gt $DEFINE ];thengrep $IP /etc/hosts.deny > /dev/nullif [ $? -gt 0 ];thenecho "sshd:$IP" >> /etc/hosts.denyecho "vsftpd:$IP" >> /etc/hosts.denyfifidone