Package de.xima.fc.security.malware
Class MalwareScanner
java.lang.Object
de.xima.fc.security.malware.MalwareScanner
Utility class that scans files and data for malware.
- Since:
- 7.0.13
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic MalwareScannerforClientScope(Mandant client) Creates a malware scanner that includes client-scoped malware plugins.static MalwareScannerforClientScope(UUID clientUuid) Creates a malware scanner that includes client-scoped malware plugins.static MalwareScannerforScope(WorkspaceScope scope) Creates a malware scanner for the given workspace scope.static MalwareScannerCreates a malware scanner that only includes system-scoped malware plugins.scanBase64Data(String base64EncodedData) Scans a base64 encoded string with data for malware and returns a report with the scan result.scanData(byte[] data) Scans some data for malware and returns a report with the scan result.Scans a file for malware and returns a report with the scan result.Scans a file for malware and returns a report with the scan result.scanFileItem(org.apache.commons.fileupload.FileItem fileItem, boolean deleteOnMalware) Scans a file item for malware and returns a report with the scan result.scanStream(InputStream inputStream) Scans some data for malware and returns a report with the scan result.scanUploadedFile(org.primefaces.model.file.UploadedFile uploadedFile, boolean deleteOnMalware) Scans a file item for malware and returns a report with the scan result.
-
Method Details
-
scanBase64Data
Scans a base64 encoded string with data for malware and returns a report with the scan result. Note that this method may not create a file on the file system when the malware plugin supports stream scanning.- Parameters:
base64EncodedData- Raw data to scan.- Returns:
- A report with the result of the malware scan.
-
scanData
Scans some data for malware and returns a report with the scan result. Note that this method may not create a file on the file system when the malware plugin supports stream scanning.- Parameters:
data- Raw data to scan.- Returns:
- A report with the result of the malware scan.
-
scanFile
Scans a file for malware and returns a report with the scan result.- Parameters:
file- A file to scan.deleteOnMalware- Iftrue, the file is deleted immediately once malware was found.- Returns:
- A report with the result of the malware scan.
-
scanFile
Scans a file for malware and returns a report with the scan result.- Parameters:
file- A file to scan.deleteOnMalware- Iftrue, the file is deleted immediately once malware was found.- Returns:
- A report with the result of the malware scan. Use
MalwareScanReport.isSafe()to check whether the file may contain malware.
-
scanFileItem
public MalwareScanReport scanFileItem(org.apache.commons.fileupload.FileItem fileItem, boolean deleteOnMalware) Scans a file item for malware and returns a report with the scan result.- Parameters:
fileItem- A file to scan.deleteOnMalware- Iftrue, the file is deleted immediately once malware was found.- Returns:
- A report with the result of the malware scan.
-
scanStream
Scans some data for malware and returns a report with the scan result. Note that this method may not create a file on the file system when the malware plugin supports stream scanning.- Parameters:
inputStream- Input stream with the data to scan. The input stream must be closed externally.- Returns:
- A report with the result of the malware scan.
-
scanUploadedFile
public MalwareScanReport scanUploadedFile(org.primefaces.model.file.UploadedFile uploadedFile, boolean deleteOnMalware) Scans a file item for malware and returns a report with the scan result.- Parameters:
uploadedFile- A file to scan.deleteOnMalware- Iftrue, the file is deleted immediately once malware was found.- Returns:
- A report with the result of the malware scan.
-
forClientScope
Creates a malware scanner that includes client-scoped malware plugins.- Parameters:
client- Client scope to use.- Returns:
- A new malware scanner.
-
forClientScope
Creates a malware scanner that includes client-scoped malware plugins.- Parameters:
clientUuid- Client scope to use.- Returns:
- A new malware scanner.
-
forScope
Creates a malware scanner for the given workspace scope. For system scopes, the malware scanner considers only system-scoped malware plugins. For client scopes, it considers system plugin and plugin within the scope of that client.- Parameters:
scope- Scope for which to get a malware scanner.- Returns:
- A new malware scanner.
-
forSystemScope
Creates a malware scanner that only includes system-scoped malware plugins.- Returns:
- A new malware scanner.
-