19 package org.sleuthkit.autopsy.modules.fileextmismatch;
 
   21 import java.io.IOException;
 
   22 import java.io.ObjectInputStream;
 
   24 import java.util.stream.Collectors;
 
   25 import java.util.stream.Stream;
 
   31 final class FileExtMismatchDetectorModuleSettings 
implements IngestModuleIngestJobSettings {
 
   33     private static final long serialVersionUID = 1L;
 
   34     private long versionNumber;
 
   35     private boolean skipFilesWithNoExtension;
 
   37     private boolean skipFilesWithTextPlainMimeType; 
 
   38     private boolean skipKnownFiles;
 
   39     private CHECK_TYPE checkType;
 
   46         ALL, NO_TEXT_FILES, ONLY_MEDIA_AND_EXE
 
   53     static final Set<String> MEDIA_AND_EXE_MIME_TYPES = Stream.of(
 
   60             "application/dos-exe",
 
   62             "application/x-dosexec",
 
   64             "application/x-msdownload",
 
   68             "application/vnd.ms-excel",
 
   69             "application/vnd.ms-powerpoint",
 
   70             "application/vnd.oasis.opendocument.presentation",
 
   71             "application/vnd.oasis.opendocument.spreadsheet",
 
   72             "application/vnd.oasis.opendocument.text",
 
   73             "application/x-msoffice",
 
   74             "application/x-ooxml",
 
   75             "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
 
   76             "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
 
   77             "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
 
   78             "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
 
   79             "application/vnd.openxmlformats-officedocument.presentationml.presentation",
 
   80             "application/vnd.openxmlformats-officedocument.presentationml.template",
 
   81             "application/vnd.openxmlformats-officedocument.presentationml.slideshow" 
   82     ).collect(Collectors.toSet());
 
   88     FileExtMismatchDetectorModuleSettings() {
 
   89         this.versionNumber = 2;
 
   90         this.skipFilesWithNoExtension = 
true;
 
   91         this.skipKnownFiles = 
true;
 
   92         this.checkType = CHECK_TYPE.ONLY_MEDIA_AND_EXE;
 
  101     public long getVersionNumber() {
 
  102         return serialVersionUID;
 
  111     void setSkipFilesWithNoExtension(
boolean skipFilesWithNoExtension) {
 
  112         this.skipFilesWithNoExtension = skipFilesWithNoExtension;
 
  121     boolean skipFilesWithNoExtension() {
 
  122         return skipFilesWithNoExtension;
 
  131     void setSkipKnownFiles(
boolean skipKnownFiles) {
 
  132         this.skipKnownFiles = skipKnownFiles;
 
  141     boolean skipKnownFiles() {
 
  142         return skipKnownFiles;
 
  151     void setCheckType(CHECK_TYPE checkType) {
 
  152         this.checkType = checkType;
 
  161     CHECK_TYPE getCheckType() {
 
  177     private void readObject(ObjectInputStream in) 
throws IOException, ClassNotFoundException {
 
  178         in.defaultReadObject();
 
  179         if (0L == versionNumber) {
 
  185             skipKnownFiles = 
true;
 
  188         if (1 == versionNumber) {
 
  193             checkType = CHECK_TYPE.ONLY_MEDIA_AND_EXE;