Skip to content

Commit 85b15e5

Browse files
authored
Create tempfix_unit4_project.sh
1 parent ad78d40 commit 85b15e5

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tempfix_unit4_project.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e # Exit on any error
3+
4+
red='\033[0;31m'
5+
green='\033[0;32m'
6+
none='\033[0m'
7+
8+
echo "[UNIT 4 PROJECT] Starting script..."
9+
10+
# Check if Slowloris is already installed
11+
if command -v pip3 &> /dev/null; then
12+
if pip3 show slowloris &> /dev/null; then
13+
echo -e "${green}[UNIT 4 PROJECT]${none} Slowloris is already installed."
14+
exit 0
15+
fi
16+
fi
17+
18+
# Update package lists
19+
echo "[UNIT 4 PROJECT] Updating package lists..."
20+
sudo apt update
21+
22+
# Install dependencies
23+
echo "[UNIT 4 PROJECT] Installing required dependencies..."
24+
sudo apt install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring python3-pip
25+
26+
# Install NGINX
27+
echo "[UNIT 4 PROJECT] Installing NGINX..."
28+
curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
29+
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu $(lsb_release -cs) nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
30+
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | sudo tee /etc/apt/preferences.d/99nginx
31+
sudo apt update
32+
sudo apt install -y nginx
33+
34+
# Install Slowloris
35+
echo "[UNIT 4 PROJECT] Installing Slowloris..."
36+
sudo pip3 install --break-system-packages slowloris
37+
38+
# Verify installation
39+
if pip3 show slowloris &> /dev/null; then
40+
echo -e "${green}[UNIT 4 PROJECT]${none} Slowloris successfully installed."
41+
exit 0
42+
else
43+
echo -e "${red}[UNIT 4 PROJECT]${none} ERROR: Slowloris did not install correctly!"
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)