Thanks for the superb script and tool. Makes me feel much better about my data and set up.
I made a minor adjustment to the script to change the $notify type in case there are infected files found the allowable values are normal|warning|alert for a green amber or red notification respectively...
it might help somebody...
#!/usr/bin/php
<?
$notify="normal";
exec('/usr/local/emhttp/plugins/dynamix/scripts/notify -e "Antivirus Scan Started" -s "Antivirus Scan" -d "Antivirus Scan Started" -i '.escapeshellarg($notify).'');
exec('docker start ClamAV');
for ( ;; ) {
$status = trim(exec("docker ps | grep ClamAV"));
if ( ! $status ) break;
sleep(60);
}
exec("docker logs ClamAV 2>/dev/null",$logs);
foreach ($logs as $line) {
$virus = explode(" ",$line);
if (trim(end($virus)) == "FOUND" ) {
$infected .= "$line\n";
$notify="warning";
}
}
if ( ! $infected ) {
$infected = "No infections found\n";
}
exec('/usr/local/emhttp/plugins/dynamix/scripts/notify -e "Antivirus Scan Finished" -s "Antivirus Scan" -d '.escapeshellarg($infected).' -i '.escapeshellarg($notify).'');
?>