Skip to content

Instantly share code, notes, and snippets.

@milendyankov
Last active June 12, 2020 19:22
Show Gist options
  • Save milendyankov/5b8b6b60b70e1e6b2ed4f6b732d7d66f to your computer and use it in GitHub Desktop.
Save milendyankov/5b8b6b60b70e1e6b2ed4f6b732d7d66f to your computer and use it in GitHub Desktop.
import com.liferay.portal.util.PropsValues;
import com.liferay.document.library.kernel.antivirus.AntivirusScannerUtil
import com.liferay.document.library.kernel.antivirus.AntivirusScannerWrapper;
println "[config] Antivirus implementation: " + PropsValues.DL_STORE_ANTIVIRUS_IMPL
println "[config] Antivirus enabled: " + PropsValues.DL_STORE_ANTIVIRUS_ENABLED
println "[util] Antivirus scanner: " + AntivirusScannerUtil.getAntivirusScanner().getClass().getName()
println "[util] Antivirus enabled: " + AntivirusScannerUtil.isActive()
print "Test clean scan: "
try {
AntivirusScannerUtil.scan("Good".getBytes())
println "OK"
} catch(Exception e) {
println "FAILED"
println(e);
}
print "Test virus scan: "
try {
AntivirusScannerUtil.scan("X5O!P%@AP[4\\PZX54(P^)7CC)7}\$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!\$H+H*".getBytes())
println("DIDN'T CATCH TEST VIRUS");
} catch(Exception e) {
println(e.getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment