-
Notifications
You must be signed in to change notification settings - Fork 821
/
uninstaller.sh
executable file
·85 lines (69 loc) · 2.22 KB
/
uninstaller.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
#!/bin/bash
# Color Schemas
PURPLE='\033[01;35m'
RED='\033[01;31m'
NONE='\033[00m'
HIGHLIGHT_PURPLE='\e[105m\e[1m'
HIGHLIGHT_PINK='\e[101m\e[1m'
HIGHLIGHT_CYAN='\e[104m\e[1m'
HIGHLIGHT_END='\e[0m'
# Check if the script is being run as root!
init(){
if [[ $EUID -ne 0 ]]; then
echo "$RED[!] This script must be run as root!" 1>&2
exit -1
fi
}
# Uninstall pip packages
uninstall_pip_pkgs(){
echo -e "$HIGHLIGHT Uninstalling Python Requirements $HIGHLIGHT_END"
python3 -m pip uninstall -yr requirements.txt
echo -e "$HIGHLIGHT Python Requirements Uninstalled $HIGHLIGHT_END"
}
# uninstalling git
uninstall_git(){
read -p "Would you like to remove git? (y/N) " user_choice
if [ "$user_choice" == 'y' ] || [ "$user_choice" == 'Y' ]; then
echo -e "$HIGHLIGHT_PINK git will be deleted $HIGHLIGHT_END"
apt-get -y purge git # purgeing git
else
echo -e "$HIGHLIGHT_CYAN git kept intact $HIGHLIGHT_END"
fi
}
# uninstalling python pip
uninstall_python_pip(){
read -p "Would you like to remove python pip? (y/N) " user_choice
if [ "$user_choice" == 'y' ] || [ "$user_choice" == 'Y' ]; then
echo -e "$HIGHLIGHT_PINK Python and Pip will be deleted $HIGHLIGHT_END"
apt-get -y purge python3
apt-get -y purge python3-pip # python3 and pip purgeed
apt-get -y purge python3-setuptools
else
echo -e "$HIGHLIGHT_CYAN Python installation is kept intact $HIGHLIGHT_END"
fi
}
# deleting pygoat files
uninstall_pygoat(){
read -p "Would you like to remove all pygoat directories and files? (y/N) " user_choice
if [ "$user_choice" == 'y' ] || [ "$user_choice" == 'Y' ]; then
echo -e "$HIGHLIGHT_PINK All pygoat Files and Directories will be deleted $HIGHLIGHT_END"
curr_folder=$(pwd)
read -p "Remove $curr_folder? (y/N) " user_choice
if [ "$user_choice" == 'y' ] || [ "$user_choice" == 'Y' ]; then
rm -rfv "$curr_folder"
echo -e "$HIGHLIGHT_PINK $curr_folder has been deleted $HIGHLIGHT_END"
else
echo -e "$HIGHLIGHT_CYAN $curr_folder kept intact $HIGHLIGHT_END"
fi
else
echo -e "$HIGHLIGHT_CYAN pygoat files and directories kept intact $HIGHLIGHT_END"
fi
}
main(){
init
uninstall_pip_pkgs
uninstall_git
uninstall_python_pip
uninstall_pygoat
}
main