|
| 1 | +#!/usr/bin/env python3 |
| 2 | +import os |
| 3 | +import subprocess |
| 4 | + |
| 5 | +#################### |
| 6 | +# COLORS |
| 7 | +#################### |
| 8 | +C = "\033" |
| 9 | +RED = f"{C}[1;31m" |
| 10 | +GREEN = f"{C}[1;32m" |
| 11 | +YELLOW = f"{C}[1;33m" |
| 12 | +BLUE = f"{C}[1;34m" |
| 13 | +LIGHT_MAGENTA = f"{C}[1;95m" |
| 14 | +LIGHT_CYAN = f"{C}[1;96m" |
| 15 | +LG = f"{C}[1;37m" # LightGray |
| 16 | +DG = f"{C}[1;90m" # DarkGray |
| 17 | +NC = f"{C}[0m" |
| 18 | + |
| 19 | +def run_command(command): |
| 20 | + result = subprocess.run( |
| 21 | + command, |
| 22 | + shell=True, |
| 23 | + capture_output=True, |
| 24 | + text=True |
| 25 | + ) |
| 26 | + if result.returncode == 0: |
| 27 | + return result.stdout.strip() |
| 28 | + else: |
| 29 | + return "" |
| 30 | + |
| 31 | +def get_os_info(): |
| 32 | + os_info = run_command("lsb_release -sd 2>/dev/null") |
| 33 | + if not os_info: |
| 34 | + os_info = run_command("sw_vers -productName 2>/dev/null") |
| 35 | + return os_info |
| 36 | + |
| 37 | +def get_kernel_version(): |
| 38 | + return run_command("uname -r") |
| 39 | + |
| 40 | +def get_host_name(): |
| 41 | + return run_command("hostname") |
| 42 | + |
| 43 | +def get_uptime(): |
| 44 | + return run_command("uptime -p") |
| 45 | + |
| 46 | +def get_package_count(): |
| 47 | + return run_command("dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l") |
| 48 | + |
| 49 | +def get_desktop_environment(): |
| 50 | + return run_command("echo $XDG_CURRENT_DESKTOP | tr '[:upper:]' '[:lower:]'") |
| 51 | + |
| 52 | +def get_resolution(): |
| 53 | + return run_command("xdpyinfo | awk '/dimensions:/ {print $2}'") |
| 54 | + |
| 55 | +def get_terminal(): |
| 56 | + return run_command("echo $TERM") |
| 57 | + |
| 58 | +def get_shell(): |
| 59 | + return run_command("basename $SHELL") |
| 60 | + |
| 61 | +def get_cpu_info(): |
| 62 | + return run_command("lscpu | awk -F':' '/Model name/ {print $2}' | sed -e 's/^[ \\t]*//' 2>/dev/null") |
| 63 | + |
| 64 | +def get_gpu_info(): |
| 65 | + return run_command("lspci | grep -i 'vga\\|3d' | awk -F': ' '{print $2}' 2>/dev/null") |
| 66 | + |
| 67 | +def get_memory_info(): |
| 68 | + mem_total = run_command("grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 \"GB\"}' 2>/dev/null") |
| 69 | + return f"{mem_total} (approximate)" |
| 70 | + |
| 71 | +def get_disk_usage(): |
| 72 | + return run_command("df -h --total 2>/dev/null | awk '/total/ {print $2 \" used, \" $4 \" free\"}'") |
| 73 | + |
| 74 | +def get_interfaces(): |
| 75 | + return run_command("ip -o link show | awk -F': ' '{print $2}' | grep -v 'lo'") |
| 76 | + |
| 77 | +os = get_os_info() |
| 78 | +kernel = get_kernel_version() |
| 79 | +host = get_host_name() |
| 80 | +uptime = get_uptime() |
| 81 | +packages = get_package_count() |
| 82 | +de = get_desktop_environment() |
| 83 | +resolution = get_resolution() |
| 84 | +terminal = get_terminal() |
| 85 | +shell = get_shell() |
| 86 | +cpu = get_cpu_info() |
| 87 | +gpu = get_gpu_info() |
| 88 | +memory = get_memory_info() |
| 89 | +disk = get_disk_usage() |
| 90 | +interfaces = get_interfaces() |
| 91 | + |
| 92 | +print() |
| 93 | +print(f"\n\n{YELLOW} ⚙️ LinFo ⚙️") |
| 94 | +print(f"{LIGHT_MAGENTA} 🕵🔎 Powered by KaotickJ 👽 \n") |
| 95 | +print(f"{GREEN} 🐧 OS:{LIGHT_CYAN} {os}") |
| 96 | +print(f"{GREEN} 🏠 Host:{LIGHT_CYAN} {host}") |
| 97 | +print(f"{GREEN} 🌽 Kernel:{LIGHT_CYAN} {kernel}") |
| 98 | +print(f"{GREEN} ⏲️ Uptime:{LIGHT_CYAN} {uptime}") |
| 99 | +print(f"{GREEN} 📦 Packages:{LIGHT_CYAN} {packages}") |
| 100 | +print(f"{GREEN} 🖥️ DE:{LIGHT_CYAN} {de}") |
| 101 | +print(f"{GREEN} 🎨 Resolution:{LIGHT_CYAN} {resolution}") |
| 102 | +print(f"{GREEN} 💻 Terminal:{LIGHT_CYAN} {terminal}") |
| 103 | +print(f"{GREEN} 🔨 Shell:{LIGHT_CYAN} {shell}") |
| 104 | +print(f"{GREEN} ⚡️ CPU:{LIGHT_CYAN} {cpu}") |
| 105 | +print(f"{GREEN} 🎮 GPU:{LIGHT_CYAN} {gpu}") |
| 106 | +print(f"{GREEN} 🧠 Memory:{LIGHT_CYAN} {memory}") |
| 107 | +print(f"{GREEN} 💾 Disk Usage:{LIGHT_CYAN} {disk}\n") |
| 108 | +print(f"{GREEN} 🌐 Interfaces:\n") |
| 109 | + |
| 110 | +for interface in interfaces.split('\n'): |
| 111 | + ip = run_command(f"ip -o addr show dev {interface} | awk '$3 == \"inet\" {{print $4}}'") |
| 112 | + print(f" {GREEN}🔗 {interface}: {LIGHT_CYAN}{ip}") |
| 113 | + |
| 114 | +print(f"{NC}") |
| 115 | + |
| 116 | +# ASCII art |
| 117 | +print(f"{RED}") |
| 118 | +print(" ██▓ ██▓ ███▄ █ █████▒▒█████") |
| 119 | +print(" ▓██▒ ▓██▒ ██ ▀█ █ ▓██ ▒▒██▒ ██▒") |
| 120 | +print(" ▒██░ ▒██▒▓██ ▀█ ██▒▒████ ░▒██░ ██▒") |
| 121 | +print(" ▒██░ ░██░▓██▒ ▐▌██▒░▓█▒ ░▒██ ██░") |
| 122 | +print(" ░██████▒░██░▒██░ ▓██░░▒█░ ░ ████▓▒░") |
| 123 | +print(" ░ ▒░▓ ░░▓ ░ ▒░ ▒ ▒ ▒ ░ ░ ▒░▒░▒░") |
| 124 | +print(" ░ ░ ▒ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ▒ ▒░") |
| 125 | +print(" ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒") |
| 126 | +print(" ░ ░ ░ ░ ░ ░") |
| 127 | +print(f" 🎈🎈🎈 {LIGHT_CYAN}y{YELLOW}O{BLUE}u{LIGHT_MAGENTA}'L{RED}l{YELLOW} f{LIGHT_CYAN}L{RED}o{LIGHT_CYAN}A{YELLOW}t{GREEN} {BLUE}t{LIGHT_MAGENTA}O{GREEN}o! 🎈🎈🎈 {NC}") |
0 commit comments