Skip to content

Commit 00edd71

Browse files
committed
style: modify style and colorization of output
1 parent adff194 commit 00edd71

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

hardening/Root Locker/root-locker.bash

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,39 @@
66
# Locking the root account doesn't prevent users from using something like `sudo su`
77
# to gain root access.
88
#
9-
# Version: v1.0.7
9+
# Version: v1.0.8
1010
# License: MIT License
1111
# Copyright (c) 2020-2024 Hunter T. (StrangeRanger)
1212
#
1313
########################################################################################
1414

1515
C_GREEN="$(printf '\033[0;32m')"
16+
C_BLUE="$(printf '\033[0;34m')"
17+
C_CYAN="$(printf '\033[0;36m')"
1618
C_RED="$(printf '\033[1;31m')"
1719
C_NC="$(printf '\033[0m')"
1820

21+
C_SUCCESS="${C_GREEN}==>${C_NC} "
22+
C_ERROR="${C_RED}ERROR:${C_NC} "
23+
C_INFO="${C_BLUE}==>${C_NC} "
24+
C_NOTE="${C_CYAN}==>${C_NC} "
25+
1926

2027
## Check if this script was executed with root privilege.
2128
if [[ $EUID != 0 ]]; then
22-
echo "${C_RED}Please run this script as or with root privilege${C_NC}" >&2
23-
echo -e "\nExiting..."
29+
echo "${C_ERROR}Please run this script as or with root privilege" >&2
30+
echo -e "\n${C_INFO}Exiting..."
2431
exit 1
2532
fi
2633

2734

28-
read -rp "We will now disable the root account. Press [Enter] to continue."
35+
read -rp "${C_NOTE}We will now disable the root account. Press [Enter] to continue."
2936

30-
echo "Disabling root account..."
37+
echo "${C_INFO}Disabling root account..."
3138
usermod -L root || {
32-
echo -e "${C_RED}ERROR:${C_NC} Failed to lock the root account" >&2
33-
echo -e "\nExiting..."
39+
echo -e "${C_ERROR}Failed to lock the root account" >&2
40+
echo -e "\n${C_INFO}Exiting..."
3441
exit 1
3542
}
3643

37-
echo -e "\n${C_GREEN}The root account has been locked${C_NC}"
44+
echo -e "\n${C_SUCCESS}The root account has been locked"

0 commit comments

Comments
 (0)