forked from vdqbstp/TinyCheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
79 lines (68 loc) · 1.92 KB
/
uninstall.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
delete_folder(){
echo "[+] Deleting TinyCheck folders"
rm -rf /usr/share/tinycheck/
}
delete_services(){
echo "[+] Deleting TinyCheck services"
systemctl disable tinycheck-frontend &> /dev/null
systemctl disable tinycheck-backend &> /dev/null
systemctl disable tinycheck-kiosk &> /dev/null
systemctl disable tinycheck-watchers &> /dev/null
rm /lib/systemd/system/tinycheck-frontend.service
rm /lib/systemd/system/tinycheck-backend.service
rm /lib/systemd/system/tinycheck-kiosk.service
rm /lib/systemd/system/tinycheck-watchers.service
}
updating_config_files(){
echo "[+] Updating dnsmasq and dhcpcd configuration files"
sed -i '/## TinyCheck configuration ##/,$d' /etc/dnsmasq.conf
sed -i '/## TinyCheck configuration ##/,$d' /etc/dhcpcd.conf
}
deleting_icon(){
echo "[+] Deleting desktop icon"
rm "/home/${SUDO_USER}/Desktop/tinycheck.desktop"
}
delete_packages(){
pkgs=("hostapd"
"zeek"
"tshark"
"dnsutils"
"suricata"
"unclutter"
"sqlite3"
"nodejs")
echo -n "[?] Do you want to remove the installed packages? (Yes/no) "
read answer
if [[ "$answer" =~ ^([yY][eE][sS]|[yY])$ ]]
then
for pkg in "${pkgs[@]}"
do
apt -y remove $pkg && apt -y purge $pkg
done
fi
apt autoremove &> /dev/null
}
update_hostname(){
echo -n "[?] Please provide a new hostname: "
read hostname
echo "$hostname" > /etc/hostname
sed -i "s/tinycheck/$hostname/g" /etc/hosts
}
reboot_box() {
echo -e "\e[92m[+] TinyCheck uninstalled, let's reboot.\e[39m"
sleep 5
reboot
}
# Checking rights.
if [[ $EUID -ne 0 ]]; then
echo "The update must be run as root. Type in 'sudo bash $0' to run it as root."
exit 1
else
delete_folder
delete_services
updating_config_files
deleting_icon
update_hostname
delete_packages
reboot_box
fi