ClamAV
ClamAV is an open source antivirus program designed for Unix-like systems. Dreamhost does not currently provide ClamAV on its servers.
ClamAV can be useful for filtering out emails that contain a virus. A guide to installing ClamAV with ClamAssassin at jhcore.com
ClamAV Installation
Log into SSH using your choice of SSH software, such as Putty. Enter in the following information.
mkdir ~/install_files mkdir ~/packages cd ~/install_files wget http://sourceforge.net/projects/clamav/files/clamav/0.97.3/clamav-0.97.3.tar.gz tar xvzf clamav-0.97.3.tar.gz cd clamav-0.97.3 ./configure --prefix=$HOME/packages --disable-clamav make make install
After you have installed ClamAV, you will want to keep it up to date, so you will want to add a cron tab.
crontab -e
Once in the crontab editor, you will want to add this line (change <your username> to your actual name):
0 1 * * * /home/<your username>/packages/bin/freshclam
This is just to get ClamAV installed, to do more advanced installation, go here: jhcore.com
ClamAV PHP
Once you have installed ClamAV and the crontab, you probably want scan files, and to do so, you can use the following PHP code (Change example.com with your domain):
<?php
$files = array();
$files[] = '~/example.com/file1.php';
$files[] = '~/example.com/file2.php';
$files[] = '~/example.com/file3.php';
$fList = implode(' ',$files);
$opt = shell_exec("~/packages/bin/clamscan $fList");
$out = explode("\n",$opt);
for($i=0;$i<count($files);$i++){
$infected = explode(": ",$out[$i]);
if($infected[1] == 'OK')
echo $files[$i].' is NOT infected!<br />';
else
echo $files[$i].' is infected.<br />';
}
?>