|
|
发表于 2011-12-6 13:44:34
|
显示全部楼层
|
不无聊,求教程搜索到一个脚本[ol]#! /bin/bashcat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > /root/satools/black.txtDEFINE="100"for i in `cat /root/satools/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.denyfifidone[/ol]复制代码 |
|