I'm sick of typing this one out and I don't want to depend on aicrack-ng or the like for their special utilities. I suppose I could have went a step further and created a new virtual interface but I dgaf.
#!/bin/bash
# Change given interface to monitor mode..
export IFACE=$1
export MODE
usage() {
echo "Usage: $0 <interface>"
}
identifyWorth() {
if [ `whoami` != "root" ]; then
echo "Get root and try again."
exit
fi
}
checkMode() {
MODE=`iwconfig $IFACE | grep Mode`
MODE=`echo ${MODE:30:7}`
if [ $MODE = "Monitor" ]; then
MODE="Monitor"
else
MODE="Managed"
fi
}
setMode() {
if [ $MODE = "Monitor" ]; then
ifconfig $IFACE down; iwconfig $IFACE mode managed
ifconfig $IFACE up
fi
if [ $MODE = "Managed" ]; then
ifconfig $IFACE down; iwconfig $IFACE mode monitor
ifconfig $IFACE up
fi
}
showMode() {
echo $IFACE "is now in" $MODE "mode."
}
identifyWorth
if [ -z $1 ]; then
usage
exit
fi
checkMode
setMode
checkMode
showMode