ILIAS  release_4-4 Revision
ilVirusScannerAntiVir Class Reference

Interface to the AntiVir virus protector. More...

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

Public Member Functions

 ilVirusScannerAntivir ($a_scancommand, $a_cleancommand)
 Constructor public. More...
 
 scanFile ($a_filepath, $a_origname="")
 scan a file for viruses More...
 
- Public Member Functions inherited from ilVirusScanner
 ilVirusScanner ($a_scancommand, $a_cleancommand)
 Constructor public. More...
 
 scanFile ($a_filepath, $a_origname="")
 scan a file for viruses More...
 
 cleanFile ($a_filepath, $a_origname="")
 clean an infected file More...
 
 fileCleaned ()
 returns wether file has been cleaned successfully or not More...
 
 logScanResult ()
 write the result of the last scan to the log More...
 
 logCleanResult ()
 write the result of the last clean to the log 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
 

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 16 of file class.ilVirusScannerAntiVir.php.

Member Function Documentation

◆ ilVirusScannerAntivir()

ilVirusScannerAntiVir::ilVirusScannerAntivir (   $a_scancommand,
  $a_cleancommand 
)

Constructor public.

Parameters
stringvirus scanner command

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

References ilVirusScanner\ilVirusScanner().

24  {
25  $this->ilVirusScanner($a_scancommand, $a_cleancommand);
26  $this->type = "antivir";
27  $this->scanZipFiles = true;
28  }
ilVirusScanner($a_scancommand, $a_cleancommand)
Constructor public.
+ Here is the call graph for this function:

◆ 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 38 of file class.ilVirusScannerAntiVir.php.

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

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

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