Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/update.sh
1267 views
1
#!/bin/bash
2
3
RED='\e[1;31m'
4
GREEN='\e[1;32m'
5
YELLOW='\e[1;33m'
6
BLUE='\e[1;34m'
7
8
echo "███████╗██╗ ██╗███╗ ██╗███████╗██╗ ██╗ ";
9
echo "╚══███╔╝██║ ██║████╗ ██║╚══███╔╝██║ ██║ ";
10
echo " ███╔╝ ███████║██╔██╗ ██║ ███╔╝ ██║ ██║ ";
11
echo " ███╔╝ ╚════██║██║╚██╗██║ ███╔╝ ██║ ██║ ";
12
echo "███████╗ ██║██║ ╚████║███████╗╚██████╔╝ ";
13
echo "╚══════╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═════╝ ";
14
echo " ";
15
16
# Check if the script is run as root
17
if [[ $EUID -ne 0 ]]; then
18
echo -e "${RED}[ERROR]\e[0m This script must be run as root."
19
exit 1
20
fi
21
22
install_dir="/usr/share/hackingtool"
23
# Change to the directory containing the install.sh script
24
cd $install_dir || { echo -e "${RED}[ERROR]\e[0m Could not change to directory containing install.sh."; exit 1; }
25
echo -e "${YELLOW}[*] Checking Internet Connection ..${NC}"
26
echo "";
27
if curl -s -m 10 https://www.google.com > /dev/null || curl -s -m 10 https://www.github.com > /dev/null; then
28
echo -e "${GREEN}[✔] Internet connection is OK [✔]${NC}"
29
echo ""
30
else
31
echo -e "${RED}[✘] Please check your internet connection[✘]"
32
echo ""
33
exit 1
34
fi
35
echo -e "[*]Marking hackingtool directory as safe-directory"
36
git config --global --add safe.directory $install_dir
37
# Update the repository and the tool itself
38
echo -e "${BLUE}[INFO]\e[0m Updating repository and tool..."
39
if ! sudo git pull; then
40
echo -e "${RED}[ERROR]\e[0m Failed to update repository or tool."
41
exit 1
42
fi
43
44
# Re-run the installation script
45
echo -e "${GREEN}[INFO]\e[0m Running installation script..."
46
if ! sudo bash install.sh; then
47
echo -e "${RED}[ERROR]\e[0m Failed to run installation script."
48
exit 1
49
fi
50
51
echo -e "${GREEN}[SUCCESS]\e[0m Tool updated successfully."
52
53