Files
Blitz-Proxy/core/scripts/utils.sh
2024-07-21 19:16:45 +03:30

22 lines
646 B
Bash

# Function to define colors
define_colors() {
green='\033[0;32m'
cyan='\033[0;36m'
red='\033[0;31m'
yellow='\033[0;33m'
LPurple='\033[1;35m'
NC='\033[0m' # No Color
}
# Function to get system information
get_system_info() {
OS=$(lsb_release -d | awk -F'\t' '{print $2}')
ARCH=$(uname -m)
# Fetching detailed IP information in JSON format
IP_API_DATA=$(curl -s https://ipapi.co/json/ -4)
ISP=$(echo "$IP_API_DATA" | jq -r '.org')
IP=$(echo "$IP_API_DATA" | jq -r '.ip')
CPU=$(top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "%"}')
RAM=$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')
}