ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilVirusScannerICapRemoteAvClient Class Reference
+ Inheritance diagram for ilVirusScannerICapRemoteAvClient:
+ Collaboration diagram for ilVirusScannerICapRemoteAvClient:

Public Member Functions

 __construct (string $scan_command, string $clean_command)
 
 scanFile (string $file_path, string $org_name='')
 
- Public Member Functions inherited from ilVirusScannerICapRemote
 __construct (string $scan_command, string $clean_command)
 
 options (string $service)
 
 getRequest (string $method, string $service, array $body=[], array $headers=[])
 
 send (string $request)
 
 getLastSocketError ()
 
 respMod (string $service, array $body=[], array $headers=[])
 
 reqMod (string $service, array $body=[], array $headers=[])
 
- Public Member Functions inherited from ilVirusScanner
 __construct (string $scan_command, string $clean_command)
 
 scanBuffer (string $buffer)
 
 scanFile (string $file_path, string $org_name='')
 
 logScanResult ()
 
 cleanFile (string $file_path, string $org_name='')
 
 logCleanResult ()
 
 fileCleaned ()
 
 getScanResult ()
 
 getCleanResult ()
 
 getScanMessage ()
 
 getCleanMessage ()
 
 getScanZipFiles ()
 

Protected Member Functions

 analyseHeader (array $header)
 
- Protected Member Functions inherited from ilVirusScanner
 scanFileFromBuffer (string $buffer)
 
 createBufferFile (string $buffer)
 
 removeBufferFile (string $bufferFile)
 

Private Attributes

const HEADER = 'headers'
 
const HEADER_VIOLATION_FOUND = 'X-Violations-Found'
 
const HEADER_INFECTION_FOUND = 'X-Infection-Found'
 

Additional Inherited Members

- Static Public Member Functions inherited from ilVirusScanner
static virusHandling (string $a_file, string $a_orig_name='', bool $a_clean=true)
 
- Data Fields inherited from ilVirusScannerICapRemote
string $userAgent = 'PHP-CLIENT/0.1.0'
 
- Data Fields inherited from ilVirusScanner
string $type
 
bool $scanZipFiles
 
string $scanCommand
 
string $cleanCommand
 
string $scanFilePath
 
string $scanFileOrigName
 
string $cleanFilePath
 
string $cleanFileOrigName
 
bool $scanFileIsInfected
 
bool $cleanFileIsCleaned
 
string $scanResult
 
string $cleanResult
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilLogger $log
 

Detailed Description

Definition at line 21 of file class.ilVirusScannerICapRemoteAvClient.php.

Constructor & Destructor Documentation

◆ __construct()

ilVirusScannerICapRemoteAvClient::__construct ( string  $scan_command,
string  $clean_command 
)

Reimplemented from ilVirusScannerICapRemote.

Definition at line 27 of file class.ilVirusScannerICapRemoteAvClient.php.

28 {
29 parent::__construct($scan_command, $clean_command);
30 $this->options(IL_ICAP_AV_COMMAND);
31 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and ilVirusScannerICapRemote\options().

+ Here is the call graph for this function:

Member Function Documentation

◆ analyseHeader()

ilVirusScannerICapRemoteAvClient::analyseHeader ( array  $header)
protected

Definition at line 57 of file class.ilVirusScannerICapRemoteAvClient.php.

57 : bool
58 {
59 $virus_found = false;
60 if (array_key_exists(self::HEADER, $header)) {
61 $header = $header[self::HEADER];
62 if (array_key_exists(self::HEADER_VIOLATION_FOUND, $header) && $header[self::HEADER_VIOLATION_FOUND] > 0) {
63 $virus_found = true;
64 }
65 if (array_key_exists(
66 self::HEADER_INFECTION_FOUND,
67 $header
68 ) && $header[self::HEADER_INFECTION_FOUND] !== '') {
69 $infection_split = explode(';', $header[self::HEADER_INFECTION_FOUND]);
70 foreach ($infection_split as $infection) {
71 $parts = explode('=', $infection);
72 if ($parts !== false &&
73 is_array($parts) &&
74 count($parts) > 0 &&
75 $parts[0] !== '') {
76 $this->log->warning(trim($parts[0]) . ': ' . trim($parts[1]));
77 }
78 }
79 $virus_found = true;
80 }
81 }
82
83 return $virus_found;
84 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61

References $parts, and HEADER.

Referenced by scanFile().

+ Here is the caller graph for this function:

◆ scanFile()

ilVirusScannerICapRemoteAvClient::scanFile ( string  $file_path,
string  $org_name = '' 
)

Reimplemented from ilVirusScanner.

Definition at line 33 of file class.ilVirusScannerICapRemoteAvClient.php.

33 : string
34 {
35 $return_string = '';
36 $file_path = realpath($file_path);
37 if (is_readable($file_path)) {
38 $results = ($this->reqmod(
39 'avscan',
40 [
41 'req-hdr' => "POST /test HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n",
42 'req-body' => file_get_contents($file_path) //Todo: find a better way
43 ]
44 ));
45 if ($this->analyseHeader($results)) {
46 $return_string = sprintf('Virus found in file "%s"!', $file_path);
47 $this->log->warning($return_string);
48 }
49 } else {
50 $return_string = sprintf('File "%s" not found or not readable.', $file_path);
51 $this->log->warning($return_string);
52 }
53 $this->log->info(sprintf('No virus found in file "%s".', $file_path));
54 return $return_string;
55 }
$results

References $results, and analyseHeader().

+ Here is the call graph for this function:

Field Documentation

◆ HEADER

const ilVirusScannerICapRemoteAvClient::HEADER = 'headers'
private

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

Referenced by analyseHeader().

◆ HEADER_INFECTION_FOUND

const ilVirusScannerICapRemoteAvClient::HEADER_INFECTION_FOUND = 'X-Infection-Found'
private

Definition at line 25 of file class.ilVirusScannerICapRemoteAvClient.php.

◆ HEADER_VIOLATION_FOUND

const ilVirusScannerICapRemoteAvClient::HEADER_VIOLATION_FOUND = 'X-Violations-Found'
private

Definition at line 24 of file class.ilVirusScannerICapRemoteAvClient.php.


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