-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
146 lines (133 loc) · 5.32 KB
/
installer.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
set -e
clear
RED='\e[1;31m'
GREEN='\e[1;32m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
CYAN='\e[1;36m'
WHITE='\e[1;37m'
ORANGE='\e[1;93m'
NC='\e[0m'
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}This script must be run as root"
exit 1
fi
COLOR_NUM=$((RANDOM % 7))
# Assign a color variable based on the random number
case $COLOR_NUM in
0) COLOR=$RED;;
1) COLOR=$GREEN;;
2) COLOR=$YELLOW;;
3) COLOR=$BLUE;;
4) COLOR=$CYAN;;
5) COLOR=$ORANGE;;
*) COLOR=$WHITE;;
esac
echo -e "${COLOR}"
echo -e "${RED} [!] This Tool Must Run As ROOT [!]${NC}\n"
echo -e "${CYAN} Select Best Option : \n"
echo -e "${WHITE} [1] Kali Linux / Parrot-Os (apt)"
echo -e "${WHITE} [2] Arch Linux (pacman)"
echo -e "${WHITE} [0] Exit "
echo -e "${COLOR}┌──($USER㉿$HOST)-[$(pwd)]"
read -p "└─$>>" choice
# Define installation directories
install_dir="/usr/share/Rebus"
bin_dir="/usr/bin"
# Check if the user chose a valid option and perform the installation steps
if [[ $choice =~ ^[1-2]+$ ]]; then
echo -e "${YELLOW}[*] Checking Internet Connection ..${NC}"
echo "";
if curl -s -m 10 https://www.google.com > /dev/null || curl -s -m 10 https://www.github.com > /dev/null; then
echo -e "${GREEN}[✔] Internet connection is OK [✔]${NC}"
echo "";
echo -e "${YELLOW}[*] Updating package list ..."
# Perform installation steps based on the user's choice
if [[ $choice == 1 ]]; then
sudo apt update -y && sudo apt upgrade -y
sudo apt-get install -y git python3-pip figlet boxes php curl xdotool wget -y ;
elif [[ $choice == 2 ]]; then
sudo pacman -Suy -y
sudo pacman -S python-pip -y
else
exit
fi
echo "";
echo -e "${YELLOW}[*] Checking directories...${NC}"
if [[ -d "$install_dir" ]]; then
echo -e -n "${RED}[!] The directory $install_dir already exists. Do you want to replace it? [y/n]: ${NC}"
read input
if [[ $input == "y" ]] || [[ $input == "Y" ]]; then
echo -e "${YELLOW}[*]Removing existing module.. ${NC}"
sudo rm -rf "$install_dir"
else
echo -e "${RED}[✘]Installation Not Required[✘] ${NC}"
exit
fi
fi
echo "";
echo -e "${YELLOW}[✔] Downloading Rebus...${NC}"
if sudo git clone https://github.com/Discordmodsbers/Rebus.git $install_dir; then
# Install virtual environment
echo -e "${YELLOW}[*] Installing Virtual Environment...${NC}"
if [[ $choice == 1 ]]; then
sudo apt install python3-venv -y
elif [[ $choice == 2 ]]; then
echo "Python 3.3+ comes with a module called venv.";
fi
echo "";
# Create a virtual environment for the tool
echo -e "${YELLOW}[*] Creating virtual environment..."
sudo python3 -m venv $install_dir/venv
source $install_dir/venv/bin/activate
# Install requirements
echo -e "${GREEN}[✔] Virtual Environment successfully [✔]${NC}";
echo "";
echo -e "${YELLOW}[*] Installing requirements...${NC}"
if [[ $choice == 1 ]]; then
pip3 install -r $install_dir/requirements.txt
sudo apt install figlet -y
elif [[ $choice == 2 ]]; then
pip3 install -r $install_dir/requirements.txt
sudo -u $SUDO_USER git clone https://aur.archlinux.org/boxes.git && cd boxes
sudo -u $SUDO_USER makepkg -si
sudo pacman -S figlet -y
fi
# Create a shell script to launch the tool
echo -e "${YELLOW}[*] Creating a shell script to launch the tool..."
# echo '#!/bin/bash' > Rebus.sh
echo '#!/bin/bash' > $install_dir/Rebus.sh
echo "source $install_dir/venv/bin/activate" >> $install_dir/Rebus.sh
echo "python3 $install_dir/rebus.py \$@" >> $install_dir/Rebus.sh
chmod +x $install_dir/Rebus.sh
sudo mv $install_dir/Rebus.sh $bin_dir/Rebus
echo -e "${GREEN}[✔] Script created successfully [✔]"
else
echo -e "${RED}[✘] Failed to download Rebus [✘]"
exit 1
fi
else
echo -e "${RED}[✘] Internet connection is not available [✘]${NC}"
exit 1
fi
if [ -d $install_dir ]; then
echo "";
echo -e "${GREEN}[✔] Successfully Installed [✔]";
echo "";
echo "";
echo -e "${ORANGE}[+]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[+]"
echo "[+] [+]"
echo -e "${ORANGE}[+] ✔✔✔ Now Just Type In Terminal (Rebus) ✔✔✔ [+]"
echo "[+] [+]"
echo -e "${ORANGE}[+]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[+]"
else
echo -e "${RED}[✘] Installation Failed !!! [✘]";
exit 1
fi
elif [[ $choice == 0 ]]; then
echo -e "${RED}[✘] Exiting tool [✘]"
exit 1
else
echo -e "${RED}[!] Select Valid Option [!]"
fi