|

楼主 |
发表于 2006-2-20 13:37:47
|
显示全部楼层
多谢了,已经可以了
#! /bin/bash
m=`date +%b`;
d=`date +%d`;
cat /var/log/messages |grep $m |grep $d > test.txt;
cat test.txt |grep sshd|grep failure|grep -v Failed|awk '{print $13}' |cut -c 7-21|grep -v 219.142.174.152|grep -v 210.51.7|sort|uniq|grep -v -|grep -v [a-z]>iptables.txt;
for i in `sort -u iptables.txt`;
do
/sbin/iptables -I INPUT -s $i -p tcp --dport 22 -j DROP;
done
echo iptables update ok! |
|