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_md5files
#!/bin/bash
# Name: check_md5files
# Author: Tsvetan Gerov <tsvetan@worldhost.group>
# Version 0.2
#
# Description: Check the md5sum of a multiple files stored in a file
# Usage: To add a file/files to a list, run:
# md5sum  /path/to/file >> /usr/lib64/nagios/plugins/md5list

MD5=$(which md5sum)
MD5_LIST="/usr/lib64/nagios/plugins/md5list"
MD5_LIST_CUSTOM="/usr/lib64/nagios/plugins/md5list.custom"

if [ -f "$MD5_LIST_CUSTOM" ]; then
        MD5_LIST="$MD5_LIST_CUSTOM"
fi

# Initialize flags and error message
CRITICAL=false
ERROR_MESSAGE=""

# Check for deps
DEPS="$MD5 $MD5_LIST"
for DEP in $DEPS; do
	if [ ! -f "$DEP" ]; then
		echo "[UNKNOWN] Not found $DEP"
		exit 3
	fi
done

# Check MD5 sum of files
for FILE in $(cat $MD5_LIST | awk '{print$2}'); do
	MD5SUM=$(grep $FILE $MD5_LIST | awk '{print$1}')
	if [ ! -f $FILE ]; then
		CRITICAL=true
		ERROR_MESSAGE+="$FILE does not exists!, "
	else
		LMD5=$($MD5 $FILE | awk '{print$1}')
		if [ $MD5SUM != $LMD5 ]; then
		 	CRITICAL=true
			ERROR_MESSAGE+="$FILE has been modified!, "
		fi
	fi
done

# Return final state
if [ "$CRITICAL" = true ]; then
    echo "[CRITICAL] ${ERROR_MESSAGE%, }"
    exit 2
else
    echo "[OK] All files match their MD5SUM"
    exit 0
fi