Created
July 16, 2015 22:42
-
-
Save hoenirvili/0bb12d8ad33971caccf6 to your computer and use it in GitHub Desktop.
Script to change the mode of a wireless interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function root | |
{ | |
if [[ $EUID -ne 0 ]] | |
then | |
echo 'This script must be run as root' | |
exit 1 | |
else | |
__run__ | |
fi | |
} | |
function options | |
{ | |
echo | |
echo "Please choose the mode you wish your chipset to be set on" | |
echo "1.Monitor mode" | |
echo "2.Managed mode" | |
echo -n "Mode : " | |
read mode | |
if [ $mode -eq 1 ] | |
then | |
ifconfig $1 down | |
iwconfig $1 mode monitor | |
ifconfig $1 up | |
elif [ $mode -eq 2 ] | |
then | |
ifconfig $1 down | |
iwconfig $1 mode managed | |
ifconfig $1 up | |
fi | |
} | |
function interface | |
{ | |
echo "Choose the interface you wish to manage" | |
echo -n "Interface : " | |
read interface | |
echo | |
echo "Your inteface is: $interface" | |
echo | |
} | |
function __run__ | |
{ | |
interface | |
options $interface | |
} | |
root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment