杰网资源 Design By www.escxy.com
复制代码 代码如下:
##############################################
#version="20100718"
#author="phpsir"
#author_email="phpsir@phpsir.com"
##############################################
maxnum=50
runmin_max=300
#runmin_max is clear time
ipfile="/tmp/80link.txt"
banip_data_file="/root/banip_data.txt"
ipopenfile="/root/openip.txt"
nsfile="/tmp/netstat80.txt"

myip=`/sbin/ifconfig eth0 | grep inet | awk '{print $2}' | sed 's/addr://' | grep .`
if [ ! -f $ipopenfile ]
then
echo "init $ipopenfile"
touch $ipopenfile
fi
if [ -f $banip_data_file ]
then
source $banip_data_file
echo "last runtime=$runtime"
else
echo "init $banip_data_file"
echo 'runtime='`date "+%s"` > $banip_data_file
source $banip_data_file
runmin_max=-1
fi

echo "start shell" `date "+%Y-%m-%d %H:%M:%S"`
runmin=$((`date "+%s"`-$runtime))
if [ $runmin -gt $runmin_max ]
then
echo $runmin "is bigger than " $runmin_max
echo "clear ips"
/sbin/iptables -F
echo 'runtime='`date "+%s"` > $banip_data_file
else
echo $runmin "is lowwer than " $runmin_max
fi

netstat -an | grep "$myip:80" > $nsfile

echo "Total Links = " `cat $nsfile | wc -l `
echo "Total Links ESTABLISHED = " `cat $nsfile | grep ESTABLISHED | wc -l `
echo "Total Links SYNC = " `cat $nsfile | grep SYN | wc -l `

cat $nsfile | awk '{print $5}' | awk -F: '{print $1}' | sort|uniq -c|sort -rn | head -n 10 > $ipfile

cat $ipfile | while read oneline
do
ip=`echo $oneline | cut -d " " -f 2`
num=`echo $oneline | cut -d " " -f 1`
str="$ip has linked $num "
banme="yes"

for allowip in `cat $ipopenfile`
do
echo $ip | grep $allowip > /dev/null
if [ $? -eq 0 ]
then
banme="no"
echo $allowip "banme = " $banme
/sbin/iptables -D INPUT -p tcp -s $ip -d $myip --dport 80 -j REJECT > /dev/null 2>&1
continue
fi
done

if [ $banme = "yes" ]
then
if [ $num -gt "$maxnum" ]
then
/sbin/iptables -L -n | grep "$ip" >/dev/null
status=`echo $?`
if [ $status -eq 1 ]
then
echo "deny $ip ,because $str "
/sbin/iptables -A INPUT -p tcp -s $ip -d $myip --dport 80 -j REJECT
echo "BAN " $ip " OK "
#/sbin/iptables -L -n | grep "$ip"
else
echo > /dev/null
#echo "$str alread reject"
fi
else
echo > /dev/null
#echo "$str $ip ok ,less $maxnum "
fi
fi

done

echo "stop shell" `date "+%Y-%m-%d %H:%M:%S"`
标签:
centos,redhat

杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。