2023-10-30 14:38:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
GREEN="\033[0;32m"
|
2023-10-30 15:49:30 +00:00
|
|
|
WHITE="\033[0;37m"
|
2023-10-30 14:38:20 +00:00
|
|
|
RED='\033[0;31m'
|
|
|
|
RESET="\033[0m"
|
2023-11-06 09:38:09 +00:00
|
|
|
#LAST_LOGIN_USER=$(lastlog | tail -n 1 | awk '{print $1}')
|
|
|
|
LAST_LOGIN_USER=$(last |head -n +2 | tail -n 1 | awk '{ print $1 }')
|
|
|
|
#LAST_LOGIN_TIME_HOUR=$(lastlog | tail -n 1 | awk '{print $4" "$5" "$6" "$7}')
|
2023-11-06 10:05:33 +00:00
|
|
|
LAST_LOGIN_TIME_HOUR=$(last |head -n +2 | tail -n 1 | awk '{ print $4" "$5" "$6" "$7" "$8" "$9 }')
|
2023-11-06 09:38:09 +00:00
|
|
|
#LAST_LOGIN_IP_FROM_USER=$(lastlog | tail -n 1 | awk '{print $3}')
|
|
|
|
LAST_LOGIN_IP_FROM_USER=$(last |head -n +2 | tail -n 1 | awk '{ print $3 }')
|
2023-10-30 14:38:20 +00:00
|
|
|
UPTIME_SYSTEM=$(uptime -p | tr -d ',')
|
2023-10-31 11:52:12 +00:00
|
|
|
NUMBER_USERS_CONNECTED=$(uptime | awk '{print $5" "$6}' | tr -d ",")
|
2023-10-30 14:38:20 +00:00
|
|
|
LIST_USERS_CONNECTED=$(w | tail -n +2)
|
2023-10-30 15:49:30 +00:00
|
|
|
KERNEL=$(uname -r)
|
|
|
|
PACKAGES=$(dpkg -l | tail -n +6 | wc -l)
|
|
|
|
SHELL=$(dpkg -l | grep bash | head -n 1 | awk '{ print $2 }')
|
|
|
|
BASH_VERSION_NUMBER=$(echo $BASH_VERSION | cut -c -6)
|
2023-11-03 15:10:30 +00:00
|
|
|
IP_LIST=$(for i in $(ip a | grep inet | grep -v "::" | awk {'print $2'}); do echo -e "ip -> $i"; done)
|
2023-10-30 15:49:30 +00:00
|
|
|
source /etc/os-release
|
2023-10-30 14:38:20 +00:00
|
|
|
echo -e "****************************************************************************"
|
2023-10-30 15:49:30 +00:00
|
|
|
echo -e "${WHITE} _${RESET}"
|
|
|
|
echo -e "${WHITE} | |${RESET}${GREEN} _${RESET}"
|
|
|
|
echo -e "${WHITE} _ _ ____ ____ _ | |${RESET}${GREEN} ____ ____| |_ _ _ ____ ____${RESET}"
|
|
|
|
echo -e "${WHITE}| | | / _ )/ ___) || |${RESET}${GREEN}| _ \ / _ | _) | | |/ ___) _ |${RESET}"
|
|
|
|
echo -e "${WHITE} \ V ( (/ /| | ( (_| |${RESET}${GREEN}| | | ( ( | | |_| |_| | | ( ( | |${RESET}"
|
|
|
|
echo -e "${WHITE} \_/ \____)_| \____|${RESET}${GREEN}|_| |_|\_||_|\___)____|_| \_||_|${RESET}"
|
2023-10-30 14:38:20 +00:00
|
|
|
echo -e ""
|
2023-10-30 15:49:30 +00:00
|
|
|
echo -e "${RED}Host:${RESET} $HOSTNAME"
|
|
|
|
echo -e "${RED}OS:${RESET} $PRETTY_NAME"
|
2023-11-03 15:10:30 +00:00
|
|
|
echo -e "${RED}IP:${RESET}\n$IP_LIST"
|
2023-10-30 15:49:30 +00:00
|
|
|
echo -e "${RED}Kernel:${RESET} $KERNEL"
|
|
|
|
echo -e "${RED}Packages:${RESET} $PACKAGES"
|
|
|
|
echo -e "${RED}Shell:${RESET} $SHELL $BASH_VERSION_NUMBER"
|
2023-10-30 14:38:20 +00:00
|
|
|
echo -e "${RED}Last Login:${RESET}\nUser -> $LAST_LOGIN_USER\nTime -> $LAST_LOGIN_TIME_HOUR\nIP -> $LAST_LOGIN_IP_FROM_USER"
|
|
|
|
echo -e "${RED}Uptime system:${RESET}\n$UPTIME_SYSTEM"
|
2023-10-31 12:25:09 +00:00
|
|
|
#echo -e "${RED}Number of Users connected to the system:${RESET}\n$NUMBER_USERS_CONNECTED"
|
2023-10-30 14:38:20 +00:00
|
|
|
echo -e "${RED}Users connected to the system:${RESET}\n$LIST_USERS_CONNECTED"
|
|
|
|
echo -e ""
|
|
|
|
echo -e "****************************************************************************"
|