#!/bin/sh

prefix=/usr/local
ETC=${prefix}/etc

#if [ "$2" == "true" ]; then
#	echo "Enabling WEP"
#	wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11PrivacyInvoked=true
#fi

if test "$1" = ""; then
	echo "$0 <Channel number>"
	echo "Defaulting to channel 6"
	chan=6
else
	chan=$1
fi

if test "$2" = ""; then
    device=`grep -e "^\ *capinterface *=" $ETC/kismet.conf | cut -d= -f2 | tr -d [:blank:]`
else
    device=$2
fi

if test "$device" = ""; then
    echo "Could not determine what capture device is being used."
    echo "Please make sure your 'capinterface=' is valid or specify the device on the $0 command"
    echo "line."
    exit 1
fi

/sbin/ifconfig $device -promisc
/sbin/wlanctl-ng $device lnxreq_wlansniff channel=$chan enable=false

