Shell防DDOS攻击原理
2016-05-29 10:36
405 查看
#!/bin/sh #date:2015-12-13 #filename:fang-DOS.sh #version:v1.0 while true do #awk '{print $1}' access_2015-12-15.log|grep -v "^$"|sort|uniq -c >/tmp/tmp.log netstat -an|grep EST|awk -F '[ :]+' '{print $6}'|sort|uniq -c >/tmp/tmp.log exec </tmp/tmp.log while read line do ip=`echo $line|awk '{print $2}'` count=`echo $line|awk '{print $1}'` if [ $count -gt 3 ] && [ `iptables -L -n|grep "$ip"|wc -l` -lt 1 ] then iptables -I INPUT -s $ip -j DROP echo "$line is dropped" >>/tmp/droplist.log fi done sleep 5 done
更多内容请访问 李兴利博客
相关文章推荐
- 命令man的用法
- Shell脚本调试技巧
- bash shell内置命令
- 如何解决xshell中数字键盘不能使用的问题
- shell编程知识点集锦
- shell编程知识点集锦
- shell变量和环境变量
- SHELL NOTES
- shell脚本---grep、awk、sed工具
- 安卓虚拟机adb shell sqlite3数据库
- [Shell]数组与关联数组
- bash 历史扩展
- bash文本输入
- Linux Shell 文本处理工具集锦 zz
- Shell Script函数
- ADB SHELL 你值得拥有
- 在windows操作系统下远程控制树莓派3(树莓派3安装win10系统)
- shell基础知识
- linux,Centos,bash: service: command not found
- linux shell环境变量总结