Chinaunix首页 | 论坛 | 博客
  • 博客访问: 494567
  • 博文数量: 112
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 662
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-20 07:22
个人简介

一步一个脚印

文章分类

全部博文(112)

文章存档

2019年(2)

2017年(2)

2016年(2)

2015年(6)

2014年(35)

2013年(65)

分类: LINUX

2015-08-31 19:36:57

#/bin/bash
date
netstat -an | grep 1088 | awk '{print $5}'>iplist.txt #按应用端口匹配
echo "************************************************"
echo "The total of connections is `netstat -an | grep -c 1088`."
echo "************************************************"
echo "The total of different types of connections:"
netstat -an | grep 1088 | awk '{count[$6]++}END{for(i in count)print i,count[i]}' | sort -nrt ' ' -k 2 #按类型显示连接
echo "************************************************"
sed -i 's/::ffff://' iplist.txt
sed -i '/^:::/d' iplist.txt
sed -i 's/:[0-9]\{4,5\}//' iplist.txt
cat iplist.txt | sort | uniq -c | sort -nr | awk '{print "IP",$2,"has",$1,"connections."}' | head -10

阅读(1146) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~