码迷,mamicode.com
首页 > 系统相关 > 详细

用shell脚本实现防DOS***-网络连接法

时间:2019-03-20 11:57:05      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:one   done   NPU   sort   line   shell   print   bash   ash   

#!/bin/bash
netstat -antup|grep SYN_RECV|awk ‘{print $5}‘|awk -F: ‘{print $1}‘|sort|uniq -c>/opt/tmp
exec</opt/tmp
while read line
do
count=echo $line|awk ‘{print $1}‘
ip=echo $line |awk ‘{print $2}‘
if [ $count -gt 128 ]
then iptables -I INPUT -s $ip -j DROP
fi
done

用shell脚本实现防DOS***-网络连接法

标签:one   done   NPU   sort   line   shell   print   bash   ash   

原文地址:https://blog.51cto.com/14241151/2365808

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!