80 lines
2.8 KiB
Plaintext
Raw Normal View History

2025-02-20 14:22:08 +01:00
#!/bin/bash
# Set color variables for the welcome text based on the current user
2025-02-20 14:22:08 +01:00
if [ "$USER" = "root" ]; then
2025-02-20 15:48:01 +01:00
HEADER_COLOR="\033[1;31m" # Bold red for root
2025-02-20 14:22:08 +01:00
elif [ "$USER" = "administrator" ]; then
2025-02-20 15:48:01 +01:00
HEADER_COLOR="\033[1;38;5;208m" # Bold orange for administrator
2025-02-20 14:22:08 +01:00
else
2025-02-20 15:48:01 +01:00
HEADER_COLOR="\033[1;33m" # Bold yellow for other users
2025-02-20 14:22:08 +01:00
fi
RESET_COLOR="\033[0m"
# Color code for the hostname (set to green, bold, underlined, and blinking)
2025-02-20 15:48:01 +01:00
# (Note: \[ and \] are used for PS1 only; for echo, use plain escapes)
HOSTNAME_COLOR="\033[1;4;5;32m"
clear
2025-02-20 17:07:39 +01:00
# Primary IP (determined via default route)
PRIMARY_IP=$(ip route get 8.8.8.8 2>/dev/null | awk '{print $7}' | head -n1)
# Print welcome message
echo -e "${HEADER_COLOR}Welcome, $USER on ${HOSTNAME_COLOR}$HOSTNAME!${RESET_COLOR}"
2025-02-20 17:07:39 +01:00
echo -e "Primary IP Address: ${PRIMARY_IP}"
2025-02-20 14:22:08 +01:00
echo -e "${HEADER_COLOR}Today is $(date +"%A, %d.%m.%Y %T")${RESET_COLOR}"
2025-02-20 15:48:01 +01:00
echo -e "\033[94mPowered by: CyMaIS - Cyber Master Infrastructure Solutions!"
echo -e "\033[1;31mWARNING: This software is not to be used for generating commercial profits.\033[94m"
echo -e "If you require a license for commercial use, please contact Kevin Veen-Birkenbach, the author and copyright holder.\n"
echo -e "More Information:"
echo -e "- About CyMaIS: \033[35mhttps://s.veen.world/cymais\033[94m"
echo -e "- About the author: \033[35mhttps://www.veen.world\033[94m"
2025-02-20 14:22:08 +01:00
echo ""
# System Load (shows load averages and uptime)
echo -e "${HEADER_COLOR}System Load:${RESET_COLOR}"
uptime
echo ""
# Memory Usage (RAM and swap)
echo -e "${HEADER_COLOR}Memory Usage:${RESET_COLOR}"
free -h
echo ""
# Disk Usage
echo -e "${HEADER_COLOR}Disk Usage:${RESET_COLOR}"
df -h
echo ""
# CPU Information (e.g., model name)
echo -e "${HEADER_COLOR}CPU Information:${RESET_COLOR}"
lscpu | grep "Model name"
echo ""
# Top 5 Processes by CPU Usage
echo -e "${HEADER_COLOR}Top 5 Processes by CPU Usage:${RESET_COLOR}"
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -n 6
echo ""
# Set aliases for colored output for ls and grep
2025-02-20 14:22:08 +01:00
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# --- Prompt Configuration ---
# Define color codes for the username in the prompt based on the current user
if [ "$USER" = "root" ]; then
PROMPT_USER_COLOR="\[\033[4;5;1;31m\]" # Underlined, bold red for root
elif [ "$USER" = "administrator" ]; then
PROMPT_USER_COLOR="\[\033[4;38;5;208m\]" # Underlined, bold orange for administrator
else
2025-02-20 15:48:01 +01:00
PROMPT_USER_COLOR="\[\033[33m\]" # Yellow for other users
fi
# Reset code for the prompt (must be wrapped in \[ \])
PROMPT_RESET="\[\033[0m\]"
# Configure PS1: username, hostname in green, time and current directory
2025-02-20 15:48:01 +01:00
PS1="${PROMPT_USER_COLOR}\u${PROMPT_RESET}@\[\033[1;4;5;32m\]\h${PROMPT_RESET} \[\033[90m\]\$(date +%H:%M:%S)\[\033[0m\]:\[\033[38;5;13m\]\w ${PROMPT_RESET}\$ "