my clamAV script
by pingoleon108 - 04-06-2018, 06:38 PM
LOGFILE="/var/log/clamav/clamav-$(date +'%Y-%m-%d').log";
EMAIL_MSG="Please see the log file attached.";
EMAIL_TO="[email protected]";
DIRTOSCAN="/tmp/ /home/";

for S in ${DIRTOSCAN}; do
 DIRSIZE=$(du -sh "$S" 2>/dev/null | cut -f1);

 echo "Starting a daily scan of "$S" directory.
 Amount of data to be scanned is "$DIRSIZE".";

 clamscan -ri "$S" >> "/var/log/$LOGFILE";

 # get the value of "Infected lines"
 MALWARE=$(tail "/var/log/$LOGFILE"|grep Infected|cut -d" " -f3);

 # if the value is not equal to zero, send an email with the log file attached
 if [ "$MALWARE" -ne "0" ];then
 # using heirloom-mailx below
 echo "$EMAIL_MSG"|mail -a "$LOGFILE" -s "Malware Found" -r "$EMAIL_FROM" "$EMAIL_TO";

exit 0

Possibly Related Threads…
Thread Author Replies Views Last Post
eBay Scam Pages Script | 2017 | english | Krypx 2 319 05-19-2019, 06:42 PM
Last Post: Krypx
Help with finding memcached attack script Beaver 2 106 04-24-2019, 02:55 AM
Last Post: Beaver
Python Perl PHP and C script hacking mega pack bilalkhanicom 0 181 04-18-2019, 09:09 AM
Last Post: bilalkhanicom

 Users browsing this thread: 1 Guest(s)