19 package org.sleuthkit.autopsy.modules.embeddedfileextractor;
22 import java.nio.file.Paths;
23 import java.util.concurrent.ConcurrentHashMap;
24 import org.openide.util.NbBundle;
31 import net.sf.sevenzipjbinding.SevenZipNativeInitializationException;
42 "CannotCreateOutputFolder=Unable to create output folder.",
43 "CannotRunFileTypeDetection=Unable to run file type detection.",
44 "UnableToInitializeLibraries=Unable to initialize 7Zip libraries.",
45 "EmbeddedFileExtractorIngestModule.NoOpenCase.errMsg=No open case available.",
46 "EmbeddedFileExtractorIngestModule.UnableToGetMSOfficeExtractor.errMsg=Unable to get MSOfficeEmbeddedContentExtractor."
51 private static final ConcurrentHashMap<Long, ConcurrentHashMap<Long, Archive>> mapOfDepthTrees =
new ConcurrentHashMap<>();
73 jobId = context.getJobId();
74 String moduleDirRelative = null;
75 String moduleDirAbsolute = null;
87 File extractionDirectory =
new File(moduleDirAbsolute);
88 if (!extractionDirectory.exists()) {
90 extractionDirectory.mkdirs();
91 }
catch (SecurityException ex) {
105 this.archiveExtractor =
new SevenZipExtractor(context, fileTypeDetector, moduleDirRelative, moduleDirAbsolute);
106 }
catch (SevenZipNativeInitializationException ex) {
114 mapOfDepthTrees.put(jobId,
new ConcurrentHashMap<>());
121 this.officeExtractor =
new MSOfficeEmbeddedContentExtractor(context, fileTypeDetector, moduleDirRelative, moduleDirAbsolute);
123 throw new IngestModuleException(Bundle.EmbeddedFileExtractorIngestModule_UnableToGetMSOfficeExtractor_errMsg(), ex);
133 if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS))
134 || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) {
141 if (abstractFile.getKnown().equals(TskData.FileKnown.KNOWN)) {
148 if (!abstractFile.isFile()) {
156 if (archiveExtractor.isSevenZipExtractionSupported(abstractFile)) {
157 archiveExtractor.unpack(abstractFile, mapOfDepthTrees.get(jobId));
158 }
else if (officeExtractor.isContentExtractionSupported(abstractFile)) {
159 officeExtractor.extractEmbeddedContent(abstractFile);
167 mapOfDepthTrees.remove(jobId);
179 static String getUniqueName(AbstractFile file) {
180 return file.getName() +
"_" + file.getId();
String getModuleOutputDirectoryRelativePath()
synchronized long decrementAndGet(long jobId)
synchronized long incrementAndGet(long jobId)
String getModuleDirectory()
static Case getCurrentCaseThrows()