-
Notifications
You must be signed in to change notification settings - Fork 88
/
start-mon.sh
executable file
·46 lines (36 loc) · 1.01 KB
/
start-mon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
SCRIPT_NAME="start-mon.sh"
SCRIPT_VERSION="20211008"
# Simple script to start monitor mode on the provided wlan interface
# Check to ensure sudo was used
if [[ $EUID -ne 0 ]]
then
echo "You must run this script with superuser (root) privileges."
echo "Try: \"sudo ./${SCRIPT_NAME}\""
exit 1
fi
clear
echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}"
# Set color definitions (https://en.wikipedia.org/wiki/ANSI_escape_code)
RED='\033[0;31m'
YELLOW='\033[0;33;1m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
iface0mon='wlan0mon'
interface=${1:-wlan0}
# Check if interface exists
ip link set $interface down
if [ $? -eq 0 ]
then
ip link set $interface name $iface0mon
iw $iface0mon set monitor control
ip link set $iface0mon up
iw dev
else
echo -e "${RED}ERROR: ${YELLOW}Please provide an existing interface as parameter! ${NC}"
echo -e "${NC}Usage: start-mon.sh [interface:wlan0] ${NC}"
echo -e "${NC}Tips: check with ${CYAN}iw dev ${NC}which interfaces are available! ${NC}"
exit 1
fi
exit 0