From 78625f482f619ab04c018b6cecb06ef249fde467 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Tue, 13 Feb 2018 14:54:58 -0500 Subject: [PATCH] Added reset for out of range values. --- .../EncryptionDetectionFileIngestModule.java | 6 ++--- ...yptionDetectionIngestJobSettingsPanel.java | 25 +++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java index 5e1c962db0..685f85f6b2 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java @@ -50,9 +50,9 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter static final boolean DEFAULT_CONFIG_FILE_SIZE_MULTIPLE_ENFORCED = true; static final boolean DEFAULT_CONFIG_SLACK_FILES_ALLOWED = true; - private static final double MINIMUM_ENTROPY_INPUT_RANGE_MIN = 6.0; - private static final double MINIMUM_ENTROPY_INPUT_RANGE_MAX = 8.0; - private static final int MINIMUM_FILE_SIZE_INPUT_RANGE_MIN = 1; + static final double MINIMUM_ENTROPY_INPUT_RANGE_MIN = 6.0; + static final double MINIMUM_ENTROPY_INPUT_RANGE_MAX = 8.0; + static final int MINIMUM_FILE_SIZE_INPUT_RANGE_MIN = 1; private static final int FILE_SIZE_MODULUS = 512; private static final double ONE_OVER_LOG2 = 1.4426950408889634073599246810019; // (1 / log(2)) diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java index e1165a61a5..80a201f2d1 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionIngestJobSettingsPanel.java @@ -25,6 +25,11 @@ import javax.swing.text.DefaultFormatterFactory; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; +import static org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionFileIngestModule.DEFAULT_CONFIG_MINIMUM_ENTROPY; +import static org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionFileIngestModule.DEFAULT_CONFIG_MINIMUM_FILE_SIZE; +import static org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionFileIngestModule.MINIMUM_ENTROPY_INPUT_RANGE_MAX; +import static org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionFileIngestModule.MINIMUM_ENTROPY_INPUT_RANGE_MIN; +import static org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionFileIngestModule.MINIMUM_FILE_SIZE_INPUT_RANGE_MIN; /** * Ingest job settings panel for the Encryption Detection module. @@ -55,8 +60,24 @@ final class EncryptionDetectionIngestJobSettingsPanel extends IngestModuleIngest * @param settings The ingest job settings. */ private void customizeComponents(EncryptionDetectionIngestJobSettings settings) { - minimumEntropyTextbox.setText(String.valueOf(settings.getMinimumEntropy())); - minimumFileSizeTextbox.setText(String.valueOf(settings.getMinimumFileSize() / MEGABYTE_SIZE)); + /* + * If minimum entropy is out of range, reset it to the default. + */ + double minimumEntropy = settings.getMinimumEntropy(); + if (minimumEntropy < MINIMUM_ENTROPY_INPUT_RANGE_MIN || minimumEntropy > MINIMUM_ENTROPY_INPUT_RANGE_MAX) { + minimumEntropy = DEFAULT_CONFIG_MINIMUM_ENTROPY; + } + minimumEntropyTextbox.setText(String.valueOf(minimumEntropy)); + + /* + * If minimum file size is out of range, reset it to the default. + */ + int minimumFileSize = settings.getMinimumFileSize(); + if (minimumFileSize < MINIMUM_FILE_SIZE_INPUT_RANGE_MIN) { + minimumFileSize = DEFAULT_CONFIG_MINIMUM_FILE_SIZE; + } + minimumFileSizeTextbox.setText(String.valueOf(minimumFileSize / MEGABYTE_SIZE)); + fileSizeMultiplesEnforcedCheckbox.setSelected(settings.isFileSizeMultipleEnforced()); slackFilesAllowedCheckbox.setSelected(settings.isSlackFilesAllowed()); }