#!/bin/csh -f
# vfstab (vfind-fstab)
###############################################
# vfstab           Version 2.0  November 1997 #
#                  Version 1.0  November 1992 #
# Automatically scan exported filesystems     #
###############################################

# set the variable to the address of the export file
set file = "/etc/exports" 

# House cleaning
rm -f /tmp/virreport 
touch /tmp/virreport 
echo -n "##==>>>> VIRUS SCAN OF: " >> /tmp/virreport 
hostname >> /tmp/virreport 
date >> /tmp/virreport

# Scan every partition specified in the exports file
@ nl = 1
while (1)
     #get the next line of the export file to process
     set tline = `sed -n $nl,${nl}p $file`  
     #strip off access permissions, etc
     set line = `echo $tline |awk '{print $1}'`
     if ("$line" == "" ) break
     @ nl++
     #tell the user what we are doing
     echo "##==>>>>  Scanning: $line" >> /tmp/virreport
     #add to the report file
     find $line -type f -print |vfind --quiet=2 >> /tmp/virreport
     echo -n "##==>>>> Scanning complete: " >> /tmp/virreport 
end # while

# extract important information then mail virus 
cat /tmp/virreport | grep "##==>>>>" | mail root 
