ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilVirusScannerClamAV Class Reference

Interface to the ClamAV virus protector. More...

+ Inheritance diagram for ilVirusScannerClamAV:
+ Collaboration diagram for ilVirusScannerClamAV:

Public Member Functions

 ilVirusScannerClamAV ($a_scancommand, $a_cleancommand)
 Constructor public.
 scanFile ($a_filepath, $a_origname="")
 scan a file for viruses
- Public Member Functions inherited from ilVirusScanner
 ilVirusScanner ($a_scancommand, $a_cleancommand)
 Constructor public.
 cleanFile ($a_filepath, $a_origname="")
 clean an infected file
 fileCleaned ()
 returns wether file has been cleaned successfully or not
 logScanResult ()
 write the result of the last scan to the log
 logCleanResult ()
 write the result of the last clean to the log
 getScanResult ()
 get the pure output of the external scan
 getCleanResult ()
 get the pure output of the external scan
 getScanMessage ()
 get a located message with the result from the last scan
 getCleanMessage ()
 get a located message with the result from the last clean
 getScanZipFiles ()
 get info if class can scan ZIP files

Additional Inherited Members

- Data Fields inherited from ilVirusScanner
 $type
 $scanZipFiles
 $scanCommand
 $cleanCommand
 $scanFilePath
 $scanFileOrigName
 $cleanFilePath
 $cleanFileOrigName
 $scanFileIsInfected
 $cleanFileIsCleaned
 $scanResult
 $cleanResult
 $ilias
 $lng
 $log

Detailed Description

Interface to the ClamAV virus protector.

Author
Ralf Schenk rs@da.nosp@m.taba.nosp@m.y.de
Version
Id:
class.ilVirusScannerClamAV.php 12808 2006-12-08 18:04:21Z akill

Definition at line 36 of file class.ilVirusScannerClamAV.php.

Member Function Documentation

ilVirusScannerClamAV::ilVirusScannerClamAV (   $a_scancommand,
  $a_cleancommand 
)

Constructor public.

Parameters
stringvirus scanner command

Definition at line 43 of file class.ilVirusScannerClamAV.php.

References ilVirusScanner\ilVirusScanner().

{
$this->ilVirusScanner($a_scancommand, $a_cleancommand);
$this->type = "clamav";
$this->scanZipFiles = true;
}

+ Here is the call graph for this function:

ilVirusScannerClamAV::scanFile (   $a_filepath,
  $a_origname = "" 
)

scan a file for viruses

Parameters
stringpath of file to check
stringoriginal name of the file to ckeck
Returns
string virus message (empty if not infected) public

Reimplemented from ilVirusScanner.

Definition at line 58 of file class.ilVirusScannerClamAV.php.

References $cmd, $out, $ret, ilVirusScanner\$scanResult, and ilVirusScanner\logScanResult().

{
// This function should:
// - call the external scanner for a_filepath
// - set scanFilePath to a_filepath
// - set scanFileOrigName to a_origname
// - set scanFileIsInfected according the scan result
// - set scanResult to the scanner output message
// - call logScanResult() if file is infected
// - return the scanResult, if file is infected
// - return an empty string, if file is not infected
$this->scanFilePath = $a_filepath;
$this->scanFileOrigName = $a_origname;
// Call of antivir command
$cmd = $this->scanCommand . " --no-summary -i " . $a_filepath. " 2>&1";
exec($cmd, $out, $ret);
$this->scanResult = implode("\n", $out);
// sophie could be called
if (ereg("FOUND", $this->scanResult))
{
$this->scanFileIsInfected = true;
$this->logScanResult();
}
else
{
$this->scanFileIsInfected = false;
return "";
}
// antivir has failed (todo)
$this->log->write("ERROR (Virus Scanner failed): "
. $this->scanResult
. "; COMMAMD=" . $cmd);
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: