-
Notifications
You must be signed in to change notification settings - Fork 0
/
monon
51 lines (39 loc) · 1.1 KB
/
monon
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
47
48
49
50
51
#!/system/bin/sh
# Initial configuration.
# - Channel: 11
# - Bandwidth: 40 MHz
# - CRC Check: true
# - Type (least significant to most significant):
# Management packets, Control packets, Data packets
# If you want data packets only, use 100
# - Conversion bit: not required (means no conversion - RADIOTAP
# instead of Ethernet)
CONF="1-16 99 1 999 0"
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
exit 1
fi
if [ ! -e "/sys/module/wlan/parameters/con_mode" ]; then
echo "Looks like you have an unsupported device"
exit 1
fi
if [ "$#" -ne "0" ]; then
if [ "$#" -eq "5" ]; then
CONF=$@
else
echo "Usage: $0 [channel bandwidth crccheck type conversion]"
exit 1
fi
fi
# Disable the interface
# 'ip link set wlan0 down' will not work because the daemon will reload the
# driver after some time, and interface will go down even if we set it up later
svc wifi disable
sleep 1
# Change driver mode to monitor-only
echo 4 > /sys/module/wlan/parameters/con_mode
# Wait for driver to reload
sleep 2
iwpriv wlan0 MonitorModeConf $CONF
iwpriv wlan0 monitor 1
ip link set wlan0 up