Implemented data source selection and updated the HTML and KML modules to respond to these selections

This commit is contained in:
U-BASIS\dsmyda 2020-04-27 11:07:57 -04:00
parent f6be370a84
commit 05a1046ec3
21 changed files with 441 additions and 60 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.geolocation; package org.sleuthkit.autopsy.corecomponents;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;

View File

@ -19,7 +19,7 @@
<Component class="javax.swing.JLabel" name="titleLabel"> <Component class="javax.swing.JLabel" name="titleLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/geolocation/Bundle.properties" key="CheckBoxListPanel.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="CheckBoxListPanel.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Constraints> <Constraints>
@ -31,7 +31,7 @@
<Component class="javax.swing.JButton" name="uncheckButton"> <Component class="javax.swing.JButton" name="uncheckButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/geolocation/Bundle.properties" key="CheckBoxListPanel.uncheckButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="CheckBoxListPanel.uncheckButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
@ -46,7 +46,7 @@
<Component class="javax.swing.JButton" name="checkButton"> <Component class="javax.swing.JButton" name="checkButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/geolocation/Bundle.properties" key="CheckBoxListPanel.checkButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="CheckBoxListPanel.checkButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.geolocation; package org.sleuthkit.autopsy.corecomponents;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
@ -26,9 +26,9 @@ import javax.swing.DefaultListModel;
import javax.swing.Icon; 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<T> extends javax.swing.JPanel { public final class CheckBoxListPanel<T> extends javax.swing.JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -38,7 +38,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
/** /**
* Creates new CheckboxFilterPanel * Creates new CheckboxFilterPanel
*/ */
CheckBoxListPanel() { public CheckBoxListPanel() {
initComponents(); initComponents();
checkboxList = new CheckBoxJList<>(); checkboxList = new CheckBoxJList<>();
@ -52,7 +52,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* @param displayName display name for the checkbox * @param displayName display name for the checkbox
* @param obj Object that the checkbox represents * @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<T> newCheckBox = new ObjectCheckBox<>(displayName, icon, true, obj); ObjectCheckBox<T> newCheckBox = new ObjectCheckBox<>(displayName, icon, true, obj);
if(!model.contains(newCheckBox)) { if(!model.contains(newCheckBox)) {
@ -63,11 +63,11 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
/** /**
* Remove all objects from the checkbox list. * Remove all objects from the checkbox list.
*/ */
void clearList() { public void clearList() {
model.removeAllElements(); model.removeAllElements();
} }
boolean isEmpty() { public boolean isEmpty() {
return model.isEmpty(); return model.isEmpty();
} }
@ -84,7 +84,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* *
* @return List of selected elements. * @return List of selected elements.
*/ */
List<T> getSelectedElements() { public List<T> getSelectedElements() {
List<T> selectedElements = new ArrayList<>(); List<T> selectedElements = new ArrayList<>();
Enumeration<ObjectCheckBox<T>> elements = model.elements(); Enumeration<ObjectCheckBox<T>> elements = model.elements();
@ -103,7 +103,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* *
* @param selected True to check the boxes, false to unchecked * @param selected True to check the boxes, false to unchecked
*/ */
void setSetAllSelected(boolean selected) { public void setSetAllSelected(boolean selected) {
Enumeration<ObjectCheckBox<T>> enumeration = model.elements(); Enumeration<ObjectCheckBox<T>> enumeration = model.elements();
while (enumeration.hasMoreElements()) { while (enumeration.hasMoreElements()) {
ObjectCheckBox<T> element = enumeration.nextElement(); ObjectCheckBox<T> element = enumeration.nextElement();
@ -119,7 +119,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* *
* @param title Panel title or null for no title. * @param title Panel title or null for no title.
*/ */
void setPanelTitle(String title) { public void setPanelTitle(String title) {
titleLabel.setText(title); titleLabel.setText(title);
} }
@ -128,7 +128,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* *
* @param icon Icon to set or null for no icon * @param icon Icon to set or null for no icon
*/ */
void setPanelTitleIcon(Icon icon) { public void setPanelTitleIcon(Icon icon) {
titleLabel.setIcon(icon); titleLabel.setIcon(icon);
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.geolocation; package org.sleuthkit.autopsy.geolocation;
import org.sleuthkit.autopsy.corecomponents.CheckBoxListPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;

View File

@ -126,7 +126,7 @@ public class GeoPath {
* *
* @return * @return
*/ */
final BlackboardArtifact getArtifact() { public final BlackboardArtifact getArtifact() {
return artifact; return artifact;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012-2018 Basis Technology Corp. * Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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. * at the path specified and updating progress via the progressPanel object.
* *
* @param baseReportDir Base directory that reports are being stored in. * @param baseReportDir Base directory that reports are being stored in.
* Report should go into baseReportDir + * Report should go into baseReportDir + getRelativeFilePath().
* getRelativeFilePath().
* @param progressPanel panel to update the report's progress with * @param progressPanel panel to update the report's progress with
*/ */
public void generateReport(String baseReportDir, ReportProgressPanel progressPanel); 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);
}
} }

View File

@ -0,0 +1,40 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<Long> dataSourcesToProcess;
public List<Long> getDataSourcesToProcess() {
return dataSourcesToProcess;
}
public void setDataSourcesToProcess(List<Long> dataSourcesToProcess) {
this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess);
}
}

View File

@ -15,6 +15,7 @@ ReportProgressIndicator.completedWithErrorsMessage=Report generation completed w
ReportProgressIndicator.startMessage=Report generation started ReportProgressIndicator.startMessage=Report generation started
ReportProgressIndicator.switchToDeterminateMessage=Report generation progress switched to determinate ReportProgressIndicator.switchToDeterminateMessage=Report generation progress switched to determinate
ReportProgressIndicator.switchToIndeterminateMessage=Report generation progress switched to indeterminate 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.jLabel1.text=Select items to include in File Report:
ReportWizardFileOptionsVisualPanel.deselectAllButton.text=Deselect All ReportWizardFileOptionsVisualPanel.deselectAllButton.text=Deselect All
ReportWizardFileOptionsVisualPanel.selectAllButton.text=Select All ReportWizardFileOptionsVisualPanel.selectAllButton.text=Select All

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,7 +19,9 @@
package org.sleuthkit.autopsy.report.infrastructure; package org.sleuthkit.autopsy.report.infrastructure;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -30,6 +32,7 @@ final class FileReportSettings implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Map<FileReportDataTypes, Boolean> filePropertiesInfo = new HashMap<>(); private Map<FileReportDataTypes, Boolean> filePropertiesInfo = new HashMap<>();
private List<Long> dataSourcesToProcess;
/** /**
* Creates FileReportSettings object. * Creates FileReportSettings object.
@ -49,4 +52,18 @@ final class FileReportSettings implements Serializable {
Map<FileReportDataTypes, Boolean> getFileProperties() { Map<FileReportDataTypes, Boolean> getFileProperties() {
return filePropertiesInfo; return filePropertiesInfo;
} }
/**
* Returns the data sources to process
*/
List<Long> getDataSourcesToProcess() {
return dataSourcesToProcess;
}
/**
* Sets the data sources to process
*/
void setDataSourcesToProcess(List<Long> dataSourcesToProcess) {
this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess);
}
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-2019 Basis Technology Corp. * Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer; import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.autopsy.report.ReportProgressPanel;
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -208,7 +209,7 @@ public class ReportGenerator {
if (module instanceof GeneralReportModule) { if (module instanceof GeneralReportModule) {
// generate report // generate report
generateGeneralReport((GeneralReportModule) module); generateGeneralReport((GeneralReportModule) module, config.getGeneralReportSettings());
} else if (module instanceof TableReportModule) { } else if (module instanceof TableReportModule) {
@ -297,11 +298,11 @@ public class ReportGenerator {
/** /**
* Run the GeneralReportModules using a SwingWorker. * 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) { if (generalReportModule != null) {
String reportDir = createReportDirectory(generalReportModule); String reportDir = createReportDirectory(generalReportModule);
setupProgressPanel(generalReportModule, reportDir); setupProgressPanel(generalReportModule, reportDir);
generalReportModule.generateReport(reportDir, progressIndicator); generalReportModule.generateReport(reportDir, reportSettings, progressIndicator);
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012-2019 Basis Technology Corp. * Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -368,7 +368,9 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener {
configurationPanel.revalidate(); configurationPanel.revalidate();
configurationPanel.repaint(); 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.setNext(!generalModuleSelected);
wizPanel.setFinish(generalModuleSelected); wizPanel.setFinish(generalModuleSelected);

View File

@ -2,7 +2,7 @@
* *
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012-2019 Basis Technology Corp. * Copyright 2012-2020 Basis Technology Corp.
* *
* Copyright 2012 42six Solutions. * Copyright 2012 42six Solutions.
* Contact: aebadirad <at> 42six <dot> com * Contact: aebadirad <at> 42six <dot> com
@ -31,6 +31,7 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.logging.Level; import java.util.logging.Level;
@ -52,6 +53,7 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
import org.sleuthkit.autopsy.report.ReportModule; import org.sleuthkit.autopsy.report.ReportModule;
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.report.infrastructure.ReportWizardAction") @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 { private static void saveReportingConfiguration(String configName, WizardDescriptor wiz) throws ReportConfigException {
ReportingConfig reportingConfig = new ReportingConfig(configName); ReportingConfig reportingConfig = new ReportingConfig(configName);
reportingConfig.setFileReportSettings((FileReportSettings) wiz.getProperty("fileReportSettings")); List<Long> selectedDataSourceIds = (List<Long>) wiz.getProperty("dataSourceSelections");
reportingConfig.setTableReportSettings((TableReportSettings) wiz.getProperty("tableReportSettings"));
// 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<String, ReportModuleConfig> moduleConfigs = (Map<String, ReportModuleConfig>) wiz.getProperty("moduleConfigs"); Map<String, ReportModuleConfig> moduleConfigs = (Map<String, ReportModuleConfig>) wiz.getProperty("moduleConfigs");

View File

@ -0,0 +1,125 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<WizardDescriptor> {
private static final Logger logger = Logger.getLogger(ReportWizardDataSourceSelectionPanel.class.getName());
private CheckBoxListPanel<Long> 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<Long> getComponent() {
if (dataSourcesSelectionPanel == null) {
dataSourcesSelectionPanel = new CheckBoxListPanel<>();
dataSourcesSelectionPanel.setPanelTitle("");
dataSourcesSelectionPanel.setName(Bundle.ReportWizardDataSourceSelectionPanel_title());
try {
List<Content> 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<Long> 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;
}
}

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.report.infrastructure; package org.sleuthkit.autopsy.report.infrastructure;
import java.awt.Component; import java.awt.Component;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
@ -38,6 +39,7 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
private final ReportWizardPanel2 tableConfigPanel; private final ReportWizardPanel2 tableConfigPanel;
private final ReportWizardFileOptionsPanel fileConfigPanel; private final ReportWizardFileOptionsPanel fileConfigPanel;
private final ReportWizardPortableCaseOptionsPanel portableCaseConfigPanel; private final ReportWizardPortableCaseOptionsPanel portableCaseConfigPanel;
private final ReportWizardDataSourceSelectionPanel dataSourceSelectionPanel;
private List<WizardDescriptor.Panel<WizardDescriptor>> panels; private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
@ -79,7 +81,9 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null, useCaseSpecificData); portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null, useCaseSpecificData);
} }
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel}; dataSourceSelectionPanel = new ReportWizardDataSourceSelectionPanel();
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, dataSourceSelectionPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
tableConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel}; tableConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel};
fileConfigPanels = new WizardDescriptor.Panel[]{firstPanel, fileConfigPanel}; fileConfigPanels = new WizardDescriptor.Panel[]{firstPanel, fileConfigPanel};
portableCaseConfigPanels = new WizardDescriptor.Panel[]{firstPanel, portableCaseConfigPanel}; portableCaseConfigPanels = new WizardDescriptor.Panel[]{firstPanel, portableCaseConfigPanel};
@ -113,13 +117,19 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
* @param moreConfig true if a GeneralReportModule was selected * @param moreConfig true if a GeneralReportModule was selected
* @param tableConfig true if a TReportModule was selected * @param tableConfig true if a TReportModule was selected
*/ */
private void enableConfigPanels(boolean generalModule, boolean tableModule, boolean portableCaseModule) { private void enableConfigPanels(boolean generalModule, boolean tableModule, boolean portableCaseModule, boolean showDataSourceSelectionPanel) {
if (generalModule) { if (generalModule) {
// General Module selected, no additional panels if(showDataSourceSelectionPanel) {
panels = Arrays.asList(firstPanel, dataSourceSelectionPanel);
}
} else if (tableModule) { } else if (tableModule) {
// Table Module selected, need Artifact Configuration Panel // Table Module selected, need Artifact Configuration Panel
// (ReportWizardPanel2) // (ReportWizardPanel2)
panels = Arrays.asList(tableConfigPanels); panels = Arrays.asList(tableConfigPanels);
if(showDataSourceSelectionPanel) {
panels = new ArrayList<>(panels);
panels.add(1, dataSourceSelectionPanel);
}
} else if (portableCaseModule) { } else if (portableCaseModule) {
// Portable Case Module selected, need Portable Case Configuration Panel // Portable Case Module selected, need Portable Case Configuration Panel
// (ReportWizardPortableCaseOptionsPanel) // (ReportWizardPortableCaseOptionsPanel)
@ -164,7 +174,8 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS
tableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("tableModule", true); //NON-NLS tableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("tableModule", true); //NON-NLS
portableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("portableCaseModule", true); //NON-NLS portableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("portableCaseModule", true); //NON-NLS
enableConfigPanels(generalModule, tableModule, portableModule); boolean showDataSourceSelectionPanel = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("showDataSourceSelectionPanel", false); // NON-NLS
enableConfigPanels(generalModule, tableModule, portableModule, showDataSourceSelectionPanel);
} }
index++; index++;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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.HelpCtx;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.NbPreferences; 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<WizardDescriptor> { class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel<WizardDescriptor> {
@ -116,8 +117,21 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel<WizardDescr
// Store preferences that WizardIterator will use to determine what // Store preferences that WizardIterator will use to determine what
// panels need to be shown // panels need to be shown
Preferences prefs = NbPreferences.forModule(ReportWizardPanel1.class); Preferences prefs = NbPreferences.forModule(ReportWizardPanel1.class);
prefs.putBoolean("tableModule", getComponent().getTableModule() != null); //NON-NLS TableReportModule tableModuleSelection = getComponent().getTableModule();
prefs.putBoolean("generalModule", getComponent().getGeneralModule() != null); //NON-NLS GeneralReportModule generalModuleSelection = getComponent().getGeneralModule();
prefs.putBoolean("tableModule", tableModuleSelection != null); //NON-NLS
prefs.putBoolean("generalModule", generalModuleSelection != null); //NON-NLS
prefs.putBoolean("portableCaseModule", getComponent().getPortableCaseModule() != null); //NON-NLS prefs.putBoolean("portableCaseModule", getComponent().getPortableCaseModule() != null); //NON-NLS
prefs.putBoolean("showDataSourceSelectionPanel", false);
if(generalModuleSelection != null && generalModuleSelection.supportsDataSourceSelection()) {
prefs.putBoolean("showDataSourceSelectionPanel", true);
}
// HTML reports in initial PR
if(tableModuleSelection != null && tableModuleSelection instanceof HTMLReport) {
prefs.putBoolean("showDataSourceSelectionPanel", true);
}
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
/** /**
* A bundling of all the settings objects that define a report configuration. * A bundling of all the settings objects that define a report configuration.
@ -32,6 +33,7 @@ final class ReportingConfig implements Serializable {
private Map<String, ReportModuleConfig> moduleConfigs = new HashMap<>(); private Map<String, ReportModuleConfig> moduleConfigs = new HashMap<>();
private TableReportSettings tableReportSettings; private TableReportSettings tableReportSettings;
private FileReportSettings fileReportSettings; private FileReportSettings fileReportSettings;
private GeneralReportSettings generalReportSettings;
/** /**
* Creates ReportingConfig object. * Creates ReportingConfig object.
@ -74,4 +76,11 @@ final class ReportingConfig implements Serializable {
return this.fileReportSettings; return this.fileReportSettings;
} }
GeneralReportSettings getGeneralReportSettings() {
return this.generalReportSettings;
}
void setGeneralReportSettings(GeneralReportSettings generalReportSettings) {
this.generalReportSettings = generalReportSettings;
}
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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.openide.util.io.NbObjectOutputStream;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
/** /**
* Utility class responsible for managing serialization and deserialization of * 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 REPORT_SETTINGS_FILE_EXTENSION = ".settings";
private static final String TABLE_REPORT_CONFIG_FILE = "TableReportSettings.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 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"; private static final String MODULE_CONFIG_FILE = "ModuleConfigs.settings";
/** /**
@ -97,6 +99,13 @@ final class ReportingConfigLoader {
throw new ReportConfigException("Unable to read file report settings " + filePath, 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 // read map of module configuration objects
Map<String, ReportModuleConfig> moduleConfigs = null; Map<String, ReportModuleConfig> moduleConfigs = null;
filePath = reportDirPath.toString() + File.separator + MODULE_CONFIG_FILE; filePath = reportDirPath.toString() + File.separator + MODULE_CONFIG_FILE;
@ -174,6 +183,13 @@ final class ReportingConfigLoader {
throw new ReportConfigException("Unable to save file report configuration " + filePath, 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 // save map of module configuration objects
filePath = pathToConfigDir.toString() + File.separator + MODULE_CONFIG_FILE; filePath = pathToConfigDir.toString() + File.separator + MODULE_CONFIG_FILE;
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-2019 Basis Technology Corp. * Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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. // Give the modules the rows for the content tags.
for (ContentTag tag : 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 // skip tags that we are not reporting on
String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : "";
if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) {
@ -446,6 +458,18 @@ class TableReportGenerator {
// Give the modules the rows for the content tags. // Give the modules the rows for the content tags.
for (BlackboardArtifactTag tag : 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() : ""; String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : "";
if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) {
continue; continue;
@ -799,6 +823,11 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) { if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); 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) { } catch (TskCoreException ex) {
errorList.add( errorList.add(
@ -956,6 +985,11 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) { if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); 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) { } catch (TskCoreException ex) {
errorList.add( errorList.add(
@ -1198,6 +1232,12 @@ class TableReportGenerator {
List<ArtifactData> artifacts = new ArrayList<>(); List<ArtifactData> artifacts = new ArrayList<>();
try { try {
for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { 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<BlackboardArtifactTag> tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); List<BlackboardArtifactTag> tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact);
HashSet<String> uniqueTagNames = new HashSet<>(); HashSet<String> uniqueTagNames = new HashSet<>();
for (BlackboardArtifactTag tag : tags) { for (BlackboardArtifactTag tag : tags) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2019 Basis Technology Corp. * Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -45,6 +45,7 @@ final class TableReportSettings implements Serializable {
private final List<String> tagNames = new ArrayList<>(); private final List<String> tagNames = new ArrayList<>();
private final boolean useStoredTagsAndArtifactsLists; private final boolean useStoredTagsAndArtifactsLists;
private final TableReportOption reportOption; private final TableReportOption reportOption;
private List<Long> dataSourcesToProcess;
/** /**
* Creates TableReportSettings object. This constructor is used when user * Creates TableReportSettings object. This constructor is used when user
@ -99,4 +100,18 @@ final class TableReportSettings implements Serializable {
TableReportOption getSelectedReportOption() { TableReportOption getSelectedReportOption() {
return reportOption; return reportOption;
} }
/**
* Returns the data sources to process
*/
List<Long> getDataSourcesToProcess() {
return dataSourcesToProcess;
}
/**
* Sets the data sources to process
*/
void setDataSourcesToProcess(List<Long> dataSourcesToProcess) {
this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess);
}
} }

View File

@ -5,18 +5,18 @@ ReportHTML.getName.text=HTML Report
ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.getDesc.text=A report about results and tagged items in HTML format.
ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.title=for case {0}
ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup.
ReportHTML.writeIndex.noFrames.seeNav=Please see <a href="content\nav.html">the navigation page</a> for artifact links, ReportHTML.writeIndex.noFrames.seeNav=Please see <a href\="content\nav.html">the navigation page</a> for artifact links,
ReportHTML.writeIndex.seeSum=and <a href="contentsummary.html">the summary page</a> for a case summary. ReportHTML.writeIndex.seeSum=and <a href\="content\summary.html">the summary page</a> for a case summary.
ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.title=Report Navigation
ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.h1=Report Navigation
ReportHTML.writeNav.summary=Case Summary ReportHTML.writeNav.summary=Case Summary
ReportHTML.writeSum.case=Case: ReportHTML.writeSum.case=Case:
ReportHTML.writeSum.caseNotes=Notes: ReportHTML.writeSum.caseNotes=Notes:
ReportHTML.writeSum.caseNumber=Case Number: 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.examiner=Examiner:
ReportHTML.writeSum.title=Case Summary ReportHTML.writeSum.title=Case Summary
ReportHTML.writeSum.warningMsg=<span>Warning, this report was run before ingest services completed!</span> ReportHTML.writeSum.warningMsg=<span>Warning, this report was run before ingest services completed\!</span>
# #
# autopsy/test/scripts/regression.py._html_report_diff() uses reportGenOn.text, caseName, caseNum, # 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 # examiner as a regex signature to skip report.html and summary.html

View File

@ -35,6 +35,7 @@ import java.nio.file.Paths;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors;
import org.jdom2.Document; import org.jdom2.Document;
import org.jdom2.Element; import org.jdom2.Element;
import org.jdom2.Namespace; 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.Route;
import org.sleuthkit.autopsy.geolocation.datamodel.Track; import org.sleuthkit.autopsy.geolocation.datamodel.Track;
import org.sleuthkit.autopsy.geolocation.datamodel.WaypointBuilder; import org.sleuthkit.autopsy.geolocation.datamodel.WaypointBuilder;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportBranding;
import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.autopsy.report.ReportProgressPanel;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
@ -81,6 +84,8 @@ public final class KMLReport implements GeneralReportModule {
private Element gpsTrackpointsFolder; private Element gpsTrackpointsFolder;
private Element gpsTracksFolder; private Element gpsTracksFolder;
private GeneralReportSettings settings;
private List<Waypoint> waypointList = null; private List<Waypoint> waypointList = null;
private enum FeatureColor { private enum FeatureColor {
@ -155,13 +160,19 @@ public final class KMLReport implements GeneralReportModule {
} }
@Override @Override
public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { public boolean supportsDataSourceSelection() {
return true;
}
@Override
public void generateReport(String baseReportDir, GeneralReportSettings settings, ReportProgressPanel progressPanel) {
try { try {
currentCase = Case.getCurrentCaseThrows(); currentCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) { } catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
return; return;
} }
this.settings = settings;
// Start the progress bar and setup the report // Start the progress bar and setup the report
progressPanel.setIndeterminate(true); progressPanel.setIndeterminate(true);
progressPanel.start(); progressPanel.start();
@ -181,7 +192,7 @@ public final class KMLReport implements GeneralReportModule {
makeRoutes(skCase); makeRoutes(skCase);
makeTracks(skCase); makeTracks(skCase);
addLocationsToReport(skCase, baseReportDir); addLocationsToReport(skCase, baseReportDir);
} catch (GeoLocationDataException | IOException ex) { } catch (GeoLocationDataException | IOException | TskCoreException ex) {
errorMessage = "Failed to complete report."; errorMessage = "Failed to complete report.";
logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS
result = ReportProgressPanel.ReportStatus.ERROR; result = ReportProgressPanel.ReportStatus.ERROR;
@ -225,6 +236,23 @@ public final class KMLReport implements GeneralReportModule {
progressPanel.complete(result, errorMessage); 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<Long> 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. * Do all of the setting up of elements needed for the report.
* *
@ -318,8 +346,14 @@ public final class KMLReport implements GeneralReportModule {
* *
* @throws IOException * @throws IOException
*/ */
void addExifMetadataContent(List<Waypoint> points, String baseReportDirectory) throws IOException { void addExifMetadataContent(List<Waypoint> points, String baseReportDirectory) throws IOException, TskCoreException {
for (Waypoint point : points) { 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); Element mapPoint = makePoint(point);
if (mapPoint == null) { if (mapPoint == null) {
return; return;
@ -352,7 +386,7 @@ public final class KMLReport implements GeneralReportModule {
* @throws TskCoreException * @throws TskCoreException
* @throws IOException * @throws IOException
*/ */
void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException { void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException, TskCoreException {
if (waypointList == null) { if (waypointList == null) {
addExifMetadataContent(WaypointBuilder.getEXIFWaypoints(skCase), baseReportDir); addExifMetadataContent(WaypointBuilder.getEXIFWaypoints(skCase), baseReportDir);
addWaypoints(WaypointBuilder.getBookmarkWaypoints(skCase), gpsBookmarksFolder, FeatureColor.BLUE, Bundle.Waypoint_Bookmark_Display_String()); addWaypoints(WaypointBuilder.getBookmarkWaypoints(skCase), gpsBookmarksFolder, FeatureColor.BLUE, Bundle.Waypoint_Bookmark_Display_String());
@ -376,11 +410,15 @@ public final class KMLReport implements GeneralReportModule {
* @param folder The Element folder to add the points to * @param folder The Element folder to add the points to
* @param waypointColor The color the waypoint should appear in the report * @param waypointColor The color the waypoint should appear in the report
*/ */
void addWaypoints(List<Waypoint> points, Element folder, FeatureColor waypointColor, String headerLabel) { void addWaypoints(List<Waypoint> points, Element folder, FeatureColor waypointColor, String headerLabel) throws TskCoreException {
for (Waypoint point : points) { 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()); addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude());
} }
} }
}
/** /**
* Adds the waypoint Element with details to the report in the given folder. * Adds the waypoint Element with details to the report in the given folder.
@ -408,7 +446,7 @@ public final class KMLReport implements GeneralReportModule {
* *
* @throws TskCoreException * @throws TskCoreException
*/ */
void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException { void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException {
List<Route> routes = null; List<Route> routes = null;
if (waypointList == null) { if (waypointList == null) {
@ -418,9 +456,13 @@ public final class KMLReport implements GeneralReportModule {
} }
for (Route route : routes) { 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); addRouteToReport(route);
} }
} }
}
/** /**
* Add the given route to the KML report. * Add the given route to the KML report.
@ -479,7 +521,7 @@ public final class KMLReport implements GeneralReportModule {
* *
* @throws TskCoreException * @throws TskCoreException
*/ */
void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException { void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException {
List<Track> tracks = null; List<Track> tracks = null;
if (waypointList == null) { if (waypointList == null) {
@ -489,9 +531,13 @@ public final class KMLReport implements GeneralReportModule {
} }
for (Track track : tracks) { 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); addTrackToReport(track);
} }
} }
}
/** /**
* Add a track to the KML report. * Add a track to the KML report.