shell脚本查找tcp过多ip地址封掉
#!/bin/bash
#hc
source /etc/profile
iplist=`netstat -ntu | awk '{print $5}'| cut -d':' -f1| sort |uniq -c | sed 'N;$d;P;D' | awk '{if($1>100)print $2}'`
for ip in $iplist
do
iptables -I INPUT -s $ip -j DROP
echo "$ip is drop!"
done
####定时任务
crontab -e
*/5 * * * * /bin/bash /service/script/netstatip.sh
shell脚本查找tcp过多ip地址封掉的更多相关文章
- Shell脚本实现自动修改IP地址
作为一名Linux SA,日常运维中很多地方都会用到脚本,而服务器的ip一般采用静态ip或者MAC绑定,当然后者比较操作起来相对繁琐,而前者我们可以设置主机名.ip信息.网关等配置.修改成特定的主机名 ...
- CentOS 通过shell脚本过滤得到服务器IP地址
1.CentOS 6.x (32Bit &&64Bit) [root@localhost ~]# ifconfig |grep Bcast |awk '{print$2}' |sed ...
- .Neter玩转Linux系列之四:Linux下shell介绍以及TCP、IP基础
基础篇 .Neter玩转Linux系列之一:初识Linux .Neter玩转Linux系列之二:Linux下的文件目录及文件目录的权限 .Neter玩转Linux系列之三:Linux下的分区讲解 .N ...
- Shell脚本实现检测某ip网络畅通情况,实战用例
Shell脚本实现检测某ip网络畅通情况,实战用例 环境准备,linux shell 发送email 邮件:1.安装sendmailyum -y install sendmail安装好sendmail ...
- linux shell 脚本实现tcp/upd协议通讯(重定向应用)
linux shell 脚本实现tcp/upd协议通讯(重定向应用) http://www.cnblogs.com/chengmo/archive/2010/10/22/1858302.html
- Shell 脚本实现TCP/UDP协议通讯
Shell 脚本实现TCP/UDP协议通讯 http://www.cnblogs.com/occult/archive/2012/12/25/2832183.html
- shell中获取本机ip地址
shell中获取本机ip地址 方法一: /sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr ...
- 使用shell脚本实现ping对应IP所对应的人名
#!/bin/bash a=(张三 李四 王五 赵六) ..} do . $((${i}+)) >dev/>&;then ))"号"${a[${i}]}&quo ...
- 利用脚本设置本机IP地址
各位同学,在日常工作中.常出现需要指定IP的地址的清况.为了解决这一个问题,我特意为自己编写了一段脚本.方便设定自己笔记本的IP地址.供大家参考. 其中包括无线wifi和有线网络设定两个IP的操作. ...
随机推荐
- hdu 1026 Ignatius and the Princess I(bfs)
Ignatius and the Princess I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- SAX解析xml (遍历DOM树各节点)
本文参考 http://yangjunfeng.iteye.com/blog/401377 1. books.xml <?xml version="1.0" encoding ...
- vue在渲染之前拿到数据操作.......vue数据获取
异步请求数据,但是生命周期函数也是异步的,怎么才能保证渲染之前就能拿到数据呢? 官方给了两种方案, 我们可以在异步获取数据的时候加上一个loading表示现在在获取数据..... 由于ajax是异步操 ...
- 5-1rquests模拟登陆知乎之httpcode
1,状态码: 400错误:请求无效 (Bad request);出现这个请求无效报错说明请求没有进入到后台服务里 2,requests库:python常用的库,有空仔细阅读一下官方文档
- codeforce 378 div 2 F —— Drivers Dissatisfaction (最小生成树,LCA,倍增)
官方题解: If you choose any n - 1 roads then price of reducing overall dissatisfaction is equal to min(c ...
- 第三章 通过java SDK 实现个性化智能合约的部署与测试
想了解相关区块链开发,技术提问,请加QQ群:538327407 前提 已经部署好底层,外网可以正常请求访问. 正常流程 1.基础合约处理 https://fisco-bcos-documentatio ...
- H3C 收敛速度慢
- es6 let和const的用法
]()) {; } //console.log(MAX);//MAX is not defined" /*也有暂时性死区,声明的位置需要在使用前面,否则报错: * 不能重复声明变量 * */ ...
- River Hopscotch-[二分查找、贪心]
Description Every year the cows hold an event featuring a peculiar version of hopscotch that involve ...
- 21个项目玩转深度学习:基于TensorFlow的实践详解03—打造自己的图像识别模型
书籍源码:https://github.com/hzy46/Deep-Learning-21-Examples CNN的发展已经很多了,ImageNet引发的一系列方法,LeNet,GoogLeNet ...