From 4668d151c120e7341a46bd4d6eb9fdf3abb3e355 Mon Sep 17 00:00:00 2001 From: Ann Priestman Date: Mon, 3 Dec 2018 07:21:09 -0500 Subject: [PATCH] Adding missing settings panel --- .../dataSourceIntegrity/Bundle.properties | 6 +- .../DataSourceIntegrityIngestModule.java | 2 +- .../DataSourceIntegrityIngestSettings.java | 96 ++++++++++++++ ...ataSourceIntegrityIngestSettingsPanel.form | 83 ++++++++++++ ...ataSourceIntegrityIngestSettingsPanel.java | 120 ++++++++++++++++++ .../DataSourceIntegrityModuleFactory.java | 14 +- 6 files changed, 310 insertions(+), 11 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettings.java create mode 100644 Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.form create mode 100644 Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.java diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/Bundle.properties index fe77c40832..234b75cd78 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/Bundle.properties @@ -13,7 +13,7 @@ EwfVerifyIngestModule.shutDown.verifyResultsHeader=

Data Source Verification R EwfVerifyIngestModule.shutDown.resultLi=

  • Result\:{0}
  • EwfVerifyIngestModule.shutDown.calcHashLi=
  • Calculated hash\: {0}
  • EwfVerifyIngestModule.shutDown.storedHashLi=
  • Stored hash\: {0}
  • -IngestSettingsPanel.verifyHashesCheckbox.text=Verify existing data source hashes IngestSettingsPanel.computeHashesCheckbox.text=Calculate data source hashes if none are present -IngestSettingsPanel.jLabel3.text=Ingest Settings -IngestSettingsPanel.jLabel1.text=Note that this module will not run on logical files +DataSourceIntegrityIngestSettingsPanel.jLabel1.text=Note that this module will not run on logical files +DataSourceIntegrityIngestSettingsPanel.jLabel3.text=Ingest Settings +DataSourceIntegrityIngestSettingsPanel.verifyHashesCheckbox.text=Verify existing data source hashes diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java index 8b93d00f8f..4432b327e4 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java @@ -56,7 +56,7 @@ public class DataSourceIntegrityIngestModule implements DataSourceIngestModule { private IngestJobContext context; - DataSourceIntegrityIngestModule(IngestSettings settings) { + DataSourceIntegrityIngestModule(DataSourceIntegrityIngestSettings settings) { computeHashes = settings.shouldComputeHashes(); verifyHashes = settings.shouldVerifyHashes(); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettings.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettings.java new file mode 100644 index 0000000000..e5e4bf3d50 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettings.java @@ -0,0 +1,96 @@ +/* + * Central Repository + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.modules.dataSourceIntegrity; + +import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; + +/** + * Ingest job settings for the E01 Verify module. + */ +final class DataSourceIntegrityIngestSettings implements IngestModuleIngestJobSettings { + + private static final long serialVersionUID = 1L; + + static final boolean DEFAULT_COMPUTE_HASHES = true; + static final boolean DEFAULT_VERIFY_HASHES = true; + + private boolean computeHashes; + private boolean verifyHashes; + + /** + * Instantiate the ingest job settings with default values. + */ + DataSourceIntegrityIngestSettings() { + this.computeHashes = DEFAULT_COMPUTE_HASHES; + this.verifyHashes = DEFAULT_VERIFY_HASHES; + } + + /** + * Instantiate the ingest job settings. + * + * @param computeHashes Compute hashes if none are present + * @param verifyHashes Verify hashes if any are present + */ + DataSourceIntegrityIngestSettings(boolean computeHashes, boolean verifyHashes) { + this.computeHashes = computeHashes; + this.verifyHashes = verifyHashes; + } + + @Override + public long getVersionNumber() { + return serialVersionUID; + } + + /** + * Should hashes be computed if none are present? + * + * @return true if hashes should be computed, false otherwise + */ + boolean shouldComputeHashes() { + return computeHashes; + } + + /** + * Set whether hashes should be computed. + * + * @param computeHashes true if hashes should be computed + */ + void setComputeHashes(boolean computeHashes) { + this.computeHashes = computeHashes; + } + + + /** + * Should hashes be verified if at least one is present? + * + * @return true if hashes should be verified, false otherwise + */ + boolean shouldVerifyHashes() { + return verifyHashes; + } + + /** + * Set whether hashes should be verified. + * + * @param verifyHashes true if hashes should be verified + */ + void setVerifyHashes(boolean verifyHashes) { + this.verifyHashes = verifyHashes; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.form new file mode 100644 index 0000000000..1d1d8af13d --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.form @@ -0,0 +1,83 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.java new file mode 100644 index 0000000000..079c9a8507 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestSettingsPanel.java @@ -0,0 +1,120 @@ +/* + * Central Repository + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.modules.dataSourceIntegrity; + +import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; + +/** + * Ingest job settings panel for the Correlation Engine module. + */ +@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives +final class DataSourceIntegrityIngestSettingsPanel extends IngestModuleIngestJobSettingsPanel { + + /** + * Creates new form IngestSettingsPanel + */ + public DataSourceIntegrityIngestSettingsPanel(DataSourceIntegrityIngestSettings settings) { + initComponents(); + customizeComponents(settings); + } + + /** + * Update components with values from the ingest job settings. + * + * @param settings The ingest job settings. + */ + private void customizeComponents(DataSourceIntegrityIngestSettings settings) { + computeHashesCheckbox.setSelected(settings.shouldComputeHashes()); + verifyHashesCheckbox.setSelected(settings.shouldVerifyHashes()); + } + + @Override + public IngestModuleIngestJobSettings getSettings() { + return new DataSourceIntegrityIngestSettings(computeHashesCheckbox.isSelected(), verifyHashesCheckbox.isSelected()); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + computeHashesCheckbox = new javax.swing.JCheckBox(); + verifyHashesCheckbox = new javax.swing.JCheckBox(); + jLabel3 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + + org.openide.awt.Mnemonics.setLocalizedText(computeHashesCheckbox, org.openide.util.NbBundle.getMessage(DataSourceIntegrityIngestSettingsPanel.class, "DataSourceIntegrityIngestSettingsPanel.computeHashesCheckbox.text")); // NOI18N + computeHashesCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + computeHashesCheckboxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(verifyHashesCheckbox, org.openide.util.NbBundle.getMessage(DataSourceIntegrityIngestSettingsPanel.class, "DataSourceIntegrityIngestSettingsPanel.verifyHashesCheckbox.text")); // NOI18N + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(DataSourceIntegrityIngestSettingsPanel.class, "DataSourceIntegrityIngestSettingsPanel.jLabel3.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(DataSourceIntegrityIngestSettingsPanel.class, "DataSourceIntegrityIngestSettingsPanel.jLabel1.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(20, 20, 20) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(verifyHashesCheckbox) + .addComponent(computeHashesCheckbox) + .addComponent(jLabel3)) + .addContainerGap(115, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(computeHashesCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(verifyHashesCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel1) + .addContainerGap(198, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void computeHashesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_computeHashesCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_computeHashesCheckboxActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox computeHashesCheckbox; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel3; + private javax.swing.JCheckBox verifyHashesCheckbox; + // End of variables declaration//GEN-END:variables + +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityModuleFactory.java index 7747ffc6b7..cb32d2788b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityModuleFactory.java @@ -63,14 +63,14 @@ public class DataSourceIntegrityModuleFactory extends IngestModuleFactoryAdapter @Override public DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings settings) { - if (settings instanceof IngestSettings) { - return new DataSourceIntegrityIngestModule((IngestSettings) settings); + if (settings instanceof DataSourceIntegrityIngestSettings) { + return new DataSourceIntegrityIngestModule((DataSourceIntegrityIngestSettings) settings); } /* * Compatibility check for older versions. */ if (settings instanceof NoIngestModuleIngestJobSettings) { - return new DataSourceIntegrityIngestModule(new IngestSettings()); + return new DataSourceIntegrityIngestModule(new DataSourceIntegrityIngestSettings()); } throw new IllegalArgumentException("Expected settings argument to be an instance of IngestSettings"); @@ -78,7 +78,7 @@ public class DataSourceIntegrityModuleFactory extends IngestModuleFactoryAdapter @Override public IngestModuleIngestJobSettings getDefaultIngestJobSettings() { - return new IngestSettings(); + return new DataSourceIntegrityIngestSettings(); } @Override @@ -88,14 +88,14 @@ public class DataSourceIntegrityModuleFactory extends IngestModuleFactoryAdapter @Override public IngestModuleIngestJobSettingsPanel getIngestJobSettingsPanel(IngestModuleIngestJobSettings settings) { - if (settings instanceof IngestSettings) { - return new IngestSettingsPanel((IngestSettings) settings); + if (settings instanceof DataSourceIntegrityIngestSettings) { + return new DataSourceIntegrityIngestSettingsPanel((DataSourceIntegrityIngestSettings) settings); } /* * Compatibility check for older versions. */ if (settings instanceof NoIngestModuleIngestJobSettings) { - return new IngestSettingsPanel(new IngestSettings()); + return new DataSourceIntegrityIngestSettingsPanel(new DataSourceIntegrityIngestSettings()); } throw new IllegalArgumentException("Expected settings argument to be an instance of IngestSettings");