shell bypass 403

GrazzMean-Shell Shell

: /lib64/nagios/plugins/nccustom/ [ drwxr-xr-x ]
Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 3.15.210.211
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : check-cpanel-update.sh
#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

resultFile="/var/log/nc_audit/check_sec_updates"
agetreshold=16 # 16 hours

#input option

PROGNAME=${0##*/}

print_usage() {
    echo ""
    echo "Usage: $PROGNAME [-f Diff path] [-a file Age treshold, hours]"
    echo "Usage: $PROGNAME -h | --help"
}

print_help() {
    print_usage
    echo ""
    echo "This script check cPanel security updates (see TOP-347)"
    echo ""
    echo "-f Different path and file. Default - /var/log/nc_audit/check_sec_updates"
    echo "-a Age treshold for logfiles, hours. Default - 16"
    echo "-h help Print this help screen"
    echo "--help Print this help screen"
    echo ""
    exit 3
}

while [ $# -gt 0 ]; do

    case "$1" in
        -f)
         resultFile=$2; shift
         ;;

        -a)
        agetreshold=$2; shift
        ;;

        --help)
        print_help
        exit 3
         ;;

        -h)
        print_help
        exit 3
         ;;

        *)
        echo >&2 "Unknown argument: $1"
        print_usage
        exit 3
        ;;

        esac
        shift
done

#file existence

if [ ! -f "$resultFile" ]; then
    echo "UNKNOWN. $resultFile no file"
    exit 3
fi

#check age file

resultFileAge=$((($(date +%s) - $(date +%s -r "${resultFile}")) / 3600))    # in hours

if (( resultFileAge > agetreshold )) ; then
    echo "UNKNOWN. File ${resultFile} older than ${agetreshold} hours"
    exit 3
fi

#checking file status

read -r firstline<"$resultFile"

firstline_code=$(echo "${firstline}" | awk '{print$1}' | sed 's/\[\|\]://g')

case "${firstline_code}" in

    "OK" )
    exitcode="0"
    ;;

    "FAILED" | "CRITICAL" )
    exitcode="2"
    ;;

    * )                         #Unknown state
    firstline="UNKNOWN. String from $resultFile does not match any pattern"
    exitcode="3"
    ;;

esac

echo "$firstline"
exit "$exitcode"
© 2025 GrazzMean-Shell