function shownetinfo() { OSTYPE=$(uname -s) LANIP="" WANIP="" ROUTR="" if [ "$OSTYPE" = "Linux" ]; then LANIP=$(ip addr show | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f6 | cut -d "/" -f1) ROUTR=$(ip route | grep default | cut -d " " -f3) if [ "$ROUTR" != "" ]; then WANIP=$(timeout 0.25s curl -s ipv4.icanhazip.com) fi elif [ "$OSTYPE" = "Darwin" ]; then ROUTR=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1) LANIP=$(ifconfig | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f2) if [ "$ROUTR" != "" ]; then WANIP=$(gtimeout 0.25s curl -s icanhazip.com) fi fi tput setaf 7; tput bold; echo -en "Net: " tput sgr0 tput setaf 7; echo -en "internal $LANIP" if [ "$ROUTR" != "" ]; then echo -en ", external $WANIP" echo -en ", router $ROUTR" fi tput sgr0 } function batt() { tput setaf 7 tput bold echo -en " | " tput sgr0 tput setaf 7; tput bold; echo -en "Bat: " tput sgr0 tput setaf 7 echo -en $(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) echo "%" tput sgr0 } function lab() { tput setaf 7; tput bold; echo -en "Lab: " tput sgr0 tput setaf 7 echo -en $(curl -s https://cpsecurity.club/api/v1/status | jq ".data.status" | tr -d "\"") tput sgr0 }