merge from develop

This commit is contained in:
Greg DiCristofaro 2020-08-06 07:05:01 -04:00
commit 5ea72a518b
6 changed files with 45 additions and 44 deletions

View File

@ -31,7 +31,9 @@ import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.table.AbstractTableModel;
import org.openide.util.NbBundle.Messages;
import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.IngestModuleInfo;
@ -47,6 +49,8 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(IngestJobInfoPanel.class.getName());
private static final Set<IngestManager.IngestJobEvent> INGEST_JOB_EVENTS_OF_INTEREST = EnumSet.of(IngestManager.IngestJobEvent.STARTED, IngestManager.IngestJobEvent.CANCELLED, IngestManager.IngestJobEvent.COMPLETED);
private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.CURRENT_CASE);
private List<IngestJobInfo> ingestJobs;
private final List<IngestJobInfo> ingestJobsForSelectedDataSource = new ArrayList<>();
private IngestJobTableModel ingestJobTableModel = new IngestJobTableModel();
@ -79,6 +83,16 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
refresh();
}
});
Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, (PropertyChangeEvent evt) -> {
if (!(evt instanceof AutopsyEvent) || (((AutopsyEvent) evt).getSourceType() != AutopsyEvent.SourceType.LOCAL)) {
return;
}
if (CURRENT_CASE == Case.Events.valueOf(evt.getPropertyName())) {
refresh();
}
});
}
/**
@ -110,9 +124,15 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel {
*/
private void refresh() {
try {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
this.ingestJobs = skCase.getIngestJobs();
setDataSource(selectedDataSource);
if (Case.isCaseOpen()) {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
this.ingestJobs = skCase.getIngestJobs();
setDataSource(selectedDataSource);
} else {
this.ingestJobs = new ArrayList<>();
setDataSource(null);
}
} catch (TskCoreException | NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Failed to load ingest jobs.", ex);
JOptionPane.showMessageDialog(this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);

View File

@ -304,7 +304,7 @@ final class DataSourceInfoUtilities {
* @return The concatenated string or null if the query could not be
* executed.
*/
private static String getConcattedStringQuery(String query, String valueParam, String separator, String errorMessage, String singleErrorMessage) {
private static String getConcattedStringsResult(String query, String valueParam, String separator, String errorMessage, String singleErrorMessage) {
ResultSetHandler<String> handler = (resultSet) -> {
String toRet = "";
boolean first = true;
@ -350,7 +350,7 @@ final class DataSourceInfoUtilities {
String errorMessage = "Unable to execute query to retrieve concatted attribute values.";
String singleErrorMessage = "There was an error retrieving one of the results. That result will be omitted from concatted value.";
String separator = ", ";
return getConcattedStringQuery(query, valueParam, separator, errorMessage, singleErrorMessage);
return getConcattedStringsResult(query, valueParam, separator, errorMessage, singleErrorMessage);
}
/**

View File

@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.casemodule.datasourcesummary;
import javax.swing.JTabbedPane;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel;
import org.sleuthkit.datamodel.DataSource;
@ -31,13 +30,10 @@ import org.sleuthkit.datamodel.DataSource;
public class DataSourceSummaryTabbedPane extends JTabbedPane {
private static final long serialVersionUID = 1L;
private final DataSourceSummaryCountsPanel countsPanel;
private final DataSourceSummaryDetailsPanel detailsPanel;
private final DataSourceSummaryUserActivityPanel userActivityPanel;
// ingest panel requires an open case in order to properly initialize.
// So it will be instantiated when a data source is selected.
private IngestJobInfoPanel ingestHistoryPanel = null;
private final IngestJobInfoPanel ingestHistoryPanel;
private DataSource dataSource = null;
@ -47,34 +43,11 @@ public class DataSourceSummaryTabbedPane extends JTabbedPane {
public DataSourceSummaryTabbedPane() {
countsPanel = new DataSourceSummaryCountsPanel();
detailsPanel = new DataSourceSummaryDetailsPanel();
userActivityPanel = new DataSourceSummaryUserActivityPanel();
}
/**
* Set tabs to the details panel, counts panel, and ingest history panel. If
* no data source or case is closed, no tabs will be shwon.
*
* @param dataSource The data source to display.
*/
private void setTabs(DataSource dataSource) {
this.removeAll();
if (dataSource != null && Case.isCaseOpen()) {
addTab(Bundle.DataSourceSummaryDialog_detailsTab_title(), detailsPanel);
detailsPanel.setDataSource(dataSource);
addTab(Bundle.DataSourceSummaryDialog_countsTab_title(), countsPanel);
countsPanel.setDataSource(dataSource);
addTab(Bundle.DataSourceSummaryUserActivityPanel_tab_title(), userActivityPanel);
userActivityPanel.setDataSource(dataSource);
if (ingestHistoryPanel == null) {
ingestHistoryPanel = new IngestJobInfoPanel();
}
addTab(Bundle.DataSourceSummaryDialog_ingestHistoryTab_title(), ingestHistoryPanel);
ingestHistoryPanel.setDataSource(dataSource);
}
ingestHistoryPanel = new IngestJobInfoPanel();
addTab(Bundle.DataSourceSummaryDialog_detailsTab_title(), detailsPanel);
addTab(Bundle.DataSourceSummaryDialog_countsTab_title(), countsPanel);
addTab(Bundle.DataSourceSummaryDialog_ingestHistoryTab_title(), ingestHistoryPanel);
}
/**
@ -93,6 +66,9 @@ public class DataSourceSummaryTabbedPane extends JTabbedPane {
*/
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
setTabs(dataSource);
detailsPanel.setDataSource(dataSource);
countsPanel.setDataSource(dataSource);
ingestHistoryPanel.setDataSource(dataSource);
}
}

View File

@ -24,7 +24,8 @@ import javax.swing.table.DefaultTableModel;
* A Table model where cells are not editable.
*/
class NonEditableTableModel extends DefaultTableModel {
private static final long serialVersionUID = 1L;
NonEditableTableModel(Object[][] data, Object[] columnNames) {
super(data, columnNames);
}

View File

@ -109,10 +109,12 @@ public class SaveSnapshotAsReport extends Action {
String reportName = JOptionPane.showInputDialog(SwingUtilities.windowForComponent(controller.getTopComponent()), message,
Bundle.SaveSnapShotAsReport_action_dialogs_title(), JOptionPane.QUESTION_MESSAGE);
// if reportName is null then cancel was selected, if reportName is empty then ok was selected and no report name specified
if (reportName != null) {
reportName = StringUtils.defaultIfBlank(reportName, defaultReportName);
reportName = StringUtils.defaultIfBlank(reportName, defaultReportName);
createReport(controller, reportName, generationDate, snapshot);
createReport(controller, reportName, generationDate, snapshot);
}
});
});
}

View File

@ -272,6 +272,8 @@ final class ExtractPrefetch extends Extract {
new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getName(),
applicationName),//NON-NLS
new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH, getName(), filePath),
new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, getName(),
executionTime),