#/bin/csh -f
# vfmv (VFind Move) Version 1.0  This program is written in csh  (C-shell)
# Copyright Jan 1998 by Peter V. Radatti.  All rights reserved.

echo "Vfind interactive disinfector by quarantine. Example Program"
echo " "
echo "This program works by moving files suspected of being infected with"
echo "a computer virus to a directory named QUARANTINE."
echo " "
echo "Please note that if you move any important system files it may"
echo "cause the system to crash or not reboot."
echo " "
echo "NOTE:  This script will scan any existing QUARANTINE directories."
echo "You need to say no to a move request on an already Quarantined file."
echo " "

# Lets make sure the quarantine directory exists
mkdir ./QUARANTINE >&/dev/null 

# We don't want anyone poking around in the quarantine directory except for the owner
chmod 700 ./QUARANTINE

# Find each of the infected files
foreach subname (`find / -type f -print | $VSTK_HOME/bin/vfind --quiet=2 |grep "##==>>>>" | grep "FILE:"|awk -F: '{print $2}'`)
		# Tell the user the name of the infected file and give them the option to move it
		echo "Infected filename is: $subname"
		echo -n "Move it now? (y/n): "
		set ansr = $<
		while ("$ansr" != "y" && "$ansr" != "n")
			echo -n "Please ansrwer y or n : "
			set ansr = $<
		end
		if ("$ansr" == "y") then
			/bin/mv $subname ./QUARANTINE/$subname
			if ($status) then
				echo "An error attempting to remove this file has occurred."
				echo "This may be caused by the file having already been erased"
				echo "or a file permission problem.  Please review the file"
				echo "later. PROCESSING CONTINUES"
			endif
		endif

		if ("$ansr" == "n") then
			echo " "
			echo "File not moved -- continuing"
			echo " "
		endif
end

# Lets make sure that everything in the quarantine directory stays there.

cd ./QUARANTINE
/bin/rm -f INDEX-QUARANTINE >&/dev/null
ls -l > INDEX-QUARANTINE
chmod 500 *

# We are done.  Wrap it up.
echo "Job Complete.  Quarantined files contained in ./QUARANTINE"

