-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwifi-reg.sh
98 lines (87 loc) · 2.32 KB
/
wifi-reg.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#
# wifi-reg.sh
#
# Copyright 2017 c.realkiller <dino.tartaro@gmail.com>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#Displays the signal quality and the connection to adjust the wifi antenna
#for cantenna regulations (prinless tube ;-) )
lname=`basename $0 | cut -d '.' -f 1`
echo ${lname^^}
check_dp(){
name_d=`lsb_release -i | cut -d ':' -f2 | tr -d '\t'`
if [[ "$name_d" = "Debian" ]] || [[ "$name_d" = "Ubuntu" ]] || [[ "$name_d" = "Kali" ]]
then
dep=`dpkg -s wireless-tools |awk '/status|install/{print $3}'`
if [[ "$dep" != "ok" ]]
then
echo "wireless-tools is not installed"
sleep 2
echo "install it whith: sudo apt install wireless-tools"
sleep 2
echo "and launch this script again....exit!"
sleep 3
exit 1
fi
else
echo "wireless-tools is not installed"
sleep 2
echo "install it whith your package manager (apt, yum etc.. wireless-tools)"
sleep 2
echo "and launch this script again....exit!"
sleep 3
exit 1
fi
}
check_dp
if [ "$(id -u)" != "0" ]; then
sudo -k
wl=`sudo -S iwgetid | cut -d ' ' -f 1`
if sudo -n true 2>/dev/null; then
while (true)
do
clear
echo ${lname^^}
echo
sudo -S iwconfig $wl | grep -o -e $wl -o -e 'Link Quality=[^*]*' | cut -d '=' -f1,2,3,4
echo
echo "CTRL+C to stop this script"
sleep 1
clear
done
else
echo "close script"
sleep 3
exit 1
fi
else
wl=`iwgetid | cut -d ' ' -f 1`
while (true)
do
clear
echo ${lname^^}
echo
sudo -S iwconfig $wl | grep -o -e $wl -o -e 'Link Quality=[^*]*' | cut -d '=' -f1,2,3,4
echo
echo "CTRL+C to stop this script"
sleep 1
clear
done
fi
exit 0