-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwlan_scanner.sh
executable file
·51 lines (44 loc) · 1007 Bytes
/
wlan_scanner.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
#!/bin/bash
COUNT=20;
WLAN_ADAPTER='wlan0';
STRENGTH=0;
usage()
{
cat << EOF
usage:
Connect to the Wifi network you want to test
For a standard test, no options are necessary
OPTIONS:
-h Show this message
-a WLAN Adapter name (default: wlan0)
-c Number of measurements (default 10
EOF
}
while getopts "hc:a:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
c)
COUNT=$OPTARG
;;
a)
WLAN_ADAPTER=$OPTARG
;;
?)
usage
exit 1
;;
esac
done
for((i=0;i<$COUNT;i++))
do
TMP_STRENGTH=$(iwconfig $WLAN_ADAPTER | grep 'Signal level='|awk -F'=' '{ print $2 }' | awk -F'/' '{ print $1 }');
STRENGTH=$(($STRENGTH+TMP_STRENGTH));
echo "Link Quality: "$TMP_STRENGTH;
sleep 0.5;
done
QUALITY=$(( STRENGTH / COUNT ));
echo "Average quality of "$WLAN_ADAPTER": "$QUALITY"/70";