2022-11-06 15:51:33 +01:00
|
|
|
|
|
|
|
delete_folder(){
|
2024-01-15 22:47:33 +01:00
|
|
|
echo "[+] Deleting SpyGuard folders"
|
2022-11-06 15:51:33 +01:00
|
|
|
rm -rf /usr/share/spyguard/
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_services(){
|
2024-01-15 22:47:33 +01:00
|
|
|
echo "[+] Deleting SpyGuard services"
|
2022-11-06 15:51:33 +01:00
|
|
|
|
|
|
|
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")
|
2024-01-15 23:25:04 +01:00
|
|
|
|
2022-11-06 15:51:33 +01:00
|
|
|
echo -n "[?] Do you want to remove the installed packages? (Yes/no) "
|
|
|
|
read answer
|
|
|
|
if [[ "$answer" =~ ^([yY][eE][sS]|[yY])$ ]]
|
|
|
|
then
|
2024-01-17 12:33:59 +01:00
|
|
|
rm -rf /var/log/suricata
|
2022-11-06 15:51:33 +01:00
|
|
|
for pkg in "${pkgs[@]}"
|
2024-01-15 23:25:04 +01:00
|
|
|
do
|
2022-11-06 15:51:33 +01:00
|
|
|
apt -y remove $pkg && apt -y purge $pkg
|
|
|
|
done
|
|
|
|
fi
|
2024-01-15 23:25:04 +01:00
|
|
|
apt autoremove &> /dev/null -y
|
2022-11-06 15:51:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|