From e2db2c2e4467333e94c40144da3d3e7d24a37dc1 Mon Sep 17 00:00:00 2001 From: Eugene Livis Date: Wed, 13 Jan 2021 13:08:48 -0500 Subject: [PATCH 1/6] Fixed a class casting error --- .../src/org/sleuthkit/autopsy/keywordsearch/Ingester.java | 6 +++++- .../LanguageSpecificContentIndexingHelper.java | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Ingester.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Ingester.java index feeea64957..24a42041dd 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Ingester.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Ingester.java @@ -284,7 +284,11 @@ class Ingester { //Make a SolrInputDocument out of the field map SolrInputDocument updateDoc = new SolrInputDocument(); for (String key : fields.keySet()) { - updateDoc.addField(key, Chunker.sanitize((String)fields.get(key)).toString()); + if (fields.get(key).getClass() == String.class) { + updateDoc.addField(key, Chunker.sanitize((String)fields.get(key)).toString()); + } else { + updateDoc.addField(key, fields.get(key)); + } } try { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LanguageSpecificContentIndexingHelper.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LanguageSpecificContentIndexingHelper.java index 38fcfd429e..387399d7ae 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LanguageSpecificContentIndexingHelper.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LanguageSpecificContentIndexingHelper.java @@ -62,8 +62,12 @@ class LanguageSpecificContentIndexingHelper { //Make a SolrInputDocument out of the field map SolrInputDocument updateDoc = new SolrInputDocument(); for (String key : fields.keySet()) { - updateDoc.addField(key, Chunker.sanitize((String)fields.get(key)).toString()); - } + if (fields.get(key).getClass() == String.class) { + updateDoc.addField(key, Chunker.sanitize((String)fields.get(key)).toString()); + } else { + updateDoc.addField(key, fields.get(key)); + } + } try { updateDoc.setField(Server.Schema.ID.toString(), Chunker.sanitize(MiniChunkHelper.getChunkIdString(baseChunkID)).toString()); From 6531b8aa3f93e4821981fb49e0c6db61c30ebf70 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Thu, 14 Jan 2021 13:25:13 -0500 Subject: [PATCH 2/6] Modified dump script to address one more issue with TL descriptions --- test/script/tskdbdiff.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 567c084ba4..9ff0a6175b 100644 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -628,9 +628,11 @@ def normalize_db_entry(line, files_table, vs_parts_table, vs_info_table, fs_info if legacy_artifact_id != 'NULL' and legacy_artifact_id in artifact_table.keys(): fields_list[6] = artifact_table[legacy_artifact_id] - fields_list[1] = cleanupEventDescription(fields_list[1]) - fields_list[2] = cleanupEventDescription(fields_list[2]) - fields_list[3] = cleanupEventDescription(fields_list[3]) + + if fields_list[1] == fields_list[2] and fields_list[1] == fields_list[3] + fields_list[1] = cleanupEventDescription(fields_list[1]) + fields_list[2] = cleanupEventDescription(fields_list[2]) + fields_list[3] = cleanupEventDescription(fields_list[3]) newLine = ('INSERT INTO "tsk_event_descriptions" VALUES(' + ','.join(fields_list[1:]) + ');') # remove report_id return newLine From e0ab3ef536afa748cba0287675414414196033dc Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 14 Jan 2021 16:17:46 -0500 Subject: [PATCH 3/6] 7225 check domain before populating and other cleanup --- .../discovery/search/DiscoveryEventUtils.java | 13 ++++++- .../discovery/ui/DiscoveryTopComponent.java | 1 + .../discovery/ui/DomainDetailsPanel.form | 2 +- .../discovery/ui/DomainDetailsPanel.java | 27 ++++++++------ .../discovery/ui/MiniTimelinePanel.java | 35 +++++++++---------- .../discovery/ui/MiniTimelineWorker.java | 12 +++---- 6 files changed, 52 insertions(+), 38 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java index 7dbfb8848c..6165ed2644 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java @@ -277,6 +277,7 @@ public final class DiscoveryEventUtils { public static final class MiniTimelineResultEvent { private final List results = new ArrayList<>(); + private final String domain; /** * Construct a new MiniTimelineResultEvent. @@ -284,10 +285,11 @@ public final class DiscoveryEventUtils { * @param results The list of MiniTimelineResults contained in this * event. */ - public MiniTimelineResultEvent(List results) { + public MiniTimelineResultEvent(List results, String domain) { if (results != null) { this.results.addAll(results); } + this.domain = domain; } /** @@ -298,6 +300,15 @@ public final class DiscoveryEventUtils { public List getResultList() { return Collections.unmodifiableList(results); } + + /** + * Get the domain this list of results is for. + * + * @return The domain the list of results is for. + */ + public String getDomain(){ + return domain; + } } /** diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java index 901d8ba60a..a74b32ca26 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java @@ -172,6 +172,7 @@ public final class DiscoveryTopComponent extends TopComponent { DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(detailsPanel); if (detailsPanel instanceof DomainDetailsPanel) { + ((DomainDetailsPanel) detailsPanel).unregister(); selectedDomainTabName = ((DomainDetailsPanel) detailsPanel).getSelectedTabName(); } resetBottomComponent(); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form index ada26d6fb9..b6e16aff08 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form @@ -2,13 +2,13 @@
+ - diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java index 63f6b0921b..df77f939fb 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java @@ -39,7 +39,6 @@ final class DomainDetailsPanel extends JPanel { private static final long serialVersionUID = 1L; private ArtifactsWorker singleArtifactDomainWorker; - private MiniTimelineWorker miniTimelineWorker; private String domain; private String selectedTabName = null; @@ -51,7 +50,9 @@ final class DomainDetailsPanel extends JPanel { @ThreadConfined(type = ThreadConfined.ThreadType.AWT) DomainDetailsPanel() { initComponents(); - jTabbedPane1.add(Bundle.DomainDetailsPanel_miniTimelineTitle_text(), new MiniTimelinePanel()); + MiniTimelinePanel timelinePanel = new MiniTimelinePanel(); + DiscoveryEventUtils.getDiscoveryEventBus().register(timelinePanel); + jTabbedPane1.add(Bundle.DomainDetailsPanel_miniTimelineTitle_text(), timelinePanel); for (BlackboardArtifact.ARTIFACT_TYPE type : SearchData.Type.DOMAIN.getArtifactTypes()) { jTabbedPane1.add(type.getDisplayName(), new DomainArtifactsTabPanel(type)); } @@ -141,14 +142,9 @@ final class DomainDetailsPanel extends JPanel { * mini timeline view to populate. */ private void runMiniTimelineWorker(MiniTimelinePanel miniTimelinePanel) { - if (miniTimelineWorker != null && !miniTimelineWorker.isDone()) { - miniTimelineWorker.cancel(true); - } if (miniTimelinePanel.getStatus() == DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED) { - DiscoveryEventUtils.getDiscoveryEventBus().register(miniTimelinePanel); - miniTimelinePanel.setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATING); - miniTimelineWorker = new MiniTimelineWorker(domain); - miniTimelineWorker.execute(); + miniTimelinePanel.setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATING, domain); + new MiniTimelineWorker(domain).execute(); } } @@ -189,7 +185,7 @@ final class DomainDetailsPanel extends JPanel { if (comp instanceof DomainArtifactsTabPanel) { ((DomainArtifactsTabPanel) comp).setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED); } else if (comp instanceof MiniTimelinePanel) { - ((MiniTimelinePanel) comp).setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED); + ((MiniTimelinePanel) comp).setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED, domain); } } } @@ -228,4 +224,15 @@ final class DomainDetailsPanel extends JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTabbedPane jTabbedPane1; // End of variables declaration//GEN-END:variables + + /* + * Unregister the MiniTimelinePanel from the event bus. + */ + void unregister() { + for (Component comp : jTabbedPane1.getComponents()) { + if (comp instanceof MiniTimelinePanel) { + DiscoveryEventUtils.getDiscoveryEventBus().unregister(comp); + } + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index 43f8027687..6c7cedb278 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -42,6 +42,7 @@ final class MiniTimelinePanel extends javax.swing.JPanel { private DomainArtifactsTabPanel.ArtifactRetrievalStatus status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED; private AbstractArtifactDetailsPanel rightPanel = new GeneralPurposeArtifactViewer(); private static final Logger logger = Logger.getLogger(MiniTimelinePanel.class.getName()); + private String selectedDomain = null; private final ListSelectionListener artifactListener; private final ListSelectionListener dateListener; @@ -109,8 +110,9 @@ final class MiniTimelinePanel extends javax.swing.JPanel { * @param status The ArtifactRetrievalStatus of the panel. */ @ThreadConfined(type = ThreadConfined.ThreadType.AWT) - void setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus status) { + void setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus status, String domain) { this.status = status; + this.selectedDomain = domain; if (status == DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED) { artifactListPanel.clearList(); dateListPanel.clearList(); @@ -123,7 +125,6 @@ final class MiniTimelinePanel extends javax.swing.JPanel { removeAll(); add(new LoadingPanel(Bundle.MiniTimelinePanel_loadingPanel_details())); } - } /** @@ -135,23 +136,19 @@ final class MiniTimelinePanel extends javax.swing.JPanel { @Subscribe void handleMiniTimelineResultEvent(DiscoveryEventUtils.MiniTimelineResultEvent miniTimelineResultEvent) { SwingUtilities.invokeLater(() -> { - dateListPanel.removeListSelectionListener(dateListener); - artifactListPanel.removeSelectionListener(artifactListener); - dateListPanel.addArtifacts(miniTimelineResultEvent.getResultList()); - status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATED; - setEnabled(!dateListPanel.isEmpty()); - dateListPanel.addSelectionListener(dateListener); - artifactListPanel.addSelectionListener(artifactListener); - dateListPanel.selectFirst(); - removeAll(); - add(mainSplitPane); - revalidate(); - repaint(); - try { - DiscoveryEventUtils.getDiscoveryEventBus().unregister(this); - } catch (IllegalArgumentException notRegistered) { - logger.log(Level.INFO, "Attempting to unregister mini timeline view which was not registered"); - // attempting to remove a tab that was never registered + if (miniTimelineResultEvent.getDomain().equals(selectedDomain)) { + dateListPanel.removeListSelectionListener(dateListener); + artifactListPanel.removeSelectionListener(artifactListener); + dateListPanel.addArtifacts(miniTimelineResultEvent.getResultList()); + status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATED; + setEnabled(!dateListPanel.isEmpty()); + dateListPanel.addSelectionListener(dateListener); + artifactListPanel.addSelectionListener(artifactListener); + dateListPanel.selectFirst(); + removeAll(); + add(mainSplitPane); + revalidate(); + repaint(); } }); } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java index e9122256ba..7ef49ca5d1 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java @@ -35,7 +35,7 @@ import org.sleuthkit.autopsy.discovery.search.DomainSearch; /** * SwingWorker to retrieve a list of artifacts for a specified type and domain. */ -class MiniTimelineWorker extends SwingWorker, Void> { +class MiniTimelineWorker extends SwingWorker { private final static Logger logger = Logger.getLogger(MiniTimelineWorker.class.getName()); private final String domain; @@ -51,12 +51,13 @@ class MiniTimelineWorker extends SwingWorker, Void> { } @Override - protected List doInBackground() throws Exception { + protected Void doInBackground() throws Exception { List results = new ArrayList<>(); if (!StringUtils.isBlank(domain)) { DomainSearch domainSearch = new DomainSearch(); try { results.addAll(domainSearch.getAllArtifactsForDomain(Case.getCurrentCase().getSleuthkitCase(), domain)); + DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.MiniTimelineResultEvent(results, domain)); } catch (DiscoveryException ex) { if (ex.getCause() instanceof InterruptedException) { this.cancel(true); @@ -66,22 +67,19 @@ class MiniTimelineWorker extends SwingWorker, Void> { } } } - return results; + return null; } @Override protected void done() { - List results = new ArrayList<>(); if (!isCancelled()) { try { - results.addAll(get()); - DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.MiniTimelineResultEvent(results)); + get(); } catch (InterruptedException | ExecutionException ex) { logger.log(Level.SEVERE, "Exception while trying to get list of artifacts for Domain details for mini timeline view for domain: " + domain, ex); } catch (CancellationException ignored) { //Worker was cancelled after previously finishing its background work, exception ignored to cut down on non-helpful logging } } - } } From 6092ef4b6b026e2df5b4cec5cf0ed7fcdafc2e0e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 14 Jan 2021 16:18:12 -0500 Subject: [PATCH 4/6] 7225 remove unused imports and unused logger --- .../org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index 6c7cedb278..103d13fc3d 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -19,13 +19,11 @@ package org.sleuthkit.autopsy.discovery.ui; import com.google.common.eventbus.Subscribe; -import java.util.logging.Level; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.contentviewers.artifactviewers.GeneralPurposeArtifactViewer; -import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.discovery.search.DiscoveryEventUtils; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -41,7 +39,6 @@ final class MiniTimelinePanel extends javax.swing.JPanel { private final MiniTimelineArtifactListPanel artifactListPanel = new MiniTimelineArtifactListPanel(); private DomainArtifactsTabPanel.ArtifactRetrievalStatus status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED; private AbstractArtifactDetailsPanel rightPanel = new GeneralPurposeArtifactViewer(); - private static final Logger logger = Logger.getLogger(MiniTimelinePanel.class.getName()); private String selectedDomain = null; private final ListSelectionListener artifactListener; private final ListSelectionListener dateListener; From 31ee0183cdbdc1323bac9acc823b9c6002946b25 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 14 Jan 2021 16:21:59 -0500 Subject: [PATCH 5/6] 7225 document new method arguments --- .../autopsy/discovery/search/DiscoveryEventUtils.java | 3 ++- .../org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java index 6165ed2644..e228ce5f21 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java @@ -284,6 +284,7 @@ public final class DiscoveryEventUtils { * * @param results The list of MiniTimelineResults contained in this * event. + * @param domain The domain the results are for. */ public MiniTimelineResultEvent(List results, String domain) { if (results != null) { @@ -306,7 +307,7 @@ public final class DiscoveryEventUtils { * * @return The domain the list of results is for. */ - public String getDomain(){ + public String getDomain() { return domain; } } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index 103d13fc3d..32c9e6bf6c 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -104,7 +104,8 @@ final class MiniTimelinePanel extends javax.swing.JPanel { /** * Manually set the status of the panel. * - * @param status The ArtifactRetrievalStatus of the panel. + * @param status The ArtifactRetrievalStatus of the panel + * @param domain The domain the panel is currently reflecting. */ @ThreadConfined(type = ThreadConfined.ThreadType.AWT) void setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus status, String domain) { From 266140a5a20bc07e97c2076da41f1ec8d247b629 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Fri, 15 Jan 2021 09:50:56 -0500 Subject: [PATCH 6/6] Fixed syntax error --- test/script/tskdbdiff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 9ff0a6175b..c6c6dfacdc 100644 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -629,7 +629,7 @@ def normalize_db_entry(line, files_table, vs_parts_table, vs_info_table, fs_info fields_list[6] = artifact_table[legacy_artifact_id] - if fields_list[1] == fields_list[2] and fields_list[1] == fields_list[3] + if fields_list[1] == fields_list[2] and fields_list[1] == fields_list[3]: fields_list[1] = cleanupEventDescription(fields_list[1]) fields_list[2] = cleanupEventDescription(fields_list[2]) fields_list[3] = cleanupEventDescription(fields_list[3])