403Webshell
Server IP : 172.67.149.12  /  Your IP : 104.23.243.226
Web Server : Apache
System : Linux vm3310.eosdns.net 4.18.0-553.132.1.el8_10.x86_64 #1 SMP Thu Jun 11 14:27:43 UTC 2026 x86_64
User : carnalmedia ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /mojo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /mojo/get_info
#!/bin/bash
#
# Script: get_info
#
# Usage: get_info (all/memory/disk/cpu/ip/installed)
#
# Description: Quick server check for RAM, CPU, DiskSpace, IPs, services, and installed apps
#
# Author: Oliver Mikitiuk
#
# Changelog:
# * 15.09.2025: Oliver Mikitiuk
# - Initial write
# * 08.05.2026: Oliver Mikitiuk
# - Added checkMySQLVersion and locate_exist check 



getDiskSpace () {

    echo
    echo "====== Disk Info ======"
    df -h | grep -vE 'tmpfs|devtmpfs'
    echo

}

getMemory () {

    echo
    echo "====== Memory Info ======"
    free -h
    echo

}

getCPU () {

    echo
    echo "====== CPU Info ======"

    lscpu | grep -E "^CPU\(s\):"
    local cores_per_socket=$(lscpu | awk -F: '/Core\(s\) per socket/ {print $2}' | xargs)
    local sockets=$(lscpu | awk -F: '/Socket\(s\)/ {print $2}' | xargs)
    local physical_cores=$((cores_per_socket * sockets))
    echo "Core(s):             ${physical_cores}"
    lscpu | grep -E "Model name"
    echo
    echo -n "Load average: "
    uptime | awk -F'load average: ' '{print $2}'
    echo

}

getWANIPs () {

    echo
    echo "====== WAN IP(s) ======"
    ip addr show | grep 'inet ' | awk '{print $2}' | grep -vE "^(127\.|10\.|192\.168\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)"
    echo

}

getLANIPs () {

    echo
    echo "====== LAN IP(s) ======"
    ip addr show | grep 'inet ' | awk '{print $2}' | grep -E "^(10\.|192\.168\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)"
    echo

}

getAllIPs () {

    getWANIPs
    getLANIPs

}

checkServiceActive() {

    local name="${1}"
    local service="${2}"

    if systemctl is-active --quiet "${service}"  >/dev/null 2>&1|| pgrep -x "${service}" >/dev/null 2>&1; then
        echo "${name}: Yes"
        return 0
    else
        echo "${name}: No"
        return 1
    fi

}

checkApacheModule() {

    local name="${1}"
    local module="${2}"

    local modules_list=$(httpd -M 2>/dev/null || apachectl -M 2>/dev/null)
    if echo "${modules_list}" | grep -q "${module}"; then
        echo "${name}: Yes"
        return 0
    else
        echo "${name}: No"
        return 1
    fi
}

checkFileExist() {

    local name="${1}"
    local file="${2}"

    if [[ "$locate_exist" == "true" ]]; then
        if locate -b "\\${file}" | grep -q '.'; then
            echo "${name}: Yes"
            return 0
        else
            echo "${name}: No"
            return 1
        fi
    else
        if find /home/httpd/html /home -maxdepth 6 -type f -name "${file}" 2>/dev/null | grep -q '.'; then
            echo "${name}: Yes"
            return 0
        else
            echo "${name}: No"
            return 1
        fi
    fi


}

checkPHPVersions () {

    local versions_list=()

    for bin in $(find /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin /usr/local/php* /opt -type f \( -name "php" -o -name "php[0-9]*" \) 2>/dev/null); do
        if [[ -x "${bin}" ]]; then
            local version=$(${bin} -v 2>/dev/null | head -1 | grep -oE "[0-9]+\.[0-9]+")
            if [[ -n "${version}" ]]; then
                versions_list+=("${version}")
            fi
        fi
    done

    if [[ ${#versions_list[@]} -gt 0 ]]; then
        local uniq_versions_list=$(printf "%s\n" "${versions_list[@]}" | sort -uV)
        echo "PHP versions: $(echo ${uniq_versions_list})"
        return 0
    else
        echo "PHP versions: Unknown"
        return 1
    fi

}

checkMySQLVersion() {

    local version_output
    local version

    if checkServiceActive "MariaDB" "mariadb" >/dev/null 2>&1 || checkServiceActive "MySQL" "mysqld" >/dev/null 2>&1 || checkServiceActive "MySQL" "mysql" >/dev/null 2>&1 ; then
        version_output=$(mysql -e "SELECT VERSION();" 2>/dev/null | grep -v VERSION)
        version=$(echo "$version_output" | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?")

        if echo "$version_output" | grep -qi "mariadb"; then
            echo "MariaDB version: $version"
            return 0
        else
            echo "MySQL version: $version"
            return 0
        fi
    else
        echo "MySQL: No"
        return 1
    fi

}

getInstallationInfo() {

    echo
    echo "====== Installation Info ======"

    echo "Hostname: $(hostname)"
    echo "OS: ${OSNAME}"

    if checkServiceActive "cPanel" "cpanel" >/dev/null 2>&1; then
        echo "Control panel (cPanel): Yes"
    elif checkServiceActive "DirectAdmin" "directadmin" >/dev/null 2>&1; then
        echo "Control panel (DirectAdmin): Yes"
    else
        echo "Control panel: No"
    fi

    echo
    checkServiceActive "Apache" "httpd"
    checkServiceActive "Nginx" "nginx"
    checkServiceActive "Redis" "redis"
    checkServiceActive "Docker" "docker"

    checkPHPVersions
    checkMySQLVersion

    echo
    if checkServiceActive "Apache" "httpd" >/dev/null 2>&1; then
        echo "Apache modules:"
        checkApacheModule "  ProxyPass" "prxp_module"
        checkApacheModule "  PSSO" "psso_module"
    fi

    echo

    if command -v locate >/dev/null 2>&1; then
        local locate_exist="true"
        updatedb
    else
        local locate_exist="false"
    fi
    checkFileExist "WordPress" "wp-config.php"
    checkFileExist "Nats" "nats.txt"
    checkFileExist "ElevatedX" "cmsinclude.ini.php"
    checkFileExist "KVS" "setup_db.php"
    checkFileExist "Mechbunny" "functions.mb.php"
    echo

}

getAllInfo () {

    getDiskSpace
    getMemory
    getCPU
    getAllIPs
    getInstallationInfo

}

HELP () {

    echo "A tool for getting lots of information about the server"
    echo "Usage: get_info (all/memory/disk/cpu/ip/installed)"

}


# Ensure the script is run as root
if [ "$(whoami)" != 'root' ]; then
    echo "[ERROR] You must execute this script as the root user!"
    exit 1
fi

OSNAME=$(cat /etc/os-release | grep -E '^PRETTY_NAME=' | sed  's|"||g' | sed 's|PRETTY_NAME=||g')

if [[ "${1}" == "" ]] || [[ "${1}" == "-h" ]] || [[ "${1}" == "--help" ]]; then
    HELP
    exit
fi

for arg in "${@}"; do
    arg_lower="${arg,,}"
    case "${arg_lower}" in
        all) getAllInfo ;;
        memory|ram) getMemory ;;
        disk|diskspace) getDiskSpace ;;
        ip|ips) getAllIPs ;;
        wan|wanip|wanips) getWANIPs ;;
        lan|lanip|lanips) getLANIPs ;;
        cpu) getCPU ;;
        installed|installation|install) getInstallationInfo ;;
        *) echo "[INFO] Unknown option: ${arg}" ;;
    esac
done


Youez - 2016 - github.com/yon3zu
LinuXploit