I want to make a sniffing script with optargs.
This is the script
#!/bin/bash
if [[ $EUID -gt 0 ]];then
echo "$(basename "$0") requires root privileges"
exit 1
fi
function help(){
echo ""
echo "Usage: $(basename "$0") -i interface -b mac_address"
echo ""
echo " -i Wireless interface name (monitor mode)"
echo " -b BBSID wireless mac"
}
function sniff(){
airodump-ng "$1" -w PSK -c 36 --bssid "$2"
if [ $? -gt 0 ];then
echo "[!] Error. Check that SSID name is Radius and channel is 7"
exit 2
fi
}
while getopts "h:i:b:" option;do
case "$option" in
h)
help
;;
i)
i=$OPTARG
;;
b)
b=$OPTARG
;;
esac
done
sniff "$i" "$b"
I would want to make this:
For example:
script.sh -i wlan0 -b FF:FF:FF:FF:FF:FF
But i cant run with -h option