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.17.26.38
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : check_suspicious_files_status.sh
#!/bin/bash

# Default values for the log file path and time threshold
log_file="/var/log/nc_audit/suspicious_file_detector.log"
allowed_time_diff=3600  # Default: 3600 seconds (1 hour)

# Function to display usage
usage() {
    echo "Usage: $0 [-f log_file] [-t allowed_time_difference_in_seconds]"
    exit 3
}

# Parse command-line arguments
while getopts "f:t:" opt; do
    case ${opt} in
        f)
            log_file="${OPTARG}"
            ;;
        t)
            allowed_time_diff="${OPTARG}"
            ;;
        *)
            usage
            ;;
    esac
done

# Check if the log file exists and is not empty
if [[ ! -f "${log_file}" || ! -s "${log_file}" ]]; then
    echo "ERROR: Log file ${log_file} does not exist or is empty."
    exit 1
fi

# Check the last modification time of the log file
current_time=$(date +%s)
file_mod_time=$(stat -c %Y "${log_file}")
time_diff=$((current_time - file_mod_time))

if (( time_diff > allowed_time_diff )); then
    echo "CRITICAL!: Log file was modified more than $((allowed_time_diff / 60)) minutes ago."
    exit 2
fi

# Get the last line of the log file
last_line=$(tail -n 1 "$log_file")

if [[ "${last_line}" == *"CRITICAL!"* ]]; then
    echo "${last_line}"
    exit 2
elif [[ "${last_line}" == *"WARNING"* ]]; then
    echo "${last_line}"
    exit 1
elif [[ "${last_line}" == *"OK!"* ]]; then
    echo "${last_line}"
    exit 0
else
    echo "UNKNOWN: ${last_line}"
    exit 3
fi
© 2025 GrazzMean-Shell