Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my clamAV script
#1
#!/bin/bash
LOGFILE="/var/log/clamav/clamav-$(date +'%Y-%m-%d').log";
EMAIL_MSG="Please see the log file attached.";
EMAIL_FROM=$hostname;
EMAIL_TO="infose[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";
 fi
done

exit 0
Reply
 


Possibly Related Threads...
Thread Author Replies Views Last Post
  Script to sort out combo lists ReleavedStudios 0 166 08-18-2018, 07:48 PM
Last Post: ReleavedStudios
  PoC Facebook Access Token Script teamkelvinsecteam 0 362 05-30-2018, 02:29 PM
Last Post: teamkelvinsecteam
  [PHP] AwesomeWare Ransomware PHP Script securityteam 6 654 04-30-2018, 07:42 PM
Last Post: StLuis
  Script to resolve a bunch of ips to domains pingoleon108 0 269 04-06-2018, 06:42 PM
Last Post: pingoleon108
  Admin Page Finding Python Script Tac 6 1,494 02-13-2018, 01:20 AM
Last Post: Noxy



Users browsing this thread: 1 Guest(s)