/**
  * Validate the uploaded file for virus/malware with ClamAV
  *
  * @param  $attribute  string
  * @param  $value       mixed
  * @param  $parameters array
  * @return boolean
  */
 public function validateClamav($attribute, $value, $parameters)
 {
     $file = $this->getFilePath($value);
     $clamavSocket = $this->getClamavSocket();
     // Create a new socket instance
     $socket = (new Factory())->createClient($clamavSocket);
     // Create a new instance of the Client
     $quahog = new Client($socket);
     // Scan the file
     $result = $quahog->scanFile($file);
     // Check if scan result is not clean
     if (self::CLAMAV_STATUS_OK != $result['status']) {
         return false;
     }
     return true;
 }
Exemple #2
0
 public function testShutdown()
 {
     $result = $this->quahog->shutdown();
     $this->assertSame('', $result);
 }