#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: http://mirrors.slickstack.io/bash/ss-scan-malware.txt ################################# #### path: /var/www/ss-scan-malware ################################################################ #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Scans the entire SlickStack directory tree (only) for malware using ClamAV ########### #### module version: ClamAV 0.101.x ################################################################ #### sourced by: ss core cron jobs ################################################################# #################################################################################################### ## SS-SCAN-MALWARE SCANS AND LOGS ANY COMMON LINUX MALWARE TO: /var/www/logs/clamav.log ## ## USE SS-CLEAN TO DELETE GENERAL JUNK FILES OR SS-OPTIMIZE TO IMPROVE DATABASE ## ## include SlickStack configuration ## source /var/www/ss-config ## include SlickStack functions ## source /var/www/ss-functions #################################################################################################### #### SS-Scan-Malware: Message (Begin Script) ####################################################### #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## echo -e "${PURPLE}Running ss-scan-malware: Scans the entire SlickStack directory tree (only) for malware using ClamAV... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Scan-Malware: Scan SlickStack Directory Tree For Malware (Via ClamAV) ###################### #################################################################################################### ## on average the ClamAV scanning process takes around 5-10 minutes on typical servers ## ## verbose results are printed via CLI (also saved to /var/www/logs/clamav.log) ## ## ensure ClamAV log file exists ## if [[ ! -f "/var/www/logs/clamav.log" ]]; then touch "/var/www/logs/clamav.log" chown clamav:clamav /var/www/logs/clamav.log fi ## scan SlickStack directory tree (only) for common malware ## clamscan -ir /var/www -l /var/www/logs/clamav.log #################################################################################################### #### SS-Scan-Malware: Touch Timestamp File (End Script) ############################################ #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## touch /var/www/meta/.timestamp-ss-scan-malware #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: