Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ##works on bash and zsh
- ##SOME CONFIG##
- RED="\e[0;31m" ;
- YEL="\e[0;33m" ;
- NORM="\e[0m" ;
- tst=`ifconfig | grep mon | cut -b 1-4`
- arr_tst=($(echo $tst | tr " " "\n"))
- fun_test() { ##CHECK THE ERROR STATUS
- if [[ $? -eq 0 ]]
- then
- ext="[OK]"
- else
- ext="$RED [ERROR] $NORM"
- exit 1
- fi
- }
- fun_start () {
- echo "Searching monitor Interfaces:"
- echo -e $YEL
- if [[ ${#arr_tst[@]} -eq "0" ]]
- then
- echo "No Monitor mode InterfaceS was found"
- else
- echo -e "This Monitor mode Interfaces was found:"
- #echo ${#arr_tst[@]} TEST INTERFACES NUMBER
- sleep 1
- for r in ${!arr_tst[@]}
- do
- echo ${arr_tst[r]}
- done
- echo "Monitor mode already started
- exiting..."
- exit 0
- fi
- echo -e $NORM
- sudo ifconfig wlan0 down &> /dev/null ##PUT WLAN0 DOWN OPTIONAL
- sudo macchanger -r wlan0 &> /dev/null ## CHANGE MAC WLAN0 OPTIONAL
- fun_test
- echo -e "set macchanger wlan0: $ext"
- sudo airmon-ng start wlan0 &> /dev/null ## START MON MODE ON WLAN0
- fun_test
- echo -e "start monitor mode: $ext"
- sudo ifconfig mon0 down &> /dev/null ## PUT MON0 DOWN
- sudo macchanger -r mon0 &> /dev/null ## CHANGE MAC MON0
- fun_test
- echo -e "set macchanger mon0: $ext"
- sudo ifconfig mon0 up &> /dev/null ## PUT MON0 UP
- }
- fun_stop () {
- echo "Stopping Monitor mode Interfaces"
- if [[ ${#arr_tst[@]} -eq "0" ]]
- then
- echo "No Monitor mode Interface was found exiting..."
- exit 0
- else
- for o in ${!arr_tst[@]}
- do
- sudo airmon-ng stop ${arr_tst[o]} &> /dev/null ## STOP ALL MON INTERFACES
- fun_test
- echo -e "Stopping ${arr_tst[o]} : $ext"
- sleep 2
- done
- exit 0
- fi
- }
- fun_usage () {
- echo -e $YEL
- echo -e "[*]If not yet started, make up & running monitor mode Interfaces"
- echo -e "USAGE: $0 { start | stop }"
- echo
- echo -e "[*] $0 start"
- echo -e "[i] Turn mon0 Monitor mode Interface ON"
- echo
- echo -e "[*] $0 stop"
- echo -e "[i] Turn ALL Monitor mode Interfaces OFF"
- echo -e $NORM
- exit 0
- }
- fun_arg () {
- if [[ $# != "1" ]]
- then
- echo "need start or stop argument"
- fun_usage
- else
- case $1 in
- start) fun_start ;;
- stop) fun_stop ;;
- *) fun_usage ;;
- esac
- fi
- }
- if [ $UID -eq 0 ] ## CHECK PERMISSION
- then
- echo
- else
- gksu
- fi
- fun_arg $1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement