Last active
June 12, 2020 19:22
-
-
Save milendyankov/5b8b6b60b70e1e6b2ed4f6b732d7d66f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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