#!/bin/sh
#
# Wrapper for wardrive
# Part of the THC Wardrive package by van Hauser / THC
# This needs the wireless-tools.rpm (e.g. from SuSE)
#

#
# daily reconfig
#
SAVE_LINK=0
SAVEFILE=./wardrive.stat

#
# all other config is loaded from "wardrive.conf" !
#
test -e "wardrive.conf" || { echo "Error: wardrive.conf not found in current directory"; exit 1; }
. ./wardrive.conf

# nothing to do from this point ...
export PATH=.:$PATH

./wardrive -v -b 1 -B 5 -i 1 -W -G \
  -d $DEVICE -p $SERPORT -I $INITSCRIPT -l $SAVE_LINK -o $SAVEFILE

# cleanup
killall tcpdump
killall dsniff
for i in *.sniff; do
    test -s "$i" || rm -f "$i"
    test -e "$i" && test 24 = `/bin/ls -ld -- $i|awk '{print $5}'` && rm -f "$i"
done
