Debian/Ubuntu Anti-Virus and Root Kit Scan Script

Posted: November 9, 2009 in Debian
Debian / Ubuntu antivirus and scanner update / scan script.
you can download here: script
#!/bin/bash
#  script: Weekly AV/RK Scan Script     #
#                                       #
#  written by:                          #
#    Patrick Burns                      #
#########################################

EMAIL="burnsoft@gmail.com"

#Create the log file, remove the previous weeks log if needed.  I know this is bad form for creating a log...i'll revisit this issue another day...
rm -f /root/scan_script/scan.log
touch /root/scan_script/scan.log

#First we need to update ClamAV
echo " "
echo "####################################################################################" | tee -a scan.log
echo "###                            Updating ClamAV                                  ####" | tee -a scan.log
echo "####################################################################################" | tee -a scan.log
echo " "

freshclam | tee -a scan.log

#Now we scan the server with our updated ClamAV
echo "####################################################################################" | tee -a scan.log
echo "###                       Beginning ClamAV Anti-Virus Scan                      ####" | tee -a scan.log
echo "####################################################################################" | tee -a scan.log
echo " "

clamscan -r -i / | tee -a scan.log

#Next we update RKHunter
echo "####################################################################################" | tee -a scan.log
echo "###                                Updating RKHunter                            ####" | tee -a scan.log
echo "####################################################################################" | tee -a scan.log
echo " "

rkhunter --update | tee -a scan.log

#Then we scan with RKHunter
echo "####################################################################################" | tee -a scan.log
echo "###                               Beginning RKHunter Scan                       ####" | tee -a scan.log
echo "####################################################################################" | tee -a scan.log
echo " "

rkhunter -sk -c | tee -a scan.log

#Finally, we mail the log to the email address specified below
mutt -s "Weekly Virus/Rootkit Scan" -a /root/scan_script/scan.log ${EMAIL} < /root/scan_script/scan.log

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s