#!/bin/sh


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

#echo "Disabling WEP"
#wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11PrivacyInvoked=false

if test "$1" = ""; then
	echo "No channel number given.  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

echo "Enabling monitor mode on interface $device channel $chan."

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

