forked from SpyGuard/SpyGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·61 lines (52 loc) · 1.39 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·61 lines (52 loc) · 1.39 KB
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
delete_folder(){
echo "[+] Deleting SpyGuard folders"
rm -rf /usr/share/spyguard/
}
delete_services(){
echo "[+] Deleting SpyGuard services"
systemctl disable spyguard-frontend &> /dev/null
systemctl disable spyguard-backend &> /dev/null
systemctl disable spyguard-watchers &> /dev/null
rm /lib/systemd/system/spyguard-frontend.service
rm /lib/systemd/system/spyguard-backend.service
rm /lib/systemd/system/spyguard-watchers.service
}
delete_packages(){
pkgs=("tshark"
"dnsutils"
"suricata"
"sqlite3")
echo -n "[?] Do you want to remove the installed packages? (Yes/no) "
read answer
if [[ "$answer" =~ ^([yY][eE][sS]|[yY])$ ]]
then
rm -rf /var/log/suricata
for pkg in "${pkgs[@]}"
do
apt -y remove $pkg && apt -y purge $pkg
done
fi
apt autoremove &> /dev/null -y
}
update_hostname(){
echo -n "[?] Please provide a new hostname: "
read hostname
echo "$hostname" > /etc/hostname
sed -i "s/spyguard/$hostname/g" /etc/hosts
}
reboot_box() {
echo -e "\e[92m[+] SpyGuard 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
update_hostname
delete_packages
reboot_box
fi