ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilVirusScannerAntiVir Class Reference

Interface to the AntiVir virus protector. More...

+ Inheritance diagram for ilVirusScannerAntiVir:
+ Collaboration diagram for ilVirusScannerAntiVir:

Public Member Functions

 __construct ($a_scancommand, $a_cleancommand)
 Constructor public. More...
 
 scanFile ($a_filepath, $a_origname="")
 scan a file for viruses More...
 
- Public Member Functions inherited from ilVirusScanner
 __construct ($a_scancommand, $a_cleancommand)
 Constructor public. More...
 
 scanBuffer ($buffer)
 
 scanFile ($a_filepath, $a_origname="")
 scan a file for viruses needs to be redefined in child classes here it simulates a scan "infected.txt" or "cleanable.txt" are expected to be infected More...
 
 cleanFile ($a_filepath, $a_origname="")
 clean an infected file needs to be redefined in child classes here it simulates a clean "cleanable.txt" is expected to be cleanable More...
 
 fileCleaned ()
 returns wether file has been cleaned successfully or not More...
 
 logScanResult ()
 write the result of the last scan to the log public More...
 
 logCleanResult ()
 write the result of the last clean to the log public More...
 
 getScanResult ()
 get the pure output of the external scan More...
 
 getCleanResult ()
 get the pure output of the external scan More...
 
 getScanMessage ()
 get a located message with the result from the last scan More...
 
 getCleanMessage ()
 get a located message with the result from the last clean More...
 
 getScanZipFiles ()
 get info if class can scan ZIP files More...
 

Additional Inherited Members

- Data Fields inherited from ilVirusScanner
 $type
 
 $scanZipFiles
 
 $scanCommand
 
 $cleanCommand
 
 $scanFilePath
 
 $scanFileOrigName
 
 $cleanFilePath
 
 $cleanFileOrigName
 
 $scanFileIsInfected
 
 $cleanFileIsCleaned
 
 $scanResult
 
 $cleanResult
 
 $ilias
 
 $lng
 
 $log
 
- Protected Member Functions inherited from ilVirusScanner
 scanFileFromBuffer ($buffer)
 
 createBufferFile ($buffer)
 
 removeBufferFile ($bufferFile)
 

Detailed Description

Interface to the AntiVir virus protector.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilVirusScannerAntiVir.php.

Constructor & Destructor Documentation

◆ __construct()

ilVirusScannerAntiVir::__construct (   $a_scancommand,
  $a_cleancommand 
)

Constructor public.

Parameters
stringvirus scanner command

Definition at line 20 of file class.ilVirusScannerAntiVir.php.

21  {
22  parent::__construct($a_scancommand, $a_cleancommand);
23  $this->type = "antivir";
24  $this->scanZipFiles = true;
25  }

Member Function Documentation

◆ scanFile()

ilVirusScannerAntiVir::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

Definition at line 34 of file class.ilVirusScannerAntiVir.php.

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

35  {
36  // This function should:
37  // - call the external scanner for a_filepath
38  // - set scanFilePath to a_filepath
39  // - set scanFileOrigName to a_origname
40  // - set scanFileIsInfected according the scan result
41  // - set scanResult to the scanner output message
42  // - call logScanResult() if file is infected
43  // - return the scanResult, if file is infected
44  // - return an empty string, if file is not infected
45 
46  $this->scanFilePath = $a_filepath;
47  $this->scanFileOrigName = $a_origname;
48 
49  // Call of antivir command
50  $cmd = $this->scanCommand . " " . $a_filepath . " ";
51  exec($cmd, $out, $ret);
52  $this->scanResult = implode("\n", $out);
53 
54  // sophie could be called
55  if (preg_match('/ALERT:/', $this->scanResult)) {
56  $this->scanFileIsInfected = true;
57  $this->logScanResult();
58  return $this->scanResult;
59  } else {
60  $this->scanFileIsInfected = false;
61  return "";
62  }
63 
64  // antivir has failed (todo)
65  $this->log->write("ERROR (Virus Scanner failed): "
66  . $this->scanResult
67  . "; COMMAMD=" . $cmd);
68  }
logScanResult()
write the result of the last scan to the log public
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

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