mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Fixed a bug in portable case UI panels
This commit is contained in:
parent
24fe6e35bb
commit
0c68f4aa3d
@ -60,12 +60,14 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||||
private final PortableCaseReportModuleSettings settings;
|
private final PortableCaseReportModuleSettings settings;
|
||||||
|
private final boolean useCaseSpecificData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form PortableCaseListPanel
|
* Creates new form PortableCaseListPanel
|
||||||
*/
|
*/
|
||||||
PortableCaseInterestingItemsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options) {
|
PortableCaseInterestingItemsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options, boolean useCaseSpecificData) {
|
||||||
this.wizPanel = wizPanel;
|
this.wizPanel = wizPanel;
|
||||||
|
this.useCaseSpecificData = useCaseSpecificData;
|
||||||
this.settings = options;
|
this.settings = options;
|
||||||
initComponents();
|
initComponents();
|
||||||
customizeComponents();
|
customizeComponents();
|
||||||
@ -98,26 +100,31 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
|
|||||||
// Get the set names in use for the current case.
|
// Get the set names in use for the current case.
|
||||||
setNames = new ArrayList<>();
|
setNames = new ArrayList<>();
|
||||||
setCounts = new HashMap<>();
|
setCounts = new HashMap<>();
|
||||||
try {
|
|
||||||
// There may not be a case open when configuring report modules for Command Line execution
|
// only try to load tag names if we are displaying case specific data, otherwise
|
||||||
// Get all SET_NAMEs from interesting item artifacts
|
// we will be displaying case specific data in command line wizard if there is
|
||||||
String innerSelect = "SELECT (value_text) AS set_name FROM blackboard_attributes WHERE (artifact_type_id = '" +
|
// a case open in the background
|
||||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + "' OR artifact_type_id = '" +
|
if (useCaseSpecificData) {
|
||||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() + "') AND attribute_type_id = '" +
|
try {
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + "'"; // NON-NLS
|
// Get all SET_NAMEs from interesting item artifacts
|
||||||
|
String innerSelect = "SELECT (value_text) AS set_name FROM blackboard_attributes WHERE (artifact_type_id = '"
|
||||||
// Get the count of each SET_NAME
|
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + "' OR artifact_type_id = '"
|
||||||
String query = "set_name, count(1) AS set_count FROM (" + innerSelect + ") set_names GROUP BY set_name"; // NON-NLS
|
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() + "') AND attribute_type_id = '"
|
||||||
|
+ BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + "'"; // NON-NLS
|
||||||
GetInterestingItemSetNamesCallback callback = new GetInterestingItemSetNamesCallback();
|
|
||||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
// Get the count of each SET_NAME
|
||||||
setCounts = callback.getSetCountMap();
|
String query = "set_name, count(1) AS set_count FROM (" + innerSelect + ") set_names GROUP BY set_name"; // NON-NLS
|
||||||
setNames.addAll(setCounts.keySet());
|
|
||||||
} catch (TskCoreException ex) {
|
GetInterestingItemSetNamesCallback callback = new GetInterestingItemSetNamesCallback();
|
||||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get interesting item set names", ex); // NON-NLS
|
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||||
} catch (NoCurrentCaseException ex) {
|
setCounts = callback.getSetCountMap();
|
||||||
// There may not be a case open when configuring report modules for Command Line execution
|
setNames.addAll(setCounts.keySet());
|
||||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
|
} catch (TskCoreException ex) {
|
||||||
|
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get interesting item set names", ex); // NON-NLS
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
// There may not be a case open when configuring report modules for Command Line execution
|
||||||
|
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(setNames);
|
Collections.sort(setNames);
|
||||||
|
|
||||||
|
@ -60,12 +60,14 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||||
private final PortableCaseReportModuleSettings settings;
|
private final PortableCaseReportModuleSettings settings;
|
||||||
|
private final boolean useCaseSpecificData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form PortableCaseListPanel
|
* Creates new form PortableCaseListPanel
|
||||||
*/
|
*/
|
||||||
PortableCaseTagsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options) {
|
PortableCaseTagsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options, boolean useCaseSpecificData) {
|
||||||
this.wizPanel = wizPanel;
|
this.wizPanel = wizPanel;
|
||||||
|
this.useCaseSpecificData = useCaseSpecificData;
|
||||||
this.settings = options;
|
this.settings = options;
|
||||||
initComponents();
|
initComponents();
|
||||||
customizeComponents();
|
customizeComponents();
|
||||||
@ -95,18 +97,23 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
|
|||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
// Get the tag names in use for the current case.
|
// Get the tag names in use for the current case.
|
||||||
tagNames = new ArrayList<>();
|
tagNames = new ArrayList<>();
|
||||||
|
Map<Long, Long> tagCountsByID = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
// There may not be a case open when configuring report modules for Command Line execution
|
// only try to load tag names if we are displaying case specific data, otherwise
|
||||||
tagNames = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
// we will be displaying case specific data in command line wizard if there is
|
||||||
|
// a case open in the background
|
||||||
// Get the counts for each tag ID
|
if (useCaseSpecificData) {
|
||||||
String query = "tag_name_id, count(1) AS tag_count " +
|
tagNames = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||||
"FROM (" +
|
|
||||||
"SELECT tag_name_id FROM content_tags UNION ALL SELECT tag_name_id FROM blackboard_artifact_tags" +
|
// Get the counts for each tag ID
|
||||||
") tag_ids GROUP BY tag_name_id"; // NON-NLS
|
String query = "tag_name_id, count(1) AS tag_count "
|
||||||
GetTagCountsCallback callback = new GetTagCountsCallback();
|
+ "FROM ("
|
||||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
+ "SELECT tag_name_id FROM content_tags UNION ALL SELECT tag_name_id FROM blackboard_artifact_tags"
|
||||||
Map<Long, Long> tagCountsByID = callback.getTagCountMap();
|
+ ") tag_ids GROUP BY tag_name_id"; // NON-NLS
|
||||||
|
GetTagCountsCallback callback = new GetTagCountsCallback();
|
||||||
|
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||||
|
tagCountsByID = callback.getTagCountMap();
|
||||||
|
}
|
||||||
|
|
||||||
// Mark the tag names as unselected. Note that tagNameSelections is a
|
// Mark the tag names as unselected. Note that tagNameSelections is a
|
||||||
// LinkedHashMap so that order is preserved and the tagNames and tagNameSelections
|
// LinkedHashMap so that order is preserved and the tagNames and tagNameSelections
|
||||||
|
@ -146,7 +146,8 @@ final class ReportVisualPanel2 extends JPanel {
|
|||||||
// by user. We should read tag names from the database each time.
|
// by user. We should read tag names from the database each time.
|
||||||
try {
|
try {
|
||||||
// only try to load tag names if we are displaying case specific data, otherwise
|
// only try to load tag names if we are displaying case specific data, otherwise
|
||||||
// there may not be a case open.
|
// we will be displaying case specific data in command line wizard if there is
|
||||||
|
// a case open in the background
|
||||||
if (useCaseSpecificData) {
|
if (useCaseSpecificData) {
|
||||||
// get tags and artifact types from current case
|
// get tags and artifact types from current case
|
||||||
tagNamesInUse = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
tagNamesInUse = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.report.infrastructure;
|
package org.sleuthkit.autopsy.report.infrastructure;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.report.infrastructure.ReportingConfigLoader;
|
|
||||||
import org.sleuthkit.autopsy.report.infrastructure.ReportConfigException;
|
|
||||||
import org.sleuthkit.autopsy.report.infrastructure.ReportingConfig;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -74,12 +71,12 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
|
|||||||
firstPanel = new ReportWizardPanel1(config.getModuleConfigs());
|
firstPanel = new ReportWizardPanel1(config.getModuleConfigs());
|
||||||
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, config.getTableReportSettings());
|
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, config.getTableReportSettings());
|
||||||
fileConfigPanel = new ReportWizardFileOptionsPanel(config.getFileReportSettings());
|
fileConfigPanel = new ReportWizardFileOptionsPanel(config.getFileReportSettings());
|
||||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(config.getModuleConfigs());
|
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(config.getModuleConfigs(), useCaseSpecificData);
|
||||||
} else {
|
} else {
|
||||||
firstPanel = new ReportWizardPanel1(null);
|
firstPanel = new ReportWizardPanel1(null);
|
||||||
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, null);
|
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, null);
|
||||||
fileConfigPanel = new ReportWizardFileOptionsPanel(null);
|
fileConfigPanel = new ReportWizardFileOptionsPanel(null);
|
||||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null);
|
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null, useCaseSpecificData);
|
||||||
}
|
}
|
||||||
|
|
||||||
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
|
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
|
||||||
|
@ -37,9 +37,11 @@ class ReportWizardPortableCaseOptionsPanel implements WizardDescriptor.Finishabl
|
|||||||
private ReportWizardPortableCaseOptionsVisualPanel component;
|
private ReportWizardPortableCaseOptionsVisualPanel component;
|
||||||
private final JButton finishButton;
|
private final JButton finishButton;
|
||||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||||
|
private final boolean useCaseSpecificData;
|
||||||
|
|
||||||
ReportWizardPortableCaseOptionsPanel(Map<String, ReportModuleConfig> moduleConfigs) {
|
ReportWizardPortableCaseOptionsPanel(Map<String, ReportModuleConfig> moduleConfigs, boolean useCaseSpecificData) {
|
||||||
this.moduleConfigs = moduleConfigs;
|
this.moduleConfigs = moduleConfigs;
|
||||||
|
this.useCaseSpecificData = useCaseSpecificData;
|
||||||
finishButton = new JButton(
|
finishButton = new JButton(
|
||||||
NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text"));
|
NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text"));
|
||||||
finishButton.setEnabled(false);
|
finishButton.setEnabled(false);
|
||||||
@ -69,7 +71,7 @@ class ReportWizardPortableCaseOptionsPanel implements WizardDescriptor.Finishabl
|
|||||||
@Override
|
@Override
|
||||||
public ReportWizardPortableCaseOptionsVisualPanel getComponent() {
|
public ReportWizardPortableCaseOptionsVisualPanel getComponent() {
|
||||||
if (component == null) {
|
if (component == null) {
|
||||||
component = new ReportWizardPortableCaseOptionsVisualPanel(this, moduleConfigs);
|
component = new ReportWizardPortableCaseOptionsVisualPanel(this, moduleConfigs, useCaseSpecificData);
|
||||||
}
|
}
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,14 @@ class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel {
|
|||||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||||
private PortableCaseReportModuleSettings settings = null;
|
private PortableCaseReportModuleSettings settings = null;
|
||||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||||
|
private final boolean useCaseSpecificData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form ReportWizardPortableCaseOptionsVisualPanel
|
* Creates new form ReportWizardPortableCaseOptionsVisualPanel
|
||||||
*/
|
*/
|
||||||
ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map<String, ReportModuleConfig> moduleConfigs) {
|
ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map<String, ReportModuleConfig> moduleConfigs, boolean useCaseSpecificData) {
|
||||||
this.wizPanel = wizPanel;
|
this.wizPanel = wizPanel;
|
||||||
|
this.useCaseSpecificData = useCaseSpecificData;
|
||||||
this.moduleConfigs = moduleConfigs;
|
this.moduleConfigs = moduleConfigs;
|
||||||
initComponents();
|
initComponents();
|
||||||
customizeComponents();
|
customizeComponents();
|
||||||
@ -86,8 +88,8 @@ class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
// initialize other panels and pass them the settings
|
// initialize other panels and pass them the settings
|
||||||
listPanel.setLayout(new GridLayout(1,2));
|
listPanel.setLayout(new GridLayout(1,2));
|
||||||
listPanel.add(new PortableCaseTagsListPanel(wizPanel, settings));
|
listPanel.add(new PortableCaseTagsListPanel(wizPanel, settings, useCaseSpecificData));
|
||||||
listPanel.add(new PortableCaseInterestingItemsListPanel(wizPanel, settings));
|
listPanel.add(new PortableCaseInterestingItemsListPanel(wizPanel, settings, useCaseSpecificData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user