
#!/bin/sh
# You'll either need execute this script as root, or allow user to
# use ifconfig/iwconfig in the sudoers file (which is my method)
mode=$(/sbin/iwconfig wlan0 |grep Mode |awk -F : '{print $2'} |awk '{print $1}')
if [[ "$mode" == "Managed" ]]; then
sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Monitor
sudo /sbin/ifconfig wlan0 up
echo "Monitor"
exit 1
elif [[ "$mode" == "Monitor" ]]; then
sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Managed
sudo /sbin/ifconfig wlan0 up
echo "Managed"
exit 2
else
echo "state error"
exit 127
fi
| The Following 3 Users Say Thank You to jd4200 For This Useful Post: | ||

#!/bin/sh
# You'll either need execute this script as root, or allow user to
# use ifconfig/iwconfig in the sudoers file (which is my method)
mode=$(/sbin/iwconfig wlan0 |grep Mode |awk -F : '{print $2'} |awk '{print $1}')
if [[ "$mode" == "Managed" ]]; then
sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Monitor
sudo /sbin/ifconfig wlan0 up
echo "Monitor"
exit 1
elif [[ "$mode" == "Monitor" ]]; then
sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Managed
sudo /sbin/ifconfig wlan0 up
echo "Managed"
exit 2
else
echo "state error"
exit 127
fi
Import which ever of the files you want below. Here's how. QueenBeecon config for showing IP QueenBeecon config for status of injection modules QueenBeecon config for status of interface (monitor/managed)
Interface status For this to work you need to give your self permissions to use iwconfig/ifconfig to change the interface properties which normally require root privallages. So add the following to /etc/sudoers: user ALL = NOPASSWD: /sbin/ifconfig user ALL = NOPASSWD: /sbin/iwconfig You must edit that file with "vi" (use the command visudo). Don't use any other text editor, they can screw with the file, seriously messing things up.
Load/Unload modules. Don't bother with this one yet, it's not working right. I'll update it when I figure it out. For this one to work you have to create a "state_file" to keep track of whether the modules are unloaded or loaded. So, create a new file called "state_file" in /tmp/ (nano /tmp/state_file), and then write "Unloaded" into the file and save it. (If you have them loaded, the write "Loaded" into it). To make sure this file is recreated on reboot, add the following: echo "Unloaded" > /tmp/state_file to this files: /etc/event.d/hildon-desktop