11require_once
"./Services/VirusScanner/classes/class.ilVirusScanner.php";
23 $this->type =
"sophos";
24 $this->scanZipFiles =
true;
34 public function scanFile($a_filepath, $a_origname =
"")
46 $this->scanFilePath = $a_filepath;
47 $this->scanFileOrigName = $a_origname;
51 $a_filepath = realpath($a_filepath);
54 $cmd = $cmd .
" " . $args .
" 2>&1";
56 $this->scanResult = implode(
"\n",
$out);
60 if (preg_match(
"/FILE INFECTED/", $this->scanResult)) {
61 $this->scanFileIsInfected =
true;
65 $this->scanFileIsInfected =
false;
71 $this->log->write(
"ERROR (Virus Scanner failed): "
73 .
"; COMMAMD=" . $cmd);
79 $cmd = $this->cleanCommand .
" -ss -archive " . $a_filepath .
" 2>&1";
81 $this->scanResult = implode(
"\n",
$out) .
" [" .
$ret .
"]";
89 $this->scanFileIsCleaned =
false;
91 } elseif (
$ret == 3) {
92 $this->scanFileIsInfected =
true;
96 $this->
ilias->raiseError(
97 $this->lng->txt(
"virus_scan_error") .
" "
98 . $this->lng->txt(
"virus_scan_message") .
" "
100 $this->ilias->error_obj->WARNING
112 public function cleanFile($a_filepath, $a_origname =
"")
124 $this->cleanFilePath = $a_filepath;
125 $this->cleanFileOrigName = $a_origname;
134 $a_filepath = realpath($a_filepath);
135 $cmd = $this->cleanCommand .
" -di -nc -ss -eec -archive " . $a_filepath .
" 2>&1";
137 $this->cleanResult = implode(
"\n",
$out) .
" [" .
$ret .
"]";
154 $this->cleanFileIsCleaned =
true;
157 $this->cleanFileIsCleaned =
false;
An exception for terminatinating execution or to throw for unit testing.
static escapeShellArg($a_arg)
static escapeShellCmd($a_arg)
escape shell cmd
Interface to the sophos virus protector.
__construct($a_scancommand, $a_cleancommand)
Constructor @access public.
cleanFile($a_filepath, $a_origname="")
clean an infected file
scanFile($a_filepath, $a_origname="")
scan a file for viruses
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
logScanResult()
write the result of the last scan to the log @access public
logCleanResult()
write the result of the last clean to the log @access public
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)