最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
linux中网卡发包很大时抓包shell脚本
时间:2015-11-22 编辑:简简单单 来源:一聚教程网
我无耻的把阿铭linux的脚本转过来了,有时候检查的时候说不定会用上.
#!/bin/sh
#
# setup area
#
SNIF_IF=eth0
PKG_threshold=7000
SAVE_DIR=/home/snif_log
SNIF_COUNT=2000
#
# don't change
#
[ ! -d $SAVE_DIR ] && mkdir -p $SAVE_DIR
while :;
do
PKG_CUR=`sar -n DEV 1 2|grep $SNIF_IF|head -n 2|tail -n 1|awk '{print $3}'|cut -d. -f1`
#如果sysstat以12小时(AM,PM)计时,则重新取一次,以获得正确结果
[ "x$PKG_CUR" = "x$SNIF_IF" ] && PKG_CUR=`sar -n DEV 1 2|grep $SNIF_IF|head -n 2|tail -n 1|awk '{print $4}'|cut -d. -f1`
if [ $PKG_CUR -gt $PKG_threshold ];then
tcpdump -n -i $SNIF_IF -c $SNIF_COUNT -vs0 -w $SAVE_DIR/$SNIF_IF.`date +%m%d-%H%M`.cap
#tcpdump -n -i $SNIF_IF -c $SNIF_COUNT -w $SAVE_DIR/$SNIF_IF.`date +%m%d-%H%M`.cap
fi
sleep 300
done
相关文章
- 在Linux系统下使用TUN/TAP虚拟网卡的基本教程 12-20
- linux下shell脚本实时监控网卡流量 07-14
- Linux操作系统找不到网卡解决办法 12-19
- linux系统查看网卡实时流量(nload ifstat iftop)命令详解 06-25
- linux网卡掉包或挂掉解决办法 09-13
- Linux启动网卡方法 10-31