137 $this->scanCommand = $a_scancommand;
138 $this->cleanCommand = $a_cleancommand;
140 $this->type =
"simulate";
141 $this->scanZipFiles =
false;
160 $isInfected = $this->
scanFile($bufferFile);
172 file_put_contents($bufferFile, $buffer);
194 public function scanFile($a_filepath, $a_origname =
"")
207 $this->scanFilePath = $a_filepath;
208 $this->scanFileOrigName = $a_origname;
210 if ($a_origname ==
"infected.txt" or $a_origname ==
"cleanable.txt") {
211 $this->scanFileIsInfected =
true;
213 "FILE INFECTED: [" . $a_filepath .
"] (VIRUS: simulated)";
217 $this->scanFileIsInfected =
false;
218 $this->scanResult =
"";
233 public function cleanFile($a_filepath, $a_origname =
"")
246 $this->cleanFilePath = $a_filepath;
247 $this->cleanFileOrigName = $a_origname;
249 if ($a_origname ==
"cleanable.txt") {
250 $this->cleanFileIsCleaned =
true;
252 "FILE CLEANED: [" . $a_filepath .
"] (VIRUS: simulated)";
256 $this->cleanFileIsCleaned =
false;
258 "FILE NOT CLEANED: [" . $a_filepath .
"] (VIRUS: simulated)";
279 $mess =
"Virus Scanner (" . $this->type .
")";
280 if ($this->scanFileOrigName) {
281 $mess .=
" (File " . $this->scanFileOrigName .
")";
283 $mess .=
": " . preg_replace(
'/[\r\n]+/',
"; ", $this->scanResult);
285 $this->log->write($mess);
294 $mess =
"Virus Cleaner (" . $this->type .
")";
295 if ($this->cleanFileOrigName) {
296 $mess .=
" (File " . $this->cleanFileOrigName .
")";
298 $mess .=
": " . preg_replace(
'/[\r\n]+/',
"; ", $this->cleanResult);
300 $this->log->write($mess);
330 if ($this->scanFileIsInfected) {
336 if ($this->scanResult) {
337 $ret .=
" " . $this->lng->txt(
"virus_scan_message")
341 $this->scanFileOrigName,
342 nl2br($this->scanResult)
355 if ($this->cleanFileIsCleaned) {
361 if ($this->cleanResult) {
362 $ret .=
" " . $this->lng->txt(
"virus_clean_message")
365 $this->cleanFilePath,
366 $this->cleanFileOrigName,
367 nl2br($this->cleanResult)
fileCleaned()
returns wether file has been cleaned successfully or not
createBufferFile($buffer)
getScanZipFiles()
get info if class can scan ZIP files
removeBufferFile($bufferFile)
scanFile($a_filepath, $a_origname="")
scan a file for viruses needs to be redefined in child classes here it simulates a scan "infected...
logScanResult()
write the result of the last scan to the log public
logCleanResult()
write the result of the last clean to the log public
scanFileFromBuffer($buffer)
cleanFile($a_filepath, $a_origname="")
clean an infected file needs to be redefined in child classes here it simulates a clean "cleanable...
redirection script todo: (a better solution should control the processing via a xml file) ...
getScanMessage()
get a located message with the result from the last scan
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
getCleanResult()
get the pure output of the external scan
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
__construct($a_scancommand, $a_cleancommand)
Constructor public.
getCleanMessage()
get a located message with the result from the last clean
getScanResult()
get the pure output of the external scan