-
Notifications
You must be signed in to change notification settings - Fork 6
/
dmc.sh
65 lines (55 loc) · 1.43 KB
/
dmc.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# TODO interface select, sound alarm
MAC=$1
FREQ5=$2
IFACE=wlan0
FILE=/tmp/$RANDOM
echo -e "\033[01;97m"
echo '
.- _ _ -.
/ / \ \
( ( (` (-o-) `) ) )
\ \_ ` -+- ` _/ /
`- -+- -`
-+-
_|_
____ _____ _____
| \| | |
| | | | | | --|
|____/|_|_|_|_____|
'
echo ' DMC - Decibel-Meter Converter'
echo -e "\e[0m"
echo
if [[ ! "$MAC" ]]
then
echo 'Usage : dmc MAC (5GHz)'
exit 1
fi
#/etc/init.d/network-manager stop
#killall wpa_supplicant
airmon-ng check kill
# these processes could mess up the sniffing
if [[ "$FREQ5" ]]
then
airodump-ng $IFACE -b a -w $FILE --output-format csv &>/dev/null &
else
airodump-ng $IFACE -w $FILE --output-format csv &>/dev/null &
fi
sleep 5
while true
do
dbm=$(grep -i "$MAC" $FILE-01.csv | tail -n 1 | cut -d ',' -f 4 | tr -d ' -')
if [[ "$dbm" ]]
then
if [[ "$FREQ5" ]]
then
python -c "from math import log10 ; print(round(10 ** (( 27.55 - (20 * log10(5200)) + $dbm ) / 20 ),2))"
else
python -c "from math import log10 ; print(round(10 ** (( 27.55 - (20 * log10(2500)) + $dbm ) / 20 ),2))"
fi
# for more details - https://gist.github.com/cryptolok/516471ce35a9851197b204853c6de080
fi
sleep 10
# 10 seconds is the optimal time interval between measurements based on my cases
done