Merge pull request #5853 from dannysmyda/5956-reporting-on-datasources

5956 reporting on datasources
This commit is contained in:
Richard Cordovano 2020-05-21 13:59:19 -04:00 committed by GitHub
commit 4b8cba6dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 592 additions and 82 deletions

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
CheckBoxListPanel.titleLabel.text=
CheckBoxListPanel.checkButton.text=Check All
CheckBoxListPanel.uncheckButton.text=Uncheck All

View File

@ -1,3 +1,6 @@
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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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.guiutils;
import java.awt.BorderLayout;
import java.awt.Component;

View File

@ -19,7 +19,7 @@
<Component class="javax.swing.JLabel" name="titleLabel">
<Properties>
<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/guiutils/Bundle.properties" key="CheckBoxListPanel.titleLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
@ -31,7 +31,7 @@
<Component class="javax.swing.JButton" name="uncheckButton">
<Properties>
<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/guiutils/Bundle.properties" key="CheckBoxListPanel.uncheckButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
@ -46,7 +46,7 @@
<Component class="javax.swing.JButton" name="checkButton">
<Properties>
<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/guiutils/Bundle.properties" key="CheckBoxListPanel.checkButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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.guiutils;
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<T> extends javax.swing.JPanel {
public final class CheckBoxListPanel<T> extends javax.swing.JPanel {
private static final long serialVersionUID = 1L;
@ -38,7 +38,7 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
/**
* Creates new CheckboxFilterPanel
*/
CheckBoxListPanel() {
public CheckBoxListPanel() {
initComponents();
checkboxList = new CheckBoxJList<>();
@ -52,7 +52,7 @@ final class CheckBoxListPanel<T> 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<T> newCheckBox = new ObjectCheckBox<>(displayName, icon, true, obj);
if(!model.contains(newCheckBox)) {
@ -63,11 +63,11 @@ final class CheckBoxListPanel<T> 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<T> extends javax.swing.JPanel {
*
* @return List of selected elements.
*/
List<T> getSelectedElements() {
public List<T> getSelectedElements() {
List<T> selectedElements = new ArrayList<>();
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
*/
void setSetAllSelected(boolean selected) {
public void setSetAllSelected(boolean selected) {
Enumeration<ObjectCheckBox<T>> enumeration = model.elements();
while (enumeration.hasMoreElements()) {
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.
*/
void setPanelTitle(String title) {
public void setPanelTitle(String 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
*/
void setPanelTitleIcon(Icon icon) {
public void setPanelTitleIcon(Icon icon) {
titleLabel.setIcon(icon);
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2018 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -25,10 +25,43 @@ 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
*
* @deprecated Use generateReport(GeneralReportSettings settings,
* ReportProgressPanel progressPanel) instead. The baseReportDir
* is stored in the settings instance.
*/
@Deprecated
default void generateReport(String baseReportDir, ReportProgressPanel progressPanel) {
}
/**
* Called to generate the report. Method is responsible for saving the file
* 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 settings Configuration parameters to customize the report
* generation process
* @param progressPanel panel to update the report's progress with
*/
public void generateReport(String baseReportDir, ReportProgressPanel progressPanel);
@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;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2014 Basis Technology Corp.
* Copyright 2014-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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() {

View File

@ -0,0 +1,65 @@
/*
* 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> selectedDataSources;
private String reportDirectoryPath;
/**
* Returns the selected data sources
* @return List of data source ids
*/
public List<Long> getSelectedDataSources() {
return selectedDataSources;
}
/**
* Sets the selected data sources
* @param selectedDataSources List of data source ids
*/
public void setSelectedDataSources(List<Long> 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;
}
}

View File

@ -15,6 +15,10 @@ 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
ReportWizardFileOptionsVisualPanel.selectAllButton.text=Select All

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<FileReportDataTypes, Boolean> filePropertiesInfo = new HashMap<>();
private List<Long> selectedDataSources;
/**
* Creates FileReportSettings object.
@ -49,4 +52,18 @@ final class FileReportSettings implements Serializable {
Map<FileReportDataTypes, Boolean> getFileProperties() {
return filePropertiesInfo;
}
/**
* Returns the selected data sources
*/
List<Long> getSelectedDataSources() {
return selectedDataSources;
}
/**
* Sets the selected data sources
*/
void setSelectedDataSources(List<Long> selectedDataSources) {
this.selectedDataSources = new ArrayList<>(selectedDataSources);
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2019 Basis Technology Corp.
* Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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,12 @@ 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);
reportSettings.setReportDirectoryPath(reportDir);
generalReportModule.generateReport(reportSettings, progressIndicator);
}
}
@ -359,6 +361,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;
@ -380,6 +386,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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2019 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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);
}

View File

@ -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 <at> 42six <dot> 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,25 @@ 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<Long> selectedDataSourceIds = (List<Long>) 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();
if(selectedDataSourceIds != null) {
generalSettings.setSelectedDataSources(selectedDataSourceIds);
if(fileSettings != null) {
fileSettings.setSelectedDataSources(selectedDataSourceIds);
}
if(tableSettings != null) {
tableSettings.setSelectedDataSources(selectedDataSourceIds);
}
}
reportingConfig.setFileReportSettings(fileSettings);
reportingConfig.setTableReportSettings(tableSettings);
reportingConfig.setGeneralReportSettings(generalSettings);
Map<String, ReportModuleConfig> moduleConfigs = (Map<String, ReportModuleConfig>) wiz.getProperty("moduleConfigs");

View File

@ -0,0 +1,151 @@
/*
* 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.guiutils.CheckBoxListPanel;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
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;
private final JButton nextButton;
@NbBundle.Messages({
"ReportWizardDataSourceSelectionPanel.nextButton.text=Next",
"ReportWizardDataSourceSelectionPanel.finishButton.text=Finish"
})
public ReportWizardDataSourceSelectionPanel() {
nextButton = new JButton(Bundle.ReportWizardDataSourceSelectionPanel_nextButton_text());
finishButton = new JButton(Bundle.ReportWizardDataSourceSelectionPanel_finishButton_text());
finishButton.setEnabled(false);
nextButton.setEnabled(false);
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({
"ReportWizardDataSourceSelectionPanel.title=Select which datasource(s) to include"
})
@Override
public CheckBoxListPanel<Long> getComponent() {
if (dataSourcesSelectionPanel == null) {
dataSourcesSelectionPanel = new CheckBoxListPanel<>();
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, nextButton, finishButton, WizardDescriptor.CANCEL_OPTION});
boolean generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS
nextButton.setEnabled(!generalModule);
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
*
* Copyright 2012 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<WizardDesc
private final ReportWizardPanel2 tableConfigPanel;
private final ReportWizardFileOptionsPanel fileConfigPanel;
private final ReportWizardPortableCaseOptionsPanel portableCaseConfigPanel;
private final ReportWizardDataSourceSelectionPanel dataSourceSelectionPanel;
private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
@ -78,8 +80,10 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
fileConfigPanel = new ReportWizardFileOptionsPanel(null);
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null, useCaseSpecificData);
}
dataSourceSelectionPanel = new ReportWizardDataSourceSelectionPanel();
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, dataSourceSelectionPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
tableConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel};
fileConfigPanels = new WizardDescriptor.Panel[]{firstPanel, fileConfigPanel};
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 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) {
// General Module selected, no additional panels
if(showDataSourceSelectionPanel) {
panels = Arrays.asList(firstPanel, dataSourceSelectionPanel);
}
} else if (tableModule) {
// Table Module selected, need Artifact Configuration Panel
// (ReportWizardPanel2)
panels = Arrays.asList(tableConfigPanels);
if(showDataSourceSelectionPanel) {
panels = new ArrayList<>(panels);
panels.add(1, dataSourceSelectionPanel);
}
} else if (portableCaseModule) {
// Portable Case Module selected, need Portable Case Configuration Panel
// (ReportWizardPortableCaseOptionsPanel)
@ -128,6 +138,10 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
// File Module selected, need File Report Configuration Panel
// (ReportWizardFileOptionsPanel)
panels = Arrays.asList(fileConfigPanels);
if(showDataSourceSelectionPanel) {
panels = new ArrayList<>(panels);
panels.add(1, dataSourceSelectionPanel);
}
}
}
@ -164,7 +178,8 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("generalModule", true); //NON-NLS
tableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean("tableModule", 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++;

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<String, ReportModuleConfig> 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;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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<String, ReportModuleConfig> 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;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2019 Basis Technology Corp.
* Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -366,6 +366,16 @@ class TableReportGenerator {
// Give the modules the rows for the content tags.
for (ContentTag tag : tags) {
try {
if(shouldFilterFromReport(tag.getContent())) {
continue;
}
} catch (TskCoreException ex) {
errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetContentTags"));
logger.log(Level.SEVERE, "Failed to access content data from the case database.", 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 +456,16 @@ class TableReportGenerator {
// Give the modules the rows for the content tags.
for (BlackboardArtifactTag tag : tags) {
try {
if(shouldFilterFromReport(tag.getContent())) {
continue;
}
} catch (TskCoreException ex) {
errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags"));
logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS
return;
}
String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : "";
if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) {
continue;
@ -799,6 +819,9 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath();
if(shouldFilterFromReport(f)) {
continue;
}
}
} catch (TskCoreException ex) {
errorList.add(
@ -956,6 +979,9 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath();
if(shouldFilterFromReport(f)) {
continue;
}
}
} catch (TskCoreException ex) {
errorList.add(
@ -1198,6 +1224,10 @@ class TableReportGenerator {
List<ArtifactData> artifacts = new ArrayList<>();
try {
for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) {
if(shouldFilterFromReport(artifact)) {
continue;
}
List<BlackboardArtifactTag> tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact);
HashSet<String> uniqueTagNames = new HashSet<>();
for (BlackboardArtifactTag tag : tags) {
@ -1792,6 +1822,18 @@ class TableReportGenerator {
return "";
}
/**
* 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.getSelectedDataSources().contains(dataSourceId);
}
/**
* Get any tags associated with an artifact

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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 boolean useStoredTagsAndArtifactsLists;
private final TableReportOption reportOption;
private List<Long> selectedDataSources;
/**
* Creates TableReportSettings object. This constructor is used when user
@ -99,4 +100,18 @@ final class TableReportSettings implements Serializable {
TableReportOption getSelectedReportOption() {
return reportOption;
}
/**
* Returns the selected data sources
*/
List<Long> getSelectedDataSources() {
return selectedDataSources;
}
/**
* Sets the selected data sources
*/
void setSelectedDataSources(List<Long> selectedDataSources) {
this.selectedDataSources = new ArrayList<>(selectedDataSources);
}
}

View File

@ -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 <at> 42six <dot> 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<AbstractFile> fs = skCase.findAllFilesWhere(query);
// Filter the list to only include files that are contained within
// the set of data sources to process.
List<AbstractFile> 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 = "";

View File

@ -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<Content> dataSources = caseObj.getDataSources();
List<Content> 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();

View File

@ -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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2018 Basis Technology Corp.
* Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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:"

View File

@ -13,7 +13,7 @@ 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=<span>Warning, this report was run before ingest services completed!</span>

View File

@ -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:"
})

View File

@ -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<Waypoint> waypointList = null;
@ -151,17 +156,41 @@ public final class KMLReport implements GeneralReportModule {
public void generateReport(String baseReportDir, ReportProgressPanel progressPanel, List<Waypoint> waypointList) {
this.waypointList = waypointList;
generateReport(baseReportDir, progressPanel);
GeneralReportSettings reportSettings = new GeneralReportSettings();
reportSettings.setReportDirectoryPath(baseReportDir);
generateReport(reportSettings, progressPanel);
}
@Override
public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) {
public boolean supportsDataSourceSelection() {
return true;
}
@Override
public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) {
try {
currentCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
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<Long> 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
progressPanel.setIndeterminate(true);
progressPanel.start();
@ -181,7 +210,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;
@ -318,8 +347,12 @@ public final class KMLReport implements GeneralReportModule {
*
* @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) {
if(shouldFilterFromReport(point.getArtifact())) {
continue;
}
Element mapPoint = makePoint(point);
if (mapPoint == null) {
return;
@ -352,7 +385,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,8 +409,11 @@ 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<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) {
if(shouldFilterFromReport(point.getArtifact())) {
continue;
}
addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude());
}
}
@ -408,7 +444,7 @@ public final class KMLReport implements GeneralReportModule {
*
* @throws TskCoreException
*/
void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException {
void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException {
List<Route> routes = null;
if (waypointList == null) {
@ -418,7 +454,10 @@ public final class KMLReport implements GeneralReportModule {
}
for (Route route : routes) {
addRouteToReport(route);
if(shouldFilterFromReport(route.getArtifact())) {
continue;
}
addRouteToReport(route);
}
}
@ -479,7 +518,7 @@ public final class KMLReport implements GeneralReportModule {
*
* @throws TskCoreException
*/
void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException {
void makeTracks(SleuthkitCase skCase) throws GeoLocationDataException, TskCoreException {
List<Track> tracks = null;
if (waypointList == null) {
@ -489,6 +528,9 @@ public final class KMLReport implements GeneralReportModule {
}
for (Track track : tracks) {
if(shouldFilterFromReport(track.getArtifact())) {
continue;
}
addTrackToReport(track);
}
}
@ -877,4 +919,15 @@ 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 {
if(this.settings.getSelectedDataSources() == null) {
return false;
}
long dataSourceId = content.getDataSource().getId();
return !this.settings.getSelectedDataSources().contains(dataSourceId);
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 - 2018 Basis Technology Corp.
* Copyright 2013 - 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> 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();