diff --git a/assets/requirements.txt b/assets/requirements.txt index b528652..4942622 100755 --- a/assets/requirements.txt +++ b/assets/requirements.txt @@ -2,10 +2,10 @@ ipwhois==1.2.0 pydig==0.4.0 pymisp==2.4.165.1 netaddr==0.8.0 -pyyaml==5.3.1 +pyyaml==6.0.1 flask==2.3.3 flask_httpauth==4.7.0 -pyjwt==1.7.1 +pyjwt==2.8.0 sqlalchemy==1.4.44 psutil==5.8.0 pyudev==0.24.0 diff --git a/install.sh b/install.sh index 1ba49a6..47c712d 100644 --- a/install.sh +++ b/install.sh @@ -3,15 +3,15 @@ CURRENT_USER="${SUDO_USER}" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" HOST="$( hostname )" -LOCALES=(en fr es ru pt de it) +LOCALES=(de en es fr it pt ru) welcome_screen() { cat << "EOF" - __ _ __ _ _ - (_ |_) \_/ /__ | | /\ |_) | \ - __) | | \_| |_| /--\ | \ |_/ - -SpyGuard is a fork of TinyCheck, developped by Kaspersky. + __ _ __ _ _ + (_ |_) \_/ /__ | | /\ |_) | \ + __) | | \_| |_| /--\ | \ |_/ + +SpyGuard is a fork of TinyCheck, developped by Kaspersky. ----- EOF @@ -66,8 +66,8 @@ set_credentials() { } create_directory() { - # Create the Spyguard directory and move the whole stuff there. - echo -e "[+] Creating Spyguard folder under /usr/share/" + # Create the SpyGuard directory and move the whole stuff there. + echo -e "[+] Creating SpyGuard folder under /usr/share/" mkdir /usr/share/spyguard cp -Rf ./* /usr/share/spyguard } @@ -90,7 +90,7 @@ Description=Spyguard frontend service [Service] Type=simple -ExecStart=/usr/bin/python3 /usr/share/spyguard/server/frontend/main.py +ExecStart=/usr/share/spyguard/spyguard-venv/bin/python3 /usr/share/spyguard/server/frontend/main.py Restart=on-abort KillMode=process @@ -105,7 +105,7 @@ Description=Spyguard backend service [Service] Type=simple -ExecStart=/usr/bin/python3 /usr/share/spyguard/server/backend/main.py +ExecStart=/usr/share/spyguard/spyguard-venv/bin/python3 /usr/share/spyguard/server/backend/main.py Restart=on-abort KillMode=process @@ -122,7 +122,7 @@ After=network-online.target [Service] Type=simple -ExecStart=/usr/bin/python3 /usr/share/spyguard/server/backend/watchers.py +ExecStart=/usr/share/spyguard/spyguard-venv/bin/python3 /usr/share/spyguard/server/backend/watchers.py Restart=on-abort KillMode=process @@ -171,7 +171,7 @@ check_dependencies() { "/usr/bin/dig" "/usr/bin/suricata" "/usr/bin/sqlite3" - "/usr/bin/pip3", + "/usr/bin/pip3" "/usr/sbin/arp") echo -e "\e[39m[+] Checking dependencies...\e[39m" @@ -184,8 +184,11 @@ check_dependencies() { install_package ${bin##*/} fi done + echo -e "\e[39m[+] Create and activate Virtual Environment for Python packages\e[39m" + python3 -m venv /usr/share/spyguard/spyguard-venv + source /usr/share/spyguard/spyguard-venv/bin/activate echo -e "\e[39m[+] Install Python packages...\e[39m" - python3 -m pip install -r "$SCRIPT_PATH/assets/requirements.txt" + python3 -m pip install -r "$SCRIPT_PATH/assets/requirements.txt" --no-cache-dir } get_version() { diff --git a/uninstall.sh b/uninstall.sh index 8f04401..0710a0a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,11 +1,11 @@ delete_folder(){ - echo "[+] Deleting Spyguard folders" + echo "[+] Deleting SpyGuard folders" rm -rf /usr/share/spyguard/ } delete_services(){ - echo "[+] Deleting Spyguard services" + echo "[+] Deleting SpyGuard services" systemctl disable spyguard-frontend &> /dev/null systemctl disable spyguard-backend &> /dev/null @@ -16,27 +16,23 @@ delete_services(){ rm /lib/systemd/system/spyguard-watchers.service } -deleting_icon(){ - echo "[+] Deleting desktop icon" - rm "/home/${SUDO_USER}/Desktop/spyguard.desktop" -} - 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 + do apt -y remove $pkg && apt -y purge $pkg done fi - apt autoremove &> /dev/null + apt autoremove &> /dev/null -y } update_hostname(){ @@ -59,7 +55,6 @@ if [[ $EUID -ne 0 ]]; then else delete_folder delete_services - deleting_icon update_hostname delete_packages reboot_box diff --git a/update.sh b/update.sh index bd0cd31..cb68452 100755 --- a/update.sh +++ b/update.sh @@ -6,12 +6,12 @@ fi if [ $PWD = "/usr/share/spyguard" ]; then echo "[+] Cloning the current repository to /tmp/" - rm -rf /tmp/spyguard/ &> /dev/null + rm -rf /tmp/spyguard/ &> /dev/null cd /tmp/ && git clone https://github.com/SpyGuard/spyguard cd /tmp/spyguard && bash update.sh elif [ $PWD = "/tmp/spyguard" ]; then - echo "[+] Saving spyguard backend's SSL configuration in /tmp/" + echo "[+] Saving SpyGuard backend's SSL configuration in /tmp/" mv /usr/share/spyguard/server/backend/*.pem /tmp/ echo "[+] Deleting the current SpyGuard folders and files." @@ -48,4 +48,4 @@ elif [ $PWD = "/tmp/spyguard" ]; then cd /tmp/spyguard && git tag | tail -n 1 | xargs echo -n > /usr/share/spyguard/VERSION echo "[+] SpyGuard updated!" -fi \ No newline at end of file +fi