File: //proc/1284358/cwd/bigscoots/includes/whosinmeh.sh
#!/bin/bash
# Check the initiating IP address first
[[ $- != *i* ]] || [[ $(echo $SSH_CLIENT | awk '{print $1}') == "67.202.70.147" ]] && exit 0
# Declare the associative array with IP-Name mapping
declare -A ip_name_map=(
["38.65.225.4"]="Justin"
["50.31.114.76"]="Jay"
["208.117.38.157"]="Shibin"
["208.117.38.23"]="Dean"
["198.175.25.80"]="Zach"
["208.117.38.24"]="Prasul"
["50.31.30.56"]="Zack"
["50.31.119.9"]="Julian"
["208.100.53.125"]="Sadiq"
["208.117.4.65"]="Michael"
["208.100.53.146"]="Khan"
["208.100.53.138"]="Gibu"
["74.121.204.16"]="JK"
["50.31.116.124"]="Minhal"
["69.162.134.133"]="Ahmad"
["50.31.99.57"]="Les"
["38.65.224.44"]="Lijith"
["23.29.145.178"]="Brian"
)
# Fetch currently logged-in IPs and their idle time
echo "Checking who is logged in..."
w -h | awk '{print $3,$5}' | while read -r ip idle_time; do
ip=$(echo $ip | cut -d '.' -f 1-4) # Strip port number if present
tech_name=${ip_name_map[$ip]}
if [ -n "$tech_name" ]; then
echo "$tech_name is logged in from $ip and has been idle for $idle_time."
else
echo "Unknown person logged in from $ip and has been idle for $idle_time."
fi
done
echo "You are now logged in."