19 package org.sleuthkit.autopsy.modules.embeddedfileextractor;
22 import java.nio.file.Paths;
23 import org.openide.util.NbBundle;
30 import net.sf.sevenzipjbinding.SevenZipNativeInitializationException;
39 "CannotCreateOutputFolder=Unable to create output folder.",
40 "CannotRunFileTypeDetection=Unable to run file type detection.",
41 "UnableToInitializeLibraries=Unable to initialize 7Zip libraries.",
42 "EmbeddedFileExtractorIngestModule.NoOpenCase.errMsg=No open case available.",
43 "EmbeddedFileExtractorIngestModule.UnableToGetMSOfficeExtractor.errMsg=Unable to get MSOfficeEmbeddedContentExtractor."
47 static final String[] SUPPORTED_EXTENSIONS = {
"zip",
"rar",
"arj",
"7z",
"7zip",
"gzip",
"gz",
"bzip2",
"tar",
"tgz",};
79 File extractionDirectory =
new File(moduleDirAbsolute);
80 if (!extractionDirectory.exists()) {
82 extractionDirectory.mkdirs();
83 }
catch (SecurityException ex) {
101 this.archiveExtractor =
new SevenZipExtractor(context, fileTypeDetector, moduleDirRelative, moduleDirAbsolute);
102 }
catch (SevenZipNativeInitializationException ex) {
111 this.officeExtractor =
new MSOfficeEmbeddedContentExtractor(context, fileTypeDetector, moduleDirRelative, moduleDirAbsolute);
113 throw new IngestModuleException(Bundle.EmbeddedFileExtractorIngestModule_UnableToGetMSOfficeExtractor_errMsg(), ex);
122 if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS))
123 || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) {
130 if (abstractFile.getKnown().equals(TskData.FileKnown.KNOWN)) {
137 if (!abstractFile.isFile()) {
145 if (archiveExtractor.isSevenZipExtractionSupported(abstractFile)) {
146 archiveExtractor.unpack(abstractFile);
147 }
else if (officeExtractor.isContentExtractionSupported(abstractFile)) {
148 officeExtractor.extractEmbeddedContent(abstractFile);
161 static String getUniqueName(AbstractFile file) {
162 return file.getName() +
"_" + file.getId();
String getModuleOutputDirectoryRelativePath()
static Case getOpenCase()
String getModuleDirectory()