-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
55 lines (46 loc) · 1.53 KB
/
install.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
#!/bin/bash
usage() {
echo "[+] Usage: ./install.sh [--venv]"
echo "[+] Options:"
echo "[+] --venv Use a Python virtual environment (recommended)"
exit 1
}
USE_VENV=false
if [[ "$1" == "--venv" ]]; then
USE_VENV=true
fi
REPO_DIR="CIDRProbe"
if [ -d "$REPO_DIR" ]; then
echo "[+] Repository already exists."
echo "[+] Pulling the latest changes..."
cd "$REPO_DIR" || { echo "[+] Error: Failed to enter the CIDRProbe directory."; exit 1; }
git pull origin main
else
echo "[+] Cloning the CIDRProbe repository..."
git clone https://github.com/brian404/CIDRProbe.git
cd "$REPO_DIR" || { echo "[+] Error: Failed to enter the CIDRProbe directory."; exit 1; }
fi
if ! command -v python3 &> /dev/null; then
echo "[+] Error: Python3 is not installed. Please install Python3."
exit 1
fi
if ! command -v pip &> /dev/null; then
echo "[+] Error: pip is not installed. Please install pip."
exit 1
fi
if [ "$USE_VENV" = true ]; then
echo "[+] Setting up a virtual environment..."
python3 -m venv .venv
echo "[+] Activating the virtual environment..."
source .venv/bin/activate
echo "[+] Installing dependencies in the virtual environment..."
python3 -m pip install -r requirements.txt
else
echo "[+] Installing dependencies globally..."
pip install -r requirements.txt
fi
echo "[+] Installation complete!"
echo "[+] To start using CIDR Probe, run the following command:"
echo "[+] python cidr.py"
echo "[+] For advanced usage options, reefer to python cidr.py -h."
exit 0