Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->Linux程序设计 ->正文

利用ip_conntrack表实现封ip的shell脚本,并有简单的web发布

来源:Linuxdby.com 作者:Webmaster 时间:2007-06-04 点击: [收藏] [投稿]

awk'{$1}{if($1>30&&$1<50)print$1,$2}'/tmp/tmp11.txt|sort-nr|awk'{print"<p>"$1"\t","<b>"$2"</b>""\t""kill10min""</p>"}'>>/var/www/html/wwy/drop/index.html
echo"<p><b>Youcan\"ctrl F\"tofindyourip'sconnects.(total$wcIPsat$date)</b></p>">/var/www/html/wwy/all/index.html
echo"<p><ahref=../drop><--back</a></p>">>/var/www/html/wwy/all/index.html
cat/tmp/tmp11.txt|sort-nr|awk'{print"<p>"$1"\t",$2"\t""</p>"}'>>/var/www/html/wwy/all/index.html

#####################################
##-----------------UseiptablestoDROP---------------------##
#####################################

make_clr
if[-s/tmp/tmp33-3.txt];then
kill30m/tmp/tmp33-3-clr.txt/tmp/tmp33-3.txt&
sleep1s
fi
if[-s/tmp/tmp33-2.txt];then
kill15m/tmp/tmp33-2-clr.txt/tmp/tmp33-2.txt&
sleep1s
fi
if[-s/tmp/tmp33-1.txt];then
kill10m/tmp/tmp33-1-clr.txt/tmp/tmp33-1.txt&
sleep1s
fi

#-------------------------------
elif["$date2"-lt5]&&["$date2"-gt3]
then
whilereadclrall;do
clr_conns$clrall
done</tmp/tmp111.txt
echo"clrat$date">>/tmp/killip/tmp.log.txt
fi

#####################################
##-------------------makesystemlog------------------------##
#####################################
if[!-e/tmp/killip/tmp.log.txt];then
mkdir/tmp/killip
touch/tmp/killip/tmp.log.txt
fi
echo"$wc$date$cpu$cpu2$wcblackip3 $wcblackip2 $wcblackip1">>/tmp/killip/tmp.log.txt



 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:30分钟搞定BASH脚本编程!   下一篇:HowtoCreatingandBootingaNewKernelWithautoconfig

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号