[wifi] capture: add date to archive name

Add the current date and time to the archive name.
Set the random part of the name to 2 characters.
This commit is contained in:
Matteo Cypriani 2011-08-06 15:49:43 +02:00
parent 627102d6ce
commit ddfa6e0b49
1 changed files with 4 additions and 1 deletions

View File

@ -61,6 +61,8 @@ IFACE=$1
OS=`uname`
OS_RELEASE=`uname -r`
HOSTNAME=`uname -n`
# Current date:
DATE=`date +%FT%H%M%S`
echo -n "Shuting down interface $IFACE... "
ifconfig $IFACE down && echo "OK." \
@ -88,7 +90,8 @@ ifconfig $IFACE up && echo "OK." \
|| error "Cannot turn the interface up!"
echo "Capturing $NB_PKT packets..."
DIR=$(mktemp -d "$TMP"/capture_${OS}-${OS_RELEASE}_${IFACE}_${HOSTNAME}-XXXXXXXXXX)
DIR=$(mktemp -d \
"$TMP"/capture_${OS}-${OS_RELEASE}_${IFACE}_${HOSTNAME}_${DATE}_XX)
FILE="$DIR/$FILE"
tcpdump -i $IFACE -c $NB_PKT -w "$FILE"
echo "Capture file \"$FILE\" created."