From 05a1046ec34df554bf718f5f38dc9c02ea8730c4 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 27 Apr 2020 11:07:57 -0400 Subject: [PATCH 01/15] Implemented data source selection and updated the HTML and KML modules to respond to these selections --- .../CheckBoxJList.java | 4 +- .../CheckBoxListPanel.form | 6 +- .../CheckBoxListPanel.java | 24 ++-- .../autopsy/geolocation/GeoFilterPanel.java | 1 + .../geolocation/datamodel/GeoPath.java | 2 +- .../autopsy/report/GeneralReportModule.java | 32 ++++- .../autopsy/report/GeneralReportSettings.java | 40 ++++++ .../infrastructure/Bundle.properties-MERGED | 1 + .../infrastructure/FileReportSettings.java | 19 ++- .../infrastructure/ReportGenerator.java | 9 +- .../infrastructure/ReportVisualPanel1.java | 8 +- .../infrastructure/ReportWizardAction.java | 23 +++- .../ReportWizardDataSourceSelectionPanel.java | 125 ++++++++++++++++++ .../infrastructure/ReportWizardIterator.java | 21 ++- .../infrastructure/ReportWizardPanel1.java | 22 ++- .../infrastructure/ReportingConfig.java | 11 +- .../infrastructure/ReportingConfigLoader.java | 18 ++- .../infrastructure/TableReportGenerator.java | 42 +++++- .../infrastructure/TableReportSettings.java | 17 ++- .../modules/html/Bundle.properties-MERGED | 8 +- .../autopsy/report/modules/kml/KMLReport.java | 68 ++++++++-- 21 files changed, 441 insertions(+), 60 deletions(-) rename Core/src/org/sleuthkit/autopsy/{geolocation => corecomponents}/CheckBoxJList.java (97%) rename Core/src/org/sleuthkit/autopsy/{geolocation => corecomponents}/CheckBoxListPanel.form (88%) rename Core/src/org/sleuthkit/autopsy/{geolocation => corecomponents}/CheckBoxListPanel.java (94%) create mode 100755 Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java create mode 100755 Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java similarity index 97% rename from Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java rename to Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java index 7763d1a19a..3d360bb102 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.geolocation; +package org.sleuthkit.autopsy.corecomponents; import java.awt.BorderLayout; import java.awt.Component; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form similarity index 88% rename from Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form rename to Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form index 75fb1d4c62..bd65f2c17a 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form @@ -19,7 +19,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -46,7 +46,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java similarity index 94% rename from Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java rename to Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java index bf74ba1a56..2a87d429ef 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.geolocation; +package org.sleuthkit.autopsy.corecomponents; import java.util.ArrayList; import java.util.Enumeration; @@ -26,9 +26,9 @@ import javax.swing.DefaultListModel; import javax.swing.Icon; /** - * A panel for showing Content objects in a check box list. + * A panel for showing any object in a check box list. */ -final class CheckBoxListPanel extends javax.swing.JPanel { +public final class CheckBoxListPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; @@ -38,7 +38,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { /** * Creates new CheckboxFilterPanel */ - CheckBoxListPanel() { + public CheckBoxListPanel() { initComponents(); checkboxList = new CheckBoxJList<>(); @@ -52,7 +52,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { * @param displayName display name for the checkbox * @param obj Object that the checkbox represents */ - void addElement(String displayName, Icon icon, T obj) { + public void addElement(String displayName, Icon icon, T obj) { ObjectCheckBox newCheckBox = new ObjectCheckBox<>(displayName, icon, true, obj); if(!model.contains(newCheckBox)) { @@ -63,11 +63,11 @@ final class CheckBoxListPanel extends javax.swing.JPanel { /** * Remove all objects from the checkbox list. */ - void clearList() { + public void clearList() { model.removeAllElements(); } - boolean isEmpty() { + public boolean isEmpty() { return model.isEmpty(); } @@ -84,7 +84,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { * * @return List of selected elements. */ - List getSelectedElements() { + public List getSelectedElements() { List selectedElements = new ArrayList<>(); Enumeration> elements = model.elements(); @@ -103,7 +103,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { * * @param selected True to check the boxes, false to unchecked */ - void setSetAllSelected(boolean selected) { + public void setSetAllSelected(boolean selected) { Enumeration> enumeration = model.elements(); while (enumeration.hasMoreElements()) { ObjectCheckBox element = enumeration.nextElement(); @@ -119,7 +119,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { * * @param title Panel title or null for no title. */ - void setPanelTitle(String title) { + public void setPanelTitle(String title) { titleLabel.setText(title); } @@ -128,7 +128,7 @@ final class CheckBoxListPanel extends javax.swing.JPanel { * * @param icon Icon to set or null for no icon */ - void setPanelTitleIcon(Icon icon) { + public void setPanelTitleIcon(Icon icon) { titleLabel.setIcon(icon); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java index d8121e68a1..2641b5d4b0 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.geolocation; +import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel; import java.awt.Color; import java.awt.Graphics; import java.awt.GridBagConstraints; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoPath.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoPath.java index 99b5db351f..c61dea93be 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoPath.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoPath.java @@ -126,7 +126,7 @@ public class GeoPath { * * @return */ - final BlackboardArtifact getArtifact() { + public final BlackboardArtifact getArtifact() { return artifact; } diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java index da0541b48a..c7553c9d64 100644 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2018 Basis Technology Corp. + * Copyright 2012-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,10 +25,36 @@ public interface GeneralReportModule extends ReportModule { * at the path specified and updating progress via the progressPanel object. * * @param baseReportDir Base directory that reports are being stored in. - * Report should go into baseReportDir + - * getRelativeFilePath(). + * Report should go into baseReportDir + getRelativeFilePath(). * @param progressPanel panel to update the report's progress with */ public void generateReport(String baseReportDir, ReportProgressPanel progressPanel); + /** + * Determines if the module supports report generation on a subset of data + * sources in a case. Defaults to false. Modules that override this to true + * should implement all generateReport overloads. The data source selections + * are stored in the GeneralReportSettings instance. + * + * @return True if the module can be configured to run on a subset of data + * sources. + */ + default boolean supportsDataSourceSelection() { + return false; + } + + /** + * Called to generate the report. Method is responsible for saving the file + * at the path specified and updating progress via the progressPanel object. + * Configuration parameters can be passed in the settings class. Modules should + * try to respond to all configuration parameters. + * + * @param baseReportDir Base directory that reports are being stored in. + * Report should go into baseReportDir + getRelativeFilePath(). + * @param settings Configuration parameters to customize the report generation process + * @param progressPanel panel to update the report's progress with + */ + default void generateReport(String baseReportDir, GeneralReportSettings settings, ReportProgressPanel progressPanel) { + generateReport(baseReportDir, progressPanel); + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java new file mode 100755 index 0000000000..34c7b20139 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java @@ -0,0 +1,40 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2020 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.report; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * Configuration parameters for general report modules + */ +public class GeneralReportSettings implements Serializable { + private static final long serialVersionUID = 1L; + + private List dataSourcesToProcess; + + public List getDataSourcesToProcess() { + return dataSourcesToProcess; + } + + public void setDataSourcesToProcess(List dataSourcesToProcess) { + this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED index c3bca8db45..ef0fd25142 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED @@ -15,6 +15,7 @@ ReportProgressIndicator.completedWithErrorsMessage=Report generation completed w ReportProgressIndicator.startMessage=Report generation started ReportProgressIndicator.switchToDeterminateMessage=Report generation progress switched to determinate ReportProgressIndicator.switchToIndeterminateMessage=Report generation progress switched to indeterminate +ReportWizardDataSourceSelectionPanel.title=Select which datasource(s) to include ReportWizardFileOptionsVisualPanel.jLabel1.text=Select items to include in File Report: ReportWizardFileOptionsVisualPanel.deselectAllButton.text=Deselect All ReportWizardFileOptionsVisualPanel.selectAllButton.text=Select All diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java index 8cde112672..c211b02244 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,9 @@ package org.sleuthkit.autopsy.report.infrastructure; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -30,6 +32,7 @@ final class FileReportSettings implements Serializable { private static final long serialVersionUID = 1L; private Map filePropertiesInfo = new HashMap<>(); + private List dataSourcesToProcess; /** * Creates FileReportSettings object. @@ -49,4 +52,18 @@ final class FileReportSettings implements Serializable { Map getFileProperties() { return filePropertiesInfo; } + + /** + * Returns the data sources to process + */ + List getDataSourcesToProcess() { + return dataSourcesToProcess; + } + + /** + * Sets the data sources to process + */ + void setDataSourcesToProcess(List dataSourcesToProcess) { + this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index 04c5413641..022b2a8667 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2019 Basis Technology Corp. + * Copyright 2013-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,6 +48,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; import org.sleuthkit.datamodel.AbstractFile; @@ -208,7 +209,7 @@ public class ReportGenerator { if (module instanceof GeneralReportModule) { // generate report - generateGeneralReport((GeneralReportModule) module); + generateGeneralReport((GeneralReportModule) module, config.getGeneralReportSettings()); } else if (module instanceof TableReportModule) { @@ -297,11 +298,11 @@ public class ReportGenerator { /** * Run the GeneralReportModules using a SwingWorker. */ - private void generateGeneralReport(GeneralReportModule generalReportModule) throws IOException { + private void generateGeneralReport(GeneralReportModule generalReportModule, GeneralReportSettings reportSettings) throws IOException { if (generalReportModule != null) { String reportDir = createReportDirectory(generalReportModule); setupProgressPanel(generalReportModule, reportDir); - generalReportModule.generateReport(reportDir, progressIndicator); + generalReportModule.generateReport(reportDir, reportSettings, progressIndicator); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel1.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel1.java index 7eca143b80..b9d9fc8b34 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel1.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2019 Basis Technology Corp. + * Copyright 2012-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -368,8 +368,10 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { configurationPanel.revalidate(); configurationPanel.repaint(); - boolean generalModuleSelected = (module instanceof GeneralReportModule); - + // General modules that support data source selection will be presented + // a data source selection panel, so they should not be finished immediately. + boolean generalModuleSelected = (module instanceof GeneralReportModule) && !((GeneralReportModule)module).supportsDataSourceSelection(); + wizPanel.setNext(!generalModuleSelected); wizPanel.setFinish(generalModuleSelected); } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java index 236263200a..28d1dfff86 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2012-2019 Basis Technology Corp. + * Copyright 2012-2020 Basis Technology Corp. * * Copyright 2012 42six Solutions. * Contact: aebadirad 42six com @@ -31,6 +31,7 @@ import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.text.MessageFormat; import java.util.EnumSet; +import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.logging.Level; @@ -52,6 +53,7 @@ import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.ReportModule; @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.report.infrastructure.ReportWizardAction") @@ -117,8 +119,23 @@ public final class ReportWizardAction extends CallableSystemAction implements Pr private static void saveReportingConfiguration(String configName, WizardDescriptor wiz) throws ReportConfigException { ReportingConfig reportingConfig = new ReportingConfig(configName); - reportingConfig.setFileReportSettings((FileReportSettings) wiz.getProperty("fileReportSettings")); - reportingConfig.setTableReportSettings((TableReportSettings) wiz.getProperty("tableReportSettings")); + List selectedDataSourceIds = (List) wiz.getProperty("dataSourceSelections"); + + // Set the selected data source ids. + FileReportSettings fileSettings = (FileReportSettings) wiz.getProperty("fileReportSettings"); + TableReportSettings tableSettings = (TableReportSettings) wiz.getProperty("tableReportSettings"); + GeneralReportSettings generalSettings = new GeneralReportSettings(); + generalSettings.setDataSourcesToProcess(selectedDataSourceIds); + if(fileSettings != null) { + fileSettings.setDataSourcesToProcess(selectedDataSourceIds); + } + if(tableSettings != null) { + tableSettings.setDataSourcesToProcess(selectedDataSourceIds); + } + + reportingConfig.setFileReportSettings(fileSettings); + reportingConfig.setTableReportSettings(tableSettings); + reportingConfig.setGeneralReportSettings(generalSettings); Map moduleConfigs = (Map) wiz.getProperty("moduleConfigs"); diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java new file mode 100755 index 0000000000..5a782ecc5c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java @@ -0,0 +1,125 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2020 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.report.infrastructure; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; +import java.util.logging.Level; +import javax.swing.JButton; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.NbPreferences; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Selection panel for modules that can report on a subset of data sources in a + * case. + */ +public class ReportWizardDataSourceSelectionPanel implements WizardDescriptor.FinishablePanel { + + private static final Logger logger = Logger.getLogger(ReportWizardDataSourceSelectionPanel.class.getName()); + + private CheckBoxListPanel dataSourcesSelectionPanel; + private WizardDescriptor wiz; + + private final JButton finishButton; + + public ReportWizardDataSourceSelectionPanel() { + finishButton = new JButton( + NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text")); + finishButton.setEnabled(false); + + finishButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + wiz.doFinishClick(); + } + }); + } + + @NbBundle.Messages({ + "ReportWizardDataSourceSelectionPanel.title=Select which datasource(s) to include" + }) + @Override + public CheckBoxListPanel getComponent() { + if (dataSourcesSelectionPanel == null) { + dataSourcesSelectionPanel = new CheckBoxListPanel<>(); + dataSourcesSelectionPanel.setPanelTitle(""); + dataSourcesSelectionPanel.setName(Bundle.ReportWizardDataSourceSelectionPanel_title()); + try { + List dataSources = Case.getCurrentCase().getDataSources(); + for (Content dataSource : dataSources) { + String dataSourceName = dataSource.getName(); + long dataSourceId = dataSource.getId(); + dataSourcesSelectionPanel.addElement(dataSourceName, null, dataSourceId); + } + } catch (TskCoreException ex) { + logger.log(Level.SEVERE, "Unable to get list of data sources from the case", ex); + } + } + return dataSourcesSelectionPanel; + } + + @Override + public HelpCtx getHelp() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + public void readSettings(WizardDescriptor data) { + this.wiz = data; + wiz.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, finishButton, WizardDescriptor.CANCEL_OPTION}); + + boolean generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS + finishButton.setEnabled(generalModule); + } + + @Override + public void storeSettings(WizardDescriptor data) { + List selectedDataSources = getComponent().getSelectedElements(); + data.putProperty("dataSourceSelections", selectedDataSources); + } + + @Override + public boolean isValid() { + return true; + } + + @Override + public void addChangeListener(ChangeListener cl) { + // Nothing to do + } + + @Override + public void removeChangeListener(ChangeListener cl) { + // Nothing to do + } + + @Override + public boolean isFinishPanel() { + return true; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java index d39db13392..726ce8a7a5 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012 Basis Technology Corp. + * Copyright 2012-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.report.infrastructure; import java.awt.Component; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; @@ -38,6 +39,7 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator> panels; @@ -78,8 +80,10 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator(panels); + panels.add(1, dataSourceSelectionPanel); + } } else if (portableCaseModule) { // Portable Case Module selected, need Portable Case Configuration Panel // (ReportWizardPortableCaseOptionsPanel) @@ -164,7 +174,8 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,8 @@ import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; -import org.sleuthkit.autopsy.report.ReportModule; +import org.sleuthkit.autopsy.report.GeneralReportModule; +import org.sleuthkit.autopsy.report.modules.html.HTMLReport; class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel { @@ -116,8 +117,21 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.report.infrastructure; import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import org.sleuthkit.autopsy.report.GeneralReportSettings; /** * A bundling of all the settings objects that define a report configuration. @@ -32,6 +33,7 @@ final class ReportingConfig implements Serializable { private Map moduleConfigs = new HashMap<>(); private TableReportSettings tableReportSettings; private FileReportSettings fileReportSettings; + private GeneralReportSettings generalReportSettings; /** * Creates ReportingConfig object. @@ -74,4 +76,11 @@ final class ReportingConfig implements Serializable { return this.fileReportSettings; } + GeneralReportSettings getGeneralReportSettings() { + return this.generalReportSettings; + } + + void setGeneralReportSettings(GeneralReportSettings generalReportSettings) { + this.generalReportSettings = generalReportSettings; + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java index 6472105888..7f1ee8fc87 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; +import org.sleuthkit.autopsy.report.GeneralReportSettings; /** * Utility class responsible for managing serialization and deserialization of @@ -48,6 +49,7 @@ final class ReportingConfigLoader { private static final String REPORT_SETTINGS_FILE_EXTENSION = ".settings"; private static final String TABLE_REPORT_CONFIG_FILE = "TableReportSettings.settings"; private static final String FILE_REPORT_CONFIG_FILE = "FileReportSettings.settings"; + private static final String GENERAL_REPORT_CONFIG_FILE = "GeneralReportSettings.settings"; private static final String MODULE_CONFIG_FILE = "ModuleConfigs.settings"; /** @@ -96,6 +98,13 @@ final class ReportingConfigLoader { } catch (IOException | ClassNotFoundException ex) { throw new ReportConfigException("Unable to read file report settings " + filePath, ex); } + + filePath = reportDirPath.resolve(GENERAL_REPORT_CONFIG_FILE).toString(); + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath))) { + config.setGeneralReportSettings((GeneralReportSettings) in.readObject()); + } catch (IOException | ClassNotFoundException ex) { + throw new ReportConfigException("Unable to read general report settings " + filePath, ex); + } // read map of module configuration objects Map moduleConfigs = null; @@ -173,6 +182,13 @@ final class ReportingConfigLoader { } catch (IOException ex) { throw new ReportConfigException("Unable to save file report configuration " + filePath, ex); } + + filePath = pathToConfigDir.resolve(GENERAL_REPORT_CONFIG_FILE).toString(); + try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { + out.writeObject(reportConfig.getGeneralReportSettings()); + } catch (IOException ex) { + throw new ReportConfigException("Unable to save general report configuration " + filePath, ex); + } // save map of module configuration objects filePath = pathToConfigDir.toString() + File.separator + MODULE_CONFIG_FILE; diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java index aa4ceab7dc..4cd2b349cc 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2019 Basis Technology Corp. + * Copyright 2013-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -366,6 +366,18 @@ class TableReportGenerator { // Give the modules the rows for the content tags. for (ContentTag tag : tags) { + try { + long dataSourceId = tag.getContent().getDataSource().getId(); + // Skip tags that are not in the data sources list + if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + continue; + } + } catch (TskCoreException ex) { + errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetContentTags")); + logger.log(Level.SEVERE, "failed to get data source of content tag", ex); //NON-NLS + return; + } + // skip tags that we are not reporting on String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { @@ -446,6 +458,18 @@ class TableReportGenerator { // Give the modules the rows for the content tags. for (BlackboardArtifactTag tag : tags) { + try { + long dataSourceId = tag.getContent().getDataSource().getId(); + // Skip tags that are not in the data sources list + if (!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + continue; + } + } catch (TskCoreException ex) { + errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags")); + logger.log(Level.SEVERE, "failed to get data source of blackboard artifact tag", ex); //NON-NLS + return; + } + String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { continue; @@ -799,6 +823,11 @@ class TableReportGenerator { AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); + long dataSourceId = f.getDataSource().getId(); + // Skip files that are not in the data sources list + if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + continue; + } } } catch (TskCoreException ex) { errorList.add( @@ -956,6 +985,11 @@ class TableReportGenerator { AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); + long dataSourceId = f.getDataSource().getId(); + // Skip files that are not in the data sources list. + if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + continue; + } } } catch (TskCoreException ex) { errorList.add( @@ -1198,6 +1232,12 @@ class TableReportGenerator { List artifacts = new ArrayList<>(); try { for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { + long dataSourceId = artifact.getDataSource().getId(); + // Skip artifacts that are not in the data sources list + if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + continue; + } + List tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); HashSet uniqueTagNames = new HashSet<>(); for (BlackboardArtifactTag tag : tags) { diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportSettings.java index 1b482046ee..6f264ddd44 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportSettings.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,6 +45,7 @@ final class TableReportSettings implements Serializable { private final List tagNames = new ArrayList<>(); private final boolean useStoredTagsAndArtifactsLists; private final TableReportOption reportOption; + private List dataSourcesToProcess; /** * Creates TableReportSettings object. This constructor is used when user @@ -99,4 +100,18 @@ final class TableReportSettings implements Serializable { TableReportOption getSelectedReportOption() { return reportOption; } + + /** + * Returns the data sources to process + */ + List getDataSourcesToProcess() { + return dataSourcesToProcess; + } + + /** + * Sets the data sources to process + */ + void setDataSourcesToProcess(List dataSourcesToProcess) { + this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED index 0be7595111..3db1b822ea 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED @@ -5,18 +5,18 @@ ReportHTML.getName.text=HTML Report ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. -ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, -ReportHTML.writeIndex.seeSum=and the summary page for a case summary. +ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, +ReportHTML.writeIndex.seeSum=and the summary page for a case summary. ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.summary=Case Summary ReportHTML.writeSum.case=Case: ReportHTML.writeSum.caseNotes=Notes: ReportHTML.writeSum.caseNumber=Case Number: -ReportHTML.writeSum.caseNumImages=Number of Images: +ReportHTML.writeSum.caseNumImages=Number of data sources in case: ReportHTML.writeSum.examiner=Examiner: ReportHTML.writeSum.title=Case Summary -ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed! +ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed\! # # autopsy/test/scripts/regression.py._html_report_diff() uses reportGenOn.text, caseName, caseNum, # examiner as a regex signature to skip report.html and summary.html diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index c13f385ba3..3a201a3466 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -35,6 +35,7 @@ import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.List; import java.util.logging.Level; +import java.util.stream.Collectors; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.Namespace; @@ -49,9 +50,11 @@ import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.geolocation.datamodel.Track; import org.sleuthkit.autopsy.geolocation.datamodel.WaypointBuilder; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.SleuthkitCase; @@ -80,6 +83,8 @@ public final class KMLReport implements GeneralReportModule { private Element gpsSearchesFolder; private Element gpsTrackpointsFolder; private Element gpsTracksFolder; + + private GeneralReportSettings settings; private List waypointList = null; @@ -153,15 +158,21 @@ public final class KMLReport implements GeneralReportModule { this.waypointList = waypointList; generateReport(baseReportDir, progressPanel); } - + @Override - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + public boolean supportsDataSourceSelection() { + return true; + } + + @Override + public void generateReport(String baseReportDir, GeneralReportSettings settings, ReportProgressPanel progressPanel) { try { currentCase = Case.getCurrentCaseThrows(); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return; } + this.settings = settings; // Start the progress bar and setup the report progressPanel.setIndeterminate(true); progressPanel.start(); @@ -181,7 +192,7 @@ public final class KMLReport implements GeneralReportModule { makeRoutes(skCase); makeTracks(skCase); addLocationsToReport(skCase, baseReportDir); - } catch (GeoLocationDataException | IOException ex) { + } catch (GeoLocationDataException | IOException | TskCoreException ex) { errorMessage = "Failed to complete report."; logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS result = ReportProgressPanel.ReportStatus.ERROR; @@ -225,6 +236,23 @@ public final class KMLReport implements GeneralReportModule { progressPanel.complete(result, errorMessage); } + @Override + public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + try { + GeneralReportSettings settings = new GeneralReportSettings(); + currentCase = Case.getCurrentCaseThrows(); + // Process all data sources if none are provided. + List selections = currentCase.getDataSources() + .stream() + .map(Content::getId) + .collect(Collectors.toList()); + settings.setDataSourcesToProcess(selections); + generateReport(baseReportDir, settings, progressPanel); + } catch (NoCurrentCaseException | TskCoreException ex) { + logger.log(Level.SEVERE, "Exception while accessing case resources.", ex); //NON-NLS + } + } + /** * Do all of the setting up of elements needed for the report. * @@ -318,8 +346,14 @@ public final class KMLReport implements GeneralReportModule { * * @throws IOException */ - void addExifMetadataContent(List points, String baseReportDirectory) throws IOException { + void addExifMetadataContent(List points, String baseReportDirectory) throws IOException, TskCoreException { for (Waypoint point : points) { + long pointDataSource = point.getArtifact().getDataSource().getId(); + // Skip this point if its not in the data sources list. + if(!settings.getDataSourcesToProcess().contains(pointDataSource)) { + continue; + } + Element mapPoint = makePoint(point); if (mapPoint == null) { return; @@ -352,7 +386,7 @@ public final class KMLReport implements GeneralReportModule { * @throws TskCoreException * @throws IOException */ - void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException { + void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException, TskCoreException { if (waypointList == null) { addExifMetadataContent(WaypointBuilder.getEXIFWaypoints(skCase), baseReportDir); addWaypoints(WaypointBuilder.getBookmarkWaypoints(skCase), gpsBookmarksFolder, FeatureColor.BLUE, Bundle.Waypoint_Bookmark_Display_String()); @@ -376,9 +410,13 @@ public final class KMLReport implements GeneralReportModule { * @param folder The Element folder to add the points to * @param waypointColor The color the waypoint should appear in the report */ - void addWaypoints(List points, Element folder, FeatureColor waypointColor, String headerLabel) { + void addWaypoints(List points, Element folder, FeatureColor waypointColor, String headerLabel) throws TskCoreException { for (Waypoint point : points) { - addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); + long pointDataSource = point.getArtifact().getDataSource().getId(); + // Only add this waypoint if its in the data sources list. + if(settings.getDataSourcesToProcess().contains(pointDataSource)) { + addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); + } } } @@ -408,7 +446,7 @@ public final class KMLReport implements GeneralReportModule { * * @throws TskCoreException */ - void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException { + void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException { List routes = null; if (waypointList == null) { @@ -418,7 +456,11 @@ public final class KMLReport implements GeneralReportModule { } for (Route route : routes) { - addRouteToReport(route); + long routeDataSource = route.getArtifact().getDataSource().getId(); + // Only add routes that are in the data sources list + if(settings.getDataSourcesToProcess().contains(routeDataSource)) { + addRouteToReport(route); + } } } @@ -479,7 +521,7 @@ public final class KMLReport implements GeneralReportModule { * * @throws TskCoreException */ - void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException { + void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException { List tracks = null; if (waypointList == null) { @@ -489,7 +531,11 @@ public final class KMLReport implements GeneralReportModule { } for (Track track : tracks) { - addTrackToReport(track); + long trackDataSource = track.getArtifact().getDataSource().getId(); + // Only add tracks that are in the data sources list + if(settings.getDataSourcesToProcess().contains(trackDataSource)) { + addTrackToReport(track); + } } } From 631e6065d9c4869788bbe9f2f5824597e88b0501 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 27 Apr 2020 11:19:29 -0400 Subject: [PATCH 02/15] Quick clean up --- .../org/sleuthkit/autopsy/corecomponents/Bundle.properties | 3 +++ .../src/org/sleuthkit/autopsy/geolocation/Bundle.properties | 3 --- .../sleuthkit/autopsy/report/modules/html/Bundle.properties | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index 4571bcc3df..c7aad3cc37 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -218,3 +218,6 @@ DataResultViewerTable.exportCSVButton.text=Save Table as CSV ViewPreferencesPanel.scoColumnsCheckbox.text=S(core), C(omments), and O(ccurences) ViewPreferencesPanel.scoColumnsWrapAroundText.text=to reduce loading times ViewPreferencesPanel.scoColumnsLabel.text=Do not add columns for: +CheckBoxListPanel.titleLabel.text=jLabel1 +CheckBoxListPanel.checkButton.text=Check All +CheckBoxListPanel.uncheckButton.text=Uncheck All diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties index 1ee80973b3..6d3f5b4b66 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties @@ -12,9 +12,6 @@ GeoFilterPanel.mostRecentButton.text=Only last GeoFilterPanel.applyButton.text=Apply GeoFilterPanel.showWaypointsWOTSCheckBox.text=Include waypoints with no time stamps GeoFilterPanel.daysLabel.text=days of activity -CheckBoxListPanel.titleLabel.text=jLabel1 -CheckBoxListPanel.checkButton.text=Check All -CheckBoxListPanel.uncheckButton.text=Uncheck All GeoFilterPanel.optionsLabel.text=Dates OptionsCategory_Name_Geolocation=Geolocation OptionsCategory_Keywords_Geolocation=Geolocation Settings diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties index 14692fb977..58ffd58980 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties @@ -5,13 +5,13 @@ ReportHTML.getName.text=HTML Report ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. -ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, -ReportHTML.writeIndex.seeSum=and the summary page for a case summary. +ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, +ReportHTML.writeIndex.seeSum=and the summary page for a case summary. ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.summary=Case Summary ReportHTML.writeSum.title=Case Summary -ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed\! +ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed! # # autopsy/test/scripts/regression.py._html_report_diff() uses reportGenOn.text, caseName, caseNum, # examiner as a regex signature to skip report.html and summary.html From 62aa2d2568ad720d0b6937bb9dfa169392a34779 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 27 Apr 2020 11:33:27 -0400 Subject: [PATCH 03/15] Changed bundle message --- Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties | 2 +- .../infrastructure/ReportWizardDataSourceSelectionPanel.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index c7aad3cc37..d8a598078b 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -218,6 +218,6 @@ DataResultViewerTable.exportCSVButton.text=Save Table as CSV ViewPreferencesPanel.scoColumnsCheckbox.text=S(core), C(omments), and O(ccurences) ViewPreferencesPanel.scoColumnsWrapAroundText.text=to reduce loading times ViewPreferencesPanel.scoColumnsLabel.text=Do not add columns for: -CheckBoxListPanel.titleLabel.text=jLabel1 +CheckBoxListPanel.titleLabel.text= CheckBoxListPanel.checkButton.text=Check All CheckBoxListPanel.uncheckButton.text=Uncheck All diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java index 5a782ecc5c..62924a60a2 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java @@ -67,7 +67,6 @@ public class ReportWizardDataSourceSelectionPanel implements WizardDescriptor.Fi public CheckBoxListPanel getComponent() { if (dataSourcesSelectionPanel == null) { dataSourcesSelectionPanel = new CheckBoxListPanel<>(); - dataSourcesSelectionPanel.setPanelTitle(""); dataSourcesSelectionPanel.setName(Bundle.ReportWizardDataSourceSelectionPanel_title()); try { List dataSources = Case.getCurrentCase().getDataSources(); From 5deee5ce10eec92782ce6c2e390dc6aed0a7d661 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 27 Apr 2020 11:46:17 -0400 Subject: [PATCH 04/15] Updated bundle messages --- .../autopsy/report/modules/html/Bundle.properties-MERGED | 6 +++--- .../sleuthkit/autopsy/report/modules/html/HTMLReport.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED index 3db1b822ea..fce93671b3 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties-MERGED @@ -5,8 +5,8 @@ ReportHTML.getName.text=HTML Report ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. -ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, -ReportHTML.writeIndex.seeSum=and the summary page for a case summary. +ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, +ReportHTML.writeIndex.seeSum=and the summary page for a case summary. ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.summary=Case Summary @@ -16,7 +16,7 @@ ReportHTML.writeSum.caseNumber=Case Number: ReportHTML.writeSum.caseNumImages=Number of data sources in case: ReportHTML.writeSum.examiner=Examiner: ReportHTML.writeSum.title=Case Summary -ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed\! +ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed! # # autopsy/test/scripts/regression.py._html_report_diff() uses reportGenOn.text, caseName, caseNum, # examiner as a regex signature to skip report.html and summary.html diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java index 46c1268f2c..6c49926907 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java @@ -1343,7 +1343,7 @@ public class HTMLReport implements TableReportModule { @Messages({ "ReportHTML.writeSum.case=Case:", "ReportHTML.writeSum.caseNumber=Case Number:", - "ReportHTML.writeSum.caseNumImages=Number of Images:", + "ReportHTML.writeSum.caseNumImages=Number of data sources in case:", "ReportHTML.writeSum.caseNotes=Notes:", "ReportHTML.writeSum.examiner=Examiner:" }) From ffbb65477cd21883e79af035472d1c31020e80c5 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 27 Apr 2020 11:49:51 -0400 Subject: [PATCH 05/15] Reverted html bundle properties changes --- .../sleuthkit/autopsy/report/modules/html/Bundle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties index 58ffd58980..14692fb977 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/Bundle.properties @@ -5,13 +5,13 @@ ReportHTML.getName.text=HTML Report ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. -ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, -ReportHTML.writeIndex.seeSum=and the summary page for a case summary. +ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, +ReportHTML.writeIndex.seeSum=and the summary page for a case summary. ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.summary=Case Summary ReportHTML.writeSum.title=Case Summary -ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed! +ReportHTML.writeSum.warningMsg=Warning, this report was run before ingest services completed\! # # autopsy/test/scripts/regression.py._html_report_diff() uses reportGenOn.text, caseName, caseNum, # examiner as a regex signature to skip report.html and summary.html From 6817c5e3e7c99dfeb8b04fc894c5865484c52f73 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 28 Apr 2020 13:39:12 -0400 Subject: [PATCH 06/15] Codacy fixes and small interface changes --- .../autopsy/report/GeneralReportModule.java | 16 ++++++++-------- .../autopsy/report/GeneralReportSettings.java | 9 +++++++++ .../report/infrastructure/ReportGenerator.java | 3 ++- .../infrastructure/ReportWizardPanel1.java | 2 +- .../autopsy/report/modules/kml/KMLReport.java | 10 ++++++---- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java index c7553c9d64..daed772123 100644 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java @@ -45,16 +45,16 @@ public interface GeneralReportModule extends ReportModule { /** * Called to generate the report. Method is responsible for saving the file - * at the path specified and updating progress via the progressPanel object. - * Configuration parameters can be passed in the settings class. Modules should - * try to respond to all configuration parameters. + * and updating progress via the progressPanel object. Configuration + * parameters are passed in the settings class, most notably the directory + * to save the report. Modules should try to respond to all configuration + * parameters. * - * @param baseReportDir Base directory that reports are being stored in. - * Report should go into baseReportDir + getRelativeFilePath(). - * @param settings Configuration parameters to customize the report generation process + * @param settings Configuration parameters to customize the report + * generation process * @param progressPanel panel to update the report's progress with */ - default void generateReport(String baseReportDir, GeneralReportSettings settings, ReportProgressPanel progressPanel) { - generateReport(baseReportDir, progressPanel); + default void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { + generateReport(settings.getReportDirectoryPath(), progressPanel); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java index 34c7b20139..0aabf50fbb 100755 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java @@ -29,6 +29,7 @@ public class GeneralReportSettings implements Serializable { private static final long serialVersionUID = 1L; private List dataSourcesToProcess; + private String reportDirectoryPath; public List getDataSourcesToProcess() { return dataSourcesToProcess; @@ -37,4 +38,12 @@ public class GeneralReportSettings implements Serializable { public void setDataSourcesToProcess(List dataSourcesToProcess) { this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); } + + public String getReportDirectoryPath() { + return this.reportDirectoryPath; + } + + public void setReportDirectoryPath(String reportDirectoryPath) { + this.reportDirectoryPath = reportDirectoryPath; + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index 022b2a8667..e3f6f186ab 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -302,7 +302,8 @@ public class ReportGenerator { if (generalReportModule != null) { String reportDir = createReportDirectory(generalReportModule); setupProgressPanel(generalReportModule, reportDir); - generalReportModule.generateReport(reportDir, reportSettings, progressIndicator); + reportSettings.setReportDirectoryPath(reportDir); + generalReportModule.generateReport(reportSettings, progressIndicator); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java index 1b023c7815..106745c182 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java @@ -130,7 +130,7 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel selections = currentCase.getDataSources() .stream() .map(Content::getId) .collect(Collectors.toList()); - settings.setDataSourcesToProcess(selections); - generateReport(baseReportDir, settings, progressPanel); + reportSettings.setDataSourcesToProcess(selections); + reportSettings.setReportDirectoryPath(baseReportDir); + generateReport(reportSettings, progressPanel); } catch (NoCurrentCaseException | TskCoreException ex) { logger.log(Level.SEVERE, "Exception while accessing case resources.", ex); //NON-NLS } From 6290e94fa25aeb459499575ab60bc9af78260816 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 28 Apr 2020 14:22:12 -0400 Subject: [PATCH 07/15] Null fix and some clean up --- .../infrastructure/ReportWizardAction.java | 14 ++++---- .../infrastructure/TableReportGenerator.java | 33 +++++++++--------- .../autopsy/report/modules/kml/KMLReport.java | 34 +++++++++++-------- 3 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java index 28d1dfff86..50d4a5f6d2 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java @@ -125,12 +125,14 @@ public final class ReportWizardAction extends CallableSystemAction implements Pr FileReportSettings fileSettings = (FileReportSettings) wiz.getProperty("fileReportSettings"); TableReportSettings tableSettings = (TableReportSettings) wiz.getProperty("tableReportSettings"); GeneralReportSettings generalSettings = new GeneralReportSettings(); - generalSettings.setDataSourcesToProcess(selectedDataSourceIds); - if(fileSettings != null) { - fileSettings.setDataSourcesToProcess(selectedDataSourceIds); - } - if(tableSettings != null) { - tableSettings.setDataSourcesToProcess(selectedDataSourceIds); + if(selectedDataSourceIds != null) { + generalSettings.setDataSourcesToProcess(selectedDataSourceIds); + if(fileSettings != null) { + fileSettings.setDataSourcesToProcess(selectedDataSourceIds); + } + if(tableSettings != null) { + tableSettings.setDataSourcesToProcess(selectedDataSourceIds); + } } reportingConfig.setFileReportSettings(fileSettings); diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java index 4cd2b349cc..e36143ccaf 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java @@ -367,14 +367,12 @@ class TableReportGenerator { // Give the modules the rows for the content tags. for (ContentTag tag : tags) { try { - long dataSourceId = tag.getContent().getDataSource().getId(); - // Skip tags that are not in the data sources list - if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + if(shouldFilterFromReport(tag.getContent())) { continue; } } catch (TskCoreException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetContentTags")); - logger.log(Level.SEVERE, "failed to get data source of content tag", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS return; } @@ -459,14 +457,12 @@ class TableReportGenerator { // Give the modules the rows for the content tags. for (BlackboardArtifactTag tag : tags) { try { - long dataSourceId = tag.getContent().getDataSource().getId(); - // Skip tags that are not in the data sources list - if (!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + if(shouldFilterFromReport(tag.getContent())) { continue; } } catch (TskCoreException ex) { errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags")); - logger.log(Level.SEVERE, "failed to get data source of blackboard artifact tag", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS return; } @@ -823,9 +819,7 @@ class TableReportGenerator { AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); - long dataSourceId = f.getDataSource().getId(); - // Skip files that are not in the data sources list - if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + if(shouldFilterFromReport(f)) { continue; } } @@ -985,9 +979,7 @@ class TableReportGenerator { AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); if (f != null) { uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); - long dataSourceId = f.getDataSource().getId(); - // Skip files that are not in the data sources list. - if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + if(shouldFilterFromReport(f)) { continue; } } @@ -1232,9 +1224,7 @@ class TableReportGenerator { List artifacts = new ArrayList<>(); try { for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { - long dataSourceId = artifact.getDataSource().getId(); - // Skip artifacts that are not in the data sources list - if(!this.settings.getDataSourcesToProcess().contains(dataSourceId)) { + if(shouldFilterFromReport(artifact)) { continue; } @@ -1832,6 +1822,15 @@ class TableReportGenerator { return ""; } + + /** + * Indicates if the content should be filtered from the report. + */ + private boolean shouldFilterFromReport(Content content) throws TskCoreException { + long dataSourceId = content.getDataSource().getId(); + return this.settings.getDataSourcesToProcess() != null && + !this.settings.getDataSourcesToProcess().contains(dataSourceId); + } /** * Get any tags associated with an artifact diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index f3cc82ebde..522a0522c3 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -350,9 +350,7 @@ public final class KMLReport implements GeneralReportModule { */ void addExifMetadataContent(List points, String baseReportDirectory) throws IOException, TskCoreException { for (Waypoint point : points) { - long pointDataSource = point.getArtifact().getDataSource().getId(); - // Skip this point if its not in the data sources list. - if(!settings.getDataSourcesToProcess().contains(pointDataSource)) { + if(shouldFilterFromReport(point.getArtifact())) { continue; } @@ -414,11 +412,10 @@ public final class KMLReport implements GeneralReportModule { */ void addWaypoints(List points, Element folder, FeatureColor waypointColor, String headerLabel) throws TskCoreException { for (Waypoint point : points) { - long pointDataSource = point.getArtifact().getDataSource().getId(); - // Only add this waypoint if its in the data sources list. - if(settings.getDataSourcesToProcess().contains(pointDataSource)) { - addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); + if(shouldFilterFromReport(point.getArtifact())) { + continue; } + addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); } } @@ -458,11 +455,10 @@ public final class KMLReport implements GeneralReportModule { } for (Route route : routes) { - long routeDataSource = route.getArtifact().getDataSource().getId(); - // Only add routes that are in the data sources list - if(settings.getDataSourcesToProcess().contains(routeDataSource)) { - addRouteToReport(route); + if(shouldFilterFromReport(route.getArtifact())) { + continue; } + addRouteToReport(route); } } @@ -533,11 +529,10 @@ public final class KMLReport implements GeneralReportModule { } for (Track track : tracks) { - long trackDataSource = track.getArtifact().getDataSource().getId(); - // Only add tracks that are in the data sources list - if(settings.getDataSourcesToProcess().contains(trackDataSource)) { - addTrackToReport(track); + if(shouldFilterFromReport(track.getArtifact())) { + continue; } + addTrackToReport(track); } } @@ -925,4 +920,13 @@ public final class KMLReport implements GeneralReportModule { return String.format("%.2f, %.2f", latitude, longitude); } + + /** + * Indicates if the content should be filtered from the report. + */ + private boolean shouldFilterFromReport(Content content) throws TskCoreException { + long dataSourceId = content.getDataSource().getId(); + return this.settings.getDataSourcesToProcess() != null && + !this.settings.getDataSourcesToProcess().contains(dataSourceId); + } } From 0625dfee26a96c262328c2aeafebb18ac3cd5750 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 28 Apr 2020 18:00:16 -0400 Subject: [PATCH 08/15] Added yes-no dialog if there are zero data source selections --- .../infrastructure/Bundle.properties-MERGED | 3 ++ .../ReportWizardDataSourceSelectionPanel.java | 41 +++++++++++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED index ef0fd25142..95f19a44a3 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/Bundle.properties-MERGED @@ -15,6 +15,9 @@ ReportProgressIndicator.completedWithErrorsMessage=Report generation completed w ReportProgressIndicator.startMessage=Report generation started ReportProgressIndicator.switchToDeterminateMessage=Report generation progress switched to determinate ReportProgressIndicator.switchToIndeterminateMessage=Report generation progress switched to indeterminate +ReportWizardDataSourceSelectionPanel.confirmEmptySelection=Are you sure you want to proceed with no selections? +ReportWizardDataSourceSelectionPanel.finishButton.text=Finish +ReportWizardDataSourceSelectionPanel.nextButton.text=Next ReportWizardDataSourceSelectionPanel.title=Select which datasource(s) to include ReportWizardFileOptionsVisualPanel.jLabel1.text=Select items to include in File Report: ReportWizardFileOptionsVisualPanel.deselectAllButton.text=Deselect All diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java index 62924a60a2..8ea0090219 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java @@ -31,6 +31,7 @@ import org.openide.util.NbPreferences; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -46,18 +47,43 @@ public class ReportWizardDataSourceSelectionPanel implements WizardDescriptor.Fi private WizardDescriptor wiz; private final JButton finishButton; + private final JButton nextButton; + @NbBundle.Messages({ + "ReportWizardDataSourceSelectionPanel.nextButton.text=Next", + "ReportWizardDataSourceSelectionPanel.finishButton.text=Finish" + }) public ReportWizardDataSourceSelectionPanel() { - finishButton = new JButton( - NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text")); + nextButton = new JButton(Bundle.ReportWizardDataSourceSelectionPanel_nextButton_text()); + finishButton = new JButton(Bundle.ReportWizardDataSourceSelectionPanel_finishButton_text()); finishButton.setEnabled(false); + nextButton.setEnabled(false); - finishButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { + finishButton.addActionListener(createFinishButtonActionListener()); + nextButton.addActionListener(createNextButtonActionListener()); + } + + @NbBundle.Messages({ + "ReportWizardDataSourceSelectionPanel.confirmEmptySelection=Are you sure you want to proceed with no selections?" + }) + private ActionListener createNextButtonActionListener() { + return (ActionEvent e) -> { + if(!dataSourcesSelectionPanel.getSelectedElements().isEmpty()) { + wiz.doNextClick(); + } else if(MessageNotifyUtil.Message.confirm(Bundle.ReportWizardDataSourceSelectionPanel_confirmEmptySelection())) { + wiz.doNextClick(); + } + }; + } + + private ActionListener createFinishButtonActionListener() { + return (ActionEvent e) -> { + if(!dataSourcesSelectionPanel.getSelectedElements().isEmpty()) { + wiz.doFinishClick(); + } else if(MessageNotifyUtil.Message.confirm(Bundle.ReportWizardDataSourceSelectionPanel_confirmEmptySelection())) { wiz.doFinishClick(); } - }); + }; } @NbBundle.Messages({ @@ -90,9 +116,10 @@ public class ReportWizardDataSourceSelectionPanel implements WizardDescriptor.Fi @Override public void readSettings(WizardDescriptor data) { this.wiz = data; - wiz.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, finishButton, WizardDescriptor.CANCEL_OPTION}); + wiz.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, nextButton, finishButton, WizardDescriptor.CANCEL_OPTION}); boolean generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS + nextButton.setEnabled(!generalModule); finishButton.setEnabled(generalModule); } From 7a80cbddf2dc9276fc6ef7ee94362ccd2e178601 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 30 Apr 2020 16:48:54 -0400 Subject: [PATCH 09/15] Updated the rest of the report modules and tweaked names/interfaces according to feedback --- .../autopsy/report/GeneralReportModule.java | 31 +++++++------ .../report/GeneralReportModuleAdapter.java | 7 ++- .../autopsy/report/GeneralReportSettings.java | 26 ++++++++--- .../infrastructure/FileReportSettings.java | 14 +++--- .../infrastructure/ReportGenerator.java | 13 ++++++ .../infrastructure/ReportWizardAction.java | 6 +-- .../infrastructure/ReportWizardIterator.java | 4 ++ .../infrastructure/ReportWizardPanel1.java | 9 ++-- .../infrastructure/TableReportGenerator.java | 7 ++- .../infrastructure/TableReportSettings.java | 14 +++--- .../modules/bodyfile/BodyFileReport.java | 26 ++++++++--- .../modules/caseuco/CaseUcoReportModule.java | 23 ++++++++-- .../modules/excel/Bundle.properties-MERGED | 2 +- .../report/modules/excel/ExcelReport.java | 4 +- .../autopsy/report/modules/kml/KMLReport.java | 43 ++++++++++--------- .../report/modules/stix/STIXReportModule.java | 6 ++- .../SaveTaggedHashesToHashDb.java | 5 ++- 17 files changed, 162 insertions(+), 78 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java index daed772123..f491bd5e5b 100644 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java @@ -27,20 +27,14 @@ public interface GeneralReportModule extends ReportModule { * @param baseReportDir Base directory that reports are being stored in. * Report should go into baseReportDir + getRelativeFilePath(). * @param progressPanel panel to update the report's progress with - */ - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel); - - /** - * Determines if the module supports report generation on a subset of data - * sources in a case. Defaults to false. Modules that override this to true - * should implement all generateReport overloads. The data source selections - * are stored in the GeneralReportSettings instance. * - * @return True if the module can be configured to run on a subset of data - * sources. + * @deprecated Use generateReport(GeneralReportSettings settings, + * ReportProgressPanel progressPanel) instead. The baseReportDir + * is stored in the settings instance. */ - default boolean supportsDataSourceSelection() { - return false; + @Deprecated + default void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + } /** @@ -54,7 +48,20 @@ public interface GeneralReportModule extends ReportModule { * generation process * @param progressPanel panel to update the report's progress with */ + @SuppressWarnings("deprecation") default void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { generateReport(settings.getReportDirectoryPath(), progressPanel); } + + /** + * Determines if the module supports report generation on a subset of data + * sources in a case. Defaults to false. The data source selections are + * stored in the GeneralReportSettings instance. + * + * @return True if the module can be configured to run on a subset of data + * sources. + */ + default boolean supportsDataSourceSelection() { + return false; + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModuleAdapter.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModuleAdapter.java index f66b1c69a2..24ef35b885 100644 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModuleAdapter.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModuleAdapter.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,10 @@ public abstract class GeneralReportModuleAdapter implements GeneralReportModule } @Override - public abstract void generateReport(String baseReportDir, ReportProgressPanel progressPanel); + @Deprecated + public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + + } @Override public JPanel getConfigurationPanel() { diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java index 0aabf50fbb..0ba6d9ec62 100755 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java @@ -28,21 +28,37 @@ import java.util.List; public class GeneralReportSettings implements Serializable { private static final long serialVersionUID = 1L; - private List dataSourcesToProcess; + private List selectedDataSources; private String reportDirectoryPath; - public List getDataSourcesToProcess() { - return dataSourcesToProcess; + /** + * Returns the selected data sources + * @return List of data source ids + */ + public List getSelectedDataSources() { + return selectedDataSources; } - public void setDataSourcesToProcess(List dataSourcesToProcess) { - this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + /** + * Sets the selected data sources + * @param selectedDataSources List of data source ids + */ + public void setSelectedDataSources(List selectedDataSources) { + this.selectedDataSources = new ArrayList<>(selectedDataSources); } + /** + * Returns the directory that the report file should be saved in. + * @return Path to report directory + */ public String getReportDirectoryPath() { return this.reportDirectoryPath; } + /** + * Sets the directory that the report file should be saved in. + * @param reportDirectoryPath Path to report directory + */ public void setReportDirectoryPath(String reportDirectoryPath) { this.reportDirectoryPath = reportDirectoryPath; } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java index c211b02244..427cfb77cd 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/FileReportSettings.java @@ -32,7 +32,7 @@ final class FileReportSettings implements Serializable { private static final long serialVersionUID = 1L; private Map filePropertiesInfo = new HashMap<>(); - private List dataSourcesToProcess; + private List selectedDataSources; /** * Creates FileReportSettings object. @@ -54,16 +54,16 @@ final class FileReportSettings implements Serializable { } /** - * Returns the data sources to process + * Returns the selected data sources */ - List getDataSourcesToProcess() { - return dataSourcesToProcess; + List getSelectedDataSources() { + return selectedDataSources; } /** - * Sets the data sources to process + * Sets the selected data sources */ - void setDataSourcesToProcess(List dataSourcesToProcess) { - this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + void setSelectedDataSources(List selectedDataSources) { + this.selectedDataSources = new ArrayList<>(selectedDataSources); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index e3f6f186ab..b33800d1e1 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -42,6 +42,7 @@ import java.util.Map.Entry; import java.util.logging.Level; import javax.swing.JDialog; import org.openide.filesystems.FileUtil; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; @@ -361,6 +362,10 @@ public class ReportGenerator { int i = 0; // Add files to report. for (AbstractFile file : files) { + if(shouldFilterFromReport(file, fileReportSettings)) { + continue; + } + // Check to see if any reports have been cancelled. if (progressIndicator.getStatus() == ReportStatus.CANCELED) { return; @@ -382,6 +387,14 @@ public class ReportGenerator { progressIndicator.complete(ReportStatus.COMPLETE); } } + + private boolean shouldFilterFromReport(AbstractFile file, FileReportSettings fileReportSettings) { + if(fileReportSettings.getSelectedDataSources() == null) { + return false; + } + // Filter if the data source id is not in the list to process + return !fileReportSettings.getSelectedDataSources().contains(file.getDataSourceObjectId()); + } /** * Run the Portable Case Report Module diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java index 50d4a5f6d2..fd03660e51 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardAction.java @@ -126,12 +126,12 @@ public final class ReportWizardAction extends CallableSystemAction implements Pr TableReportSettings tableSettings = (TableReportSettings) wiz.getProperty("tableReportSettings"); GeneralReportSettings generalSettings = new GeneralReportSettings(); if(selectedDataSourceIds != null) { - generalSettings.setDataSourcesToProcess(selectedDataSourceIds); + generalSettings.setSelectedDataSources(selectedDataSourceIds); if(fileSettings != null) { - fileSettings.setDataSourcesToProcess(selectedDataSourceIds); + fileSettings.setSelectedDataSources(selectedDataSourceIds); } if(tableSettings != null) { - tableSettings.setDataSourcesToProcess(selectedDataSourceIds); + tableSettings.setSelectedDataSources(selectedDataSourceIds); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java index 726ce8a7a5..7a716e246f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java @@ -138,6 +138,10 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator(panels); + panels.add(1, dataSourceSelectionPanel); + } } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java index 106745c182..d5459c0ac4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java @@ -29,7 +29,6 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; import org.sleuthkit.autopsy.report.GeneralReportModule; -import org.sleuthkit.autopsy.report.modules.html.HTMLReport; class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel { @@ -119,6 +118,7 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel tagNames = new ArrayList<>(); private final boolean useStoredTagsAndArtifactsLists; private final TableReportOption reportOption; - private List dataSourcesToProcess; + private List selectedDataSources; /** * Creates TableReportSettings object. This constructor is used when user @@ -102,16 +102,16 @@ final class TableReportSettings implements Serializable { } /** - * Returns the data sources to process + * Returns the selected data sources */ - List getDataSourcesToProcess() { - return dataSourcesToProcess; + List getSelectedDataSources() { + return selectedDataSources; } /** - * Sets the data sources to process + * Sets the selected data sources */ - void setDataSourcesToProcess(List dataSourcesToProcess) { - this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); + void setSelectedDataSources(List selectedDataSources) { + this.selectedDataSources = new ArrayList<>(selectedDataSources); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/bodyfile/BodyFileReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/bodyfile/BodyFileReport.java index a0d43bf4e5..3f34982489 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/bodyfile/BodyFileReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/bodyfile/BodyFileReport.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2012-2018 Basis Technology Corp. + * Copyright 2012-2020 Basis Technology Corp. * * Copyright 2012 42six Solutions. * Contact: aebadirad 42six com @@ -28,6 +28,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.List; import java.util.logging.Level; +import java.util.stream.Collectors; import javax.swing.JPanel; import org.openide.util.NbBundle; @@ -35,6 +36,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; import org.sleuthkit.datamodel.*; @@ -65,6 +67,11 @@ class BodyFileReport implements GeneralReportModule { } return instance; } + + @Override + public boolean supportsDataSourceSelection() { + return true; + } /** * Generates a body file format report for use with the MAC time tool. @@ -73,8 +80,7 @@ class BodyFileReport implements GeneralReportModule { * @param progressPanel panel to update the report's progress */ @Override - @SuppressWarnings("deprecation") - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { // Start the progress bar and setup the report try { currentCase = Case.getCurrentCaseThrows(); @@ -85,7 +91,7 @@ class BodyFileReport implements GeneralReportModule { progressPanel.setIndeterminate(false); progressPanel.start(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportBodyFile.progress.querying")); - reportPath = baseReportDir + getRelativeFilePath(); //NON-NLS + reportPath = settings.getReportDirectoryPath() + getRelativeFilePath(); //NON-NLS skCase = currentCase.getSleuthkitCase(); @@ -96,7 +102,17 @@ class BodyFileReport implements GeneralReportModule { + " AND name != '.' AND name != '..'"; //NON-NLS progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportBodyFile.progress.loading")); - List fs = skCase.findAllFilesWhere(query); + // Filter the list to only include files that are contained within + // the set of data sources to process. + List fs = skCase.findAllFilesWhere(query).stream() + .filter((file) -> { + if(settings.getSelectedDataSources() == null) { + // Assume all data sources if list is null. + return true; + } + return settings.getSelectedDataSources().contains(file.getDataSourceObjectId()); + }) + .collect(Collectors.toList()); // Check if ingest has finished String ingestwarning = ""; diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportModule.java b/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportModule.java index 0fd5d93579..3b9c7232d3 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportModule.java @@ -29,6 +29,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Level; +import java.util.stream.Collectors; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; @@ -36,6 +37,7 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.report.GeneralReportModule; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; @@ -98,6 +100,11 @@ public final class CaseUcoReportModule implements GeneralReportModule { public static String getReportFileName() { return REPORT_FILE_NAME; } + + @Override + public boolean supportsDataSourceSelection() { + return true; + } /** * Generates a CASE-UCO format report for all files in the Case. @@ -117,14 +124,13 @@ public final class CaseUcoReportModule implements GeneralReportModule { "CaseUcoReportModule.srcModuleName=CASE-UCO Report" }) @Override - @SuppressWarnings("deprecation") - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { try { // Check if ingest has finished warnIngest(progressPanel); //Create report paths if they don't already exist. - Path reportDirectory = Paths.get(baseReportDir); + Path reportDirectory = Paths.get(settings.getReportDirectoryPath()); try { Files.createDirectories(reportDirectory); } catch (IOException ex) { @@ -141,7 +147,16 @@ public final class CaseUcoReportModule implements GeneralReportModule { Case caseObj = Case.getCurrentCaseThrows(); generator.addCase(caseObj); - List dataSources = caseObj.getDataSources(); + List dataSources = caseObj.getDataSources().stream() + .filter((dataSource) -> { + if(settings.getSelectedDataSources() == null) { + // Assume all data sources if list is null. + return true; + } + return settings.getSelectedDataSources().contains(dataSource.getId()); + }) + .collect(Collectors.toList()); + progressPanel.setIndeterminate(false); progressPanel.setMaximumProgress(dataSources.size()); progressPanel.start(); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/excel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/modules/excel/Bundle.properties-MERGED index abdc200271..6a40a2b22b 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/excel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/modules/excel/Bundle.properties-MERGED @@ -14,6 +14,6 @@ ReportExcel.writeSummary.caseName=Case Name: ReportExcel.writeSummary.caseNotes=Case Notes: ReportExcel.writeSummary.caseNum=Case Number: ReportExcel.writeSummary.examiner=Examiner: -ReportExcel.writeSummary.numImages=Number of Images: +ReportExcel.writeSummary.numImages=Number of data sources in case: ReportExcel.writeSummary.sheetName=Summary ReportExcel.writeSummary.summary=Summary diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/excel/ExcelReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/excel/ExcelReport.java index 768bbcf5ec..15471386f5 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/excel/ExcelReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/excel/ExcelReport.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2018 Basis Technology Corp. + * Copyright 2013-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -307,7 +307,7 @@ class ExcelReport implements TableReportModule { "ReportExcel.writeSummary.sheetName=Summary", "ReportExcel.writeSummary.summary=Summary", "ReportExcel.writeSummary.caseName=Case Name:", - "ReportExcel.writeSummary.numImages=Number of Images:", + "ReportExcel.writeSummary.numImages=Number of data sources in case:", "ReportExcel.writeSummary.caseNum=Case Number:", "ReportExcel.writeSummary.caseNotes=Case Notes:", "ReportExcel.writeSummary.examiner=Examiner:" diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 522a0522c3..3a038adea5 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -156,7 +156,9 @@ public final class KMLReport implements GeneralReportModule { public void generateReport(String baseReportDir, ReportProgressPanel progressPanel, List waypointList) { this.waypointList = waypointList; - generateReport(baseReportDir, progressPanel); + GeneralReportSettings reportSettings = new GeneralReportSettings(); + reportSettings.setReportDirectoryPath(baseReportDir); + generateReport(reportSettings, progressPanel); } @Override @@ -172,6 +174,21 @@ public final class KMLReport implements GeneralReportModule { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return; } + + if(settings.getSelectedDataSources() == null) { + // Process all data sources if the list is null. + try { + List selectedDataSources = currentCase.getDataSources() + .stream() + .map(Content::getId) + .collect(Collectors.toList()); + settings.setSelectedDataSources(selectedDataSources); + } catch (TskCoreException ex) { + logger.log(Level.SEVERE, "Could not get the datasources from the case", ex); + return; + } + } + String baseReportDir = settings.getReportDirectoryPath(); this.settings = settings; // Start the progress bar and setup the report @@ -237,24 +254,6 @@ public final class KMLReport implements GeneralReportModule { progressPanel.complete(result, errorMessage); } - @Override - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { - try { - GeneralReportSettings reportSettings = new GeneralReportSettings(); - currentCase = Case.getCurrentCaseThrows(); - // Process all data sources if none are provided. - List selections = currentCase.getDataSources() - .stream() - .map(Content::getId) - .collect(Collectors.toList()); - reportSettings.setDataSourcesToProcess(selections); - reportSettings.setReportDirectoryPath(baseReportDir); - generateReport(reportSettings, progressPanel); - } catch (NoCurrentCaseException | TskCoreException ex) { - logger.log(Level.SEVERE, "Exception while accessing case resources.", ex); //NON-NLS - } - } - /** * Do all of the setting up of elements needed for the report. * @@ -925,8 +924,10 @@ public final class KMLReport implements GeneralReportModule { * Indicates if the content should be filtered from the report. */ private boolean shouldFilterFromReport(Content content) throws TskCoreException { + if(this.settings.getSelectedDataSources() == null) { + return false; + } long dataSourceId = content.getDataSource().getId(); - return this.settings.getDataSourcesToProcess() != null && - !this.settings.getDataSourcesToProcess().contains(dataSourceId); + return !this.settings.getSelectedDataSources().contains(dataSourceId); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/stix/STIXReportModule.java b/Core/src/org/sleuthkit/autopsy/report/modules/stix/STIXReportModule.java index 6421cc4a32..365f37a02d 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/stix/STIXReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/stix/STIXReportModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 - 2018 Basis Technology Corp. + * Copyright 2013 - 2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,6 +55,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.report.GeneralReportModule; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.NoReportModuleSettings; import org.sleuthkit.autopsy.report.ReportModuleSettings; import org.sleuthkit.autopsy.report.ReportProgressPanel; @@ -97,10 +98,11 @@ public class STIXReportModule implements GeneralReportModule { */ @Override @Messages({"STIXReportModule.srcModuleName.text=STIX Report"}) - public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { + public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { // Start the progress bar and setup the report progressPanel.setIndeterminate(false); progressPanel.start(); + String baseReportDir = settings.getReportDirectoryPath(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.readSTIX")); reportPath = baseReportDir + getRelativeFilePath(); File reportFile = new File(reportPath); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/taggedhashes/SaveTaggedHashesToHashDb.java b/Core/src/org/sleuthkit/autopsy/report/modules/taggedhashes/SaveTaggedHashesToHashDb.java index 8fc57c0ae8..269350b288 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/taggedhashes/SaveTaggedHashesToHashDb.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/taggedhashes/SaveTaggedHashesToHashDb.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; import org.sleuthkit.autopsy.report.GeneralReportModule; +import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.NoReportModuleSettings; import org.sleuthkit.autopsy.report.ReportModuleSettings; import org.sleuthkit.autopsy.report.ReportProgressPanel; @@ -115,7 +116,7 @@ public class SaveTaggedHashesToHashDb implements GeneralReportModule { "AddTaggedHashesToHashDb.error.noTagsSelected=No tags selected for export." }) @Override - public void generateReport(String reportPath, ReportProgressPanel progressPanel) { + public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { Case openCase; try { openCase = Case.getCurrentCaseThrows(); From 6e610686a41976306a23330539e544ba4dc00936 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 30 Apr 2020 16:58:05 -0400 Subject: [PATCH 10/15] Removed unused import --- .../sleuthkit/autopsy/report/infrastructure/ReportGenerator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index b33800d1e1..a889d4f2a8 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -42,7 +42,6 @@ import java.util.Map.Entry; import java.util.logging.Level; import javax.swing.JDialog; import org.openide.filesystems.FileUtil; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; From cbda226035837978b4f484b8c93398193dc2fb31 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 21 May 2020 12:26:09 -0400 Subject: [PATCH 11/15] Moved CheckBoxList and Panel to the guiutils package --- .../org/sleuthkit/autopsy/corecomponents/Bundle.properties | 3 --- .../sleuthkit/autopsy/guiutils/Bundle.properties-MERGED | 7 +++++++ .../{corecomponents => guiutils}/CheckBoxJList.java | 2 +- .../{corecomponents => guiutils}/CheckBoxListPanel.form | 6 +++--- .../{corecomponents => guiutils}/CheckBoxListPanel.java | 3 ++- .../ReportWizardDataSourceSelectionPanel.java | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) rename Core/src/org/sleuthkit/autopsy/{corecomponents => guiutils}/CheckBoxJList.java (98%) rename Core/src/org/sleuthkit/autopsy/{corecomponents => guiutils}/CheckBoxListPanel.form (87%) rename Core/src/org/sleuthkit/autopsy/{corecomponents => guiutils}/CheckBoxListPanel.java (99%) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index d8a598078b..4571bcc3df 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -218,6 +218,3 @@ DataResultViewerTable.exportCSVButton.text=Save Table as CSV ViewPreferencesPanel.scoColumnsCheckbox.text=S(core), C(omments), and O(ccurences) ViewPreferencesPanel.scoColumnsWrapAroundText.text=to reduce loading times ViewPreferencesPanel.scoColumnsLabel.text=Do not add columns for: -CheckBoxListPanel.titleLabel.text= -CheckBoxListPanel.checkButton.text=Check All -CheckBoxListPanel.uncheckButton.text=Uncheck All diff --git a/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED index d01a4381df..4954024df5 100755 --- a/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED @@ -1,3 +1,10 @@ +# To change this license header, choose License Headers in Project Properties. +# To change this template file, choose Tools | Templates +# and open the template in the editor. + +CheckBoxListPanel.titleLabel.text= +CheckBoxListPanel.checkButton.text=Check All +CheckBoxListPanel.uncheckButton.text=Uncheck All StatusIconCellRenderer.tooltiptext.error=An error occurred StatusIconCellRenderer.tooltiptext.ok=OK StatusIconCellRenderer.tooltiptext.warning=A warning occurred diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxJList.java similarity index 98% rename from Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java rename to Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxJList.java index 3d360bb102..ab17187c4b 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxJList.java +++ b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxJList.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.corecomponents; +package org.sleuthkit.autopsy.guiutils; import java.awt.BorderLayout; import java.awt.Component; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.form similarity index 87% rename from Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form rename to Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.form index bd65f2c17a..4b6dd5b7c9 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.form +++ b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.form @@ -19,7 +19,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -46,7 +46,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java similarity index 99% rename from Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java rename to Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java index 2a87d429ef..aad5ef8b28 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/CheckBoxListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java @@ -16,8 +16,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.corecomponents; +package org.sleuthkit.autopsy.guiutils; +import org.sleuthkit.autopsy.guiutils.CheckBoxJList; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java index 8ea0090219..bfdd1dc5c1 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardDataSourceSelectionPanel.java @@ -29,7 +29,7 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel; +import org.sleuthkit.autopsy.guiutils.CheckBoxListPanel; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.datamodel.Content; From 6d419e3293aba205d097cf605c8a225e1ce0d7b4 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 21 May 2020 12:43:42 -0400 Subject: [PATCH 12/15] Fixed incomplete commit --- .../sleuthkit/autopsy/geolocation/Bundle.properties-MERGED | 3 --- .../src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java | 2 +- Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties | 3 +++ .../org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED | 4 ---- 4 files changed, 4 insertions(+), 8 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED index a27f92c887..f3dab8dd7e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED @@ -51,9 +51,6 @@ GeoFilterPanel.mostRecentButton.text=Only last GeoFilterPanel.applyButton.text=Apply GeoFilterPanel.showWaypointsWOTSCheckBox.text=Include waypoints with no time stamps GeoFilterPanel.daysLabel.text=days of activity -CheckBoxListPanel.titleLabel.text=jLabel1 -CheckBoxListPanel.checkButton.text=Check All -CheckBoxListPanel.uncheckButton.text=Uncheck All GeoFilterPanel.optionsLabel.text=Dates OptionsCategory_Name_Geolocation=Geolocation OptionsCategory_Keywords_Geolocation=Geolocation Settings diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java index 2641b5d4b0..2aa820b12f 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java @@ -18,7 +18,7 @@ */ package org.sleuthkit.autopsy.geolocation; -import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel; +import org.sleuthkit.autopsy.guiutils.CheckBoxListPanel; import java.awt.Color; import java.awt.Graphics; import java.awt.GridBagConstraints; diff --git a/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties new file mode 100755 index 0000000000..01a3056f45 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties @@ -0,0 +1,3 @@ +CheckBoxListPanel.titleLabel.text= +CheckBoxListPanel.checkButton.text=Check All +CheckBoxListPanel.uncheckButton.text=Uncheck All \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED index 4954024df5..e60f64b854 100755 --- a/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/guiutils/Bundle.properties-MERGED @@ -1,7 +1,3 @@ -# To change this license header, choose License Headers in Project Properties. -# To change this template file, choose Tools | Templates -# and open the template in the editor. - CheckBoxListPanel.titleLabel.text= CheckBoxListPanel.checkButton.text=Check All CheckBoxListPanel.uncheckButton.text=Uncheck All From be21e1c1b71121380b64a0d75c896eb3413bbe39 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 21 May 2020 13:02:41 -0400 Subject: [PATCH 13/15] Removed unused import --- Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java index aad5ef8b28..775c99eb77 100755 --- a/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/guiutils/CheckBoxListPanel.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.guiutils; -import org.sleuthkit.autopsy.guiutils.CheckBoxJList; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; From f69bf58f58d1473718491ac37092ef829b7c32fe Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Fri, 22 May 2020 12:55:41 -0400 Subject: [PATCH 14/15] Fixed the nightly tests by adding an additional click to the HTML report testing --- .../src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java index 8ad09e4921..20e82d96e7 100644 --- a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java +++ b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java @@ -385,6 +385,12 @@ public class AutopsyTestCases { listOperator.clickOnItem(0, 1); jbo0.pushNoBlock(); new Timeout("pausing", 2000).sleep(); + + // Next button on the data source selection panel + JButtonOperator dataSourceSelectionPanelNext = new JButtonOperator(reportDialogOperator, "Next"); + dataSourceSelectionPanelNext.pushNoBlock(); + new Timeout("pausing", 2000).sleep(); + JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator, "Finish"); jbo1.pushNoBlock(); JDialog previewDialog = JDialogOperator.waitJDialog("Progress", false, false); From 47b143ca3b11e3aac0950cf384ad12faaaa74f15 Mon Sep 17 00:00:00 2001 From: apriestman Date: Tue, 26 May 2020 07:40:34 -0400 Subject: [PATCH 15/15] Add notes to experimental module pages about enabling the module. --- docs/doxygen-user/auto_ingest.dox | 2 ++ docs/doxygen-user/object_detection.dox | 2 ++ docs/doxygen-user/volatility_dsp.dox | 2 ++ 3 files changed, 6 insertions(+) diff --git a/docs/doxygen-user/auto_ingest.dox b/docs/doxygen-user/auto_ingest.dox index 3957e7c922..f1191bebc2 100644 --- a/docs/doxygen-user/auto_ingest.dox +++ b/docs/doxygen-user/auto_ingest.dox @@ -4,6 +4,8 @@ Auto ingest allows one or many computers to process \ref ds_page "data sources" automatically with minimal support from a user. The resulting \ref multiuser_page "multi-user cases" can be opened and reviewed by analysts, using any of the normal functions in Autopsy. +The \ref experimental_page must be enabled to run use automated ingest. + There are three types of computers in an Automated Processing Deployment:
  • Automated Ingest Node: diff --git a/docs/doxygen-user/object_detection.dox b/docs/doxygen-user/object_detection.dox index 2685b69c41..3ed98fa820 100644 --- a/docs/doxygen-user/object_detection.dox +++ b/docs/doxygen-user/object_detection.dox @@ -4,6 +4,8 @@ The Object Detection module uses OpenCV to try to detect objects in images. +The \ref experimental_page must be enabled to run this module. + \section object_setup Setup To start, you will need some classifiers, which are xml files. Autopsy can not create classifiers - do a web search for "train OpenCV classifiers" to find information on how to make classifiers, or visit the OpenCV page. diff --git a/docs/doxygen-user/volatility_dsp.dox b/docs/doxygen-user/volatility_dsp.dox index be99b7d527..51b137e5fe 100644 --- a/docs/doxygen-user/volatility_dsp.dox +++ b/docs/doxygen-user/volatility_dsp.dox @@ -4,6 +4,8 @@ The Volatility data source processor runs Volatility on a memory image and saves the individual Volatility module results. If the disk image associated with the memory image is also available, it will create Interesting Item artifacts linking the Volatility results to files in the disk image. +The \ref experimental_page must be enabled to run this module. + \section Usage If you have a disk image associated with your memory image, ingest the disk image into the case first. Then go to "Add Data Source" and select "Memory Image File".