ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib64/nagios/plugins/check_a2_softy_version.sh.shared.mvps.mdedi
#!/bin/bash
#
# Compare installed and latest version of Softaculous

# Fetch latest version
_latest_version=$(curl --silent "https://api.softaculous.com/updates.php?version=latest&panel=cpanel&in=json" | jq -r '.version' 2>/dev/null)
# Fetch installed version
_installed_version=$(/usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --version 2>/dev/null)

_main(){
  # Check if Softy is installed
  if [[ ! -d "/usr/local/cpanel/whostmgr/docroot/cgi/softaculous" ]]; then
    echo "Softaculous is not installed!"
    exit 2
  fi

  # Compare versions using awk to handle decimal numbers
  if awk -v latest="${_latest_version}" -v installed="${_installed_version}" 'BEGIN{if (installed < latest) exit 0; exit 1}'; then
    echo "Softaculous version is outdated: ${_installed_version} (latest version is: ${_latest_version})"
    exit 2
  else
    echo "Softaculous version is updated: ${_installed_version}"
    exit 0
  fi

  # Save installed version and timestamp to the separate version cache
  echo "${_installed_version} $(date +%s)" > "${_version_cache}"
}

_main