Class SecureZipExtractor
java.lang.Object
ghidra.util.SecureZipExtractor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidextractSecurely(File zipFile, File targetDir, int maxFiles, TaskMonitor monitor) Securely extracts the given zip file to the given directorystatic voidextractSecurely(org.apache.commons.compress.archivers.zip.ZipFile archive, org.apache.commons.compress.archivers.zip.ZipArchiveEntry entry, File outputFile) Securely writes the given zip entry to the given output file.
-
Constructor Details
-
SecureZipExtractor
public SecureZipExtractor()
-
-
Method Details
-
extractSecurely
public static void extractSecurely(File zipFile, File targetDir, int maxFiles, TaskMonitor monitor) throws IOException, CancelledException Securely extracts the given zip file to the given directory- Parameters:
zipFile- The zipFileto extracttargetDir- The directory to unzip tomaxFiles- The maximum number of files that will be unzipped before anIOExceptionis thrownmonitor- A cancellableTaskMonitor- Throws:
IOException- if a zip slip, zip bomb, or other IO-related error occurredCancelledException- if the operation was cancelled
-
extractSecurely
public static void extractSecurely(org.apache.commons.compress.archivers.zip.ZipFile archive, org.apache.commons.compress.archivers.zip.ZipArchiveEntry entry, File outputFile) throws IOException Securely writes the given zip entry to the given output file. Assumes that the output file's directory exists.- Parameters:
archive- The originalZipFileto extract fromentry- Theentryto extractoutputFile- TheFileto extract the entry to- Throws:
IOException- if a zip bomb or other IO-related error occurred
-