#!/bin/bash
if [ "$1" != "" ] && [ "$2" != "" ]; then
TRUE=1
while [ $TRUE ]
do
r_date=`date +%Y%m%d%H%M`
let d_date=$(($r_date+$2))
echo $d_date
tcpdump -nn -i $1 -w $r_date.pcap &
ex_tcpdump=`echo $!`
while [ $TRUE ]
do
tmp_date=`date +%Y%m%d%H%M`
if [ $d_date -le $tmp_date ];
then
kill $ex_tcpdump
break
else
continue
sleep 1
fi
done
done
break
else
echo $0 ': version 0.0.1a by stevebooks.com'
echo 'Usage:' $0 '<interface> <dalay(per minitues)>'
echo '=============================================='
echo 'e.g.' $0 'eth0 1'
fi
chmod 755 capture.sh
아래와 같이 script를 실행하면 됩니다. (eth0 interface를 이용하여 2분단위로 capture파일 생성)
./capture.sh eth0 2
Script download
참고: tcpdump filter options (http://www.wains.be/pub/networking/tcpdump_advanced_filters.txt)
참고: tcpdump filter options (http://www.wains.be/pub/networking/tcpdump_advanced_filters.txt)
댓글 없음:
댓글 쓰기