19 $this->
options(IL_ICAP_AV_COMMAND);
27 public function scanFile($a_filepath, $a_origname =
"")
30 if (file_exists($a_filepath)) {
31 if (is_readable($a_filepath)) {
32 $a_filepath = realpath($a_filepath);
36 'req-hdr' =>
"POST /test HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n",
37 'req-body' => file_get_contents($a_filepath)
41 $return_string = sprintf(
'Virus found in file "%s"!', $a_filepath);
42 $this->log->warning($return_string);
45 $return_string = sprintf(
'File "%s" not readable.', $a_filepath);
46 $this->log->warning($return_string);
49 $return_string = sprintf(
'File "%s" not found.', $a_filepath);
50 $this->log->warning($return_string);
52 $this->log->info(sprintf(
'No virus found in file "%s".', $a_filepath));
53 return $return_string;
63 if (array_key_exists(self::HEADER, $header)) {
64 $header = $header[self::HEADER];
65 if (array_key_exists(self::HEADER_VIOLATION_FOUND, $header)) {
66 if ($header[self::HEADER_VIOLATION_FOUND] > 0) {
70 if (array_key_exists(self::HEADER_INFECTION_FOUND, $header)) {
71 if (strlen($header[self::HEADER_INFECTION_FOUND]) > 0) {
72 $infection_split = preg_split(
'/;/', $header[self::HEADER_INFECTION_FOUND]);
73 foreach ($infection_split as $infection) {
74 $parts = preg_split(
'/=/', $infection);
75 if ($parts !==
false &&
78 strlen($parts[0]) > 0) {
79 $this->log->warning(trim($parts[0]) .
': ' . trim($parts[1]));
__construct($a_scancommand, $a_cleancommand)
ilVirusScannerICapAvClient constructor.
const HEADER_INFECTION_FOUND
Interface to the ClamAV virus protector.
__construct(Container $dic, ilPlugin $plugin)
const HEADER_VIOLATION_FOUND
scanFile($a_filepath, $a_origname="")