From b9693d2aeb3f09ca2c7189cf46f17a4453a03fa3 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 10:16:24 -0500 Subject: [PATCH 01/26] 7050 reorder attributes --- .../GeneralPurposeArtifactViewer.java | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 15ef8c4796..8c14ff44c9 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -83,15 +83,43 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i */ @ThreadConfined(type = ThreadConfined.ThreadType.AWT) public GeneralPurposeArtifactViewer() { - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), DEFAULT_ORDERING); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), DEFAULT_ORDERING); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID(), DEFAULT_ORDERING); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID(), DEFAULT_ORDERING); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); + addOrderings(); initComponents(); } + private void addOrderings() { + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); + } + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @NbBundle.Messages({"GeneralPurposeArtifactViewer.unknown.text=Unknown"}) @Override From cdb7c0372d815fec25fc205c1d0f37b97d75aa67 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 10:38:44 -0500 Subject: [PATCH 02/26] 7050 artifact specific headers --- .../GeneralPurposeArtifactViewer.java | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 8c14ff44c9..5dd2e93847 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -181,13 +181,19 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i && (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID() || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID() || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() - || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()); + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID() + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_ACCOUNT_TYPE.getTypeID() + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS.getTypeID() + || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_AUTOFILL.getTypeID()); } - @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.attrHeader=Attributes", + @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.attrHeader=Details", "GeneralPurposeArtifactViewer.details.sourceHeader=Source", "GeneralPurposeArtifactViewer.details.dataSource=Data Source", - "GeneralPurposeArtifactViewer.details.file=File"}) + "GeneralPurposeArtifactViewer.details.file=File", + "GeneralPurposeArtifactViewer.details.datesHeader=Dates"}) /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -225,7 +231,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private void updateView(Integer artifactTypeId, Map> attributeMap, String dataSourceName, String sourceFileName) { if (!(artifactTypeId < 1 || artifactTypeId >= Integer.MAX_VALUE)) { - addHeader(Bundle.GeneralPurposeArtifactViewer_details_attrHeader()); + addDetailsHeader(artifactTypeId); Integer[] orderingArray = orderingMap.get(artifactTypeId); if (orderingArray == null) { orderingArray = DEFAULT_ORDERING; @@ -238,6 +244,9 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } } + if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + } for (int key : attributeMap.keySet()) { for (BlackboardAttribute bba : attributeMap.get(key)) { addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); @@ -251,6 +260,32 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } + @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details", + "GeneralPurposeArtifactViewer.details.historyHeader=Visit Details", + "GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File", + "GeneralPurposeArtifactViewer.details.searchHeader=Web Search", + "GeneralPurposeArtifactViewer.details.cachedHeader=Cached File", + "GeneralPurposeArtifactViewer.details.cookieHeader=Cookie Details",}) + private void addDetailsHeader(int artifactTypeId) { + String header; + if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_historyHeader(); + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_ACCOUNT_TYPE.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_bookmarkHeader(); + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_cachedHeader(); + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_cookieHeader(); + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_downloadHeader(); + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) { + header = Bundle.GeneralPurposeArtifactViewer_details_searchHeader(); + } else { + header = Bundle.GeneralPurposeArtifactViewer_details_attrHeader(); + } + addHeader(header); + } + /** * Adds a new heading to the panel. * From aad45ebee4012bec3db896cbc61c94f05e174799 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 11:14:43 -0500 Subject: [PATCH 03/26] 7050 changes to general purpose viewer sections --- .../artifactviewers/Bundle.properties-MERGED | 9 +++++- .../GeneralPurposeArtifactViewer.java | 29 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index e2afbad508..f9333ac74a 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -44,9 +44,16 @@ DataContentViewerArtifact.failedToGetSourcePath.message=Failed to get source fil DefaultTableArtifactContentViewer.attrsTableHeader.sources=Source(s) DefaultTableArtifactContentViewer.attrsTableHeader.type=Type DefaultTableArtifactContentViewer.attrsTableHeader.value=Value -GeneralPurposeArtifactViewer.details.attrHeader=Attributes +GeneralPurposeArtifactViewer.details.attrHeader=Details +GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details +GeneralPurposeArtifactViewer.details.cachedHeader=Cached File +GeneralPurposeArtifactViewer.details.cookieHeader=Cookie Details GeneralPurposeArtifactViewer.details.dataSource=Data Source +GeneralPurposeArtifactViewer.details.datesHeader=Dates +GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File GeneralPurposeArtifactViewer.details.file=File +GeneralPurposeArtifactViewer.details.historyHeader=Visit Details +GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source GeneralPurposeArtifactViewer.unknown.text=Unknown GeneralPurposeArtifactViewer_menuitem_copy=Copy diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 5dd2e93847..9326feb308 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -39,6 +39,7 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.SwingUtilities; +import org.apache.commons.lang.StringUtils; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.coreutils.Logger; @@ -129,6 +130,9 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i String dataSourceName = Bundle.GeneralPurposeArtifactViewer_unknown_text(); String sourceFileName = Bundle.GeneralPurposeArtifactViewer_unknown_text(); Map> attributeMap = new HashMap<>(); + String cookieCreatedDate = ""; + String cookieStartDate = ""; + String cookieEndDate = ""; try { // Get all the attributes and group them by the attributeType for (BlackboardAttribute bba : artifact.getAttributes()) { @@ -136,7 +140,15 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i if (attrList == null) { attrList = new ArrayList<>(); } - attrList.add(bba); + if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()) { + cookieCreatedDate = bba.getDisplayString(); + } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()) { + cookieStartDate = bba.getDisplayString(); + } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()) { + cookieEndDate = bba.getDisplayString(); + } else { + attrList.add(bba); + } attributeMap.put(bba.getAttributeType().getTypeID(), attrList); } dataSourceName = artifact.getDataSource().getName(); @@ -144,7 +156,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to get attributes for artifact " + artifact.getArtifactID(), ex); } - updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName); + updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName, cookieCreatedDate, cookieStartDate, cookieEndDate); } this.setLayout(this.gridBagLayout); this.revalidate(); @@ -229,7 +241,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i * the artifact. */ @ThreadConfined(type = ThreadConfined.ThreadType.AWT) - private void updateView(Integer artifactTypeId, Map> attributeMap, String dataSourceName, String sourceFileName) { + private void updateView(Integer artifactTypeId, Map> attributeMap, String dataSourceName, String sourceFileName, String cookieCreatedDate, String cookieStartDate, String cookieEndDate) { if (!(artifactTypeId < 1 || artifactTypeId >= Integer.MAX_VALUE)) { addDetailsHeader(artifactTypeId); Integer[] orderingArray = orderingMap.get(artifactTypeId); @@ -244,9 +256,20 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } } + if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + if (!StringUtils.isBlank(cookieCreatedDate)) { + addNameValueRow("Created", cookieCreatedDate); + } + if (!StringUtils.isBlank(cookieStartDate)) { + addNameValueRow("Start", cookieStartDate); + } + if (!StringUtils.isBlank(cookieCreatedDate)) { + addNameValueRow("End", cookieEndDate); + } } + addHeader("Other"); for (int key : attributeMap.keySet()) { for (BlackboardAttribute bba : attributeMap.get(key)) { addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); From aae5458f015a538024031a094fb9c1381470fd3f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 12:03:29 -0500 Subject: [PATCH 04/26] 7050 fix date section code --- .../artifactviewers/Bundle.properties-MERGED | 4 ++ .../GeneralPurposeArtifactViewer.java | 51 ++++++++++--------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index f9333ac74a..d3573080ff 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -44,6 +44,9 @@ DataContentViewerArtifact.failedToGetSourcePath.message=Failed to get source fil DefaultTableArtifactContentViewer.attrsTableHeader.sources=Source(s) DefaultTableArtifactContentViewer.attrsTableHeader.type=Type DefaultTableArtifactContentViewer.attrsTableHeader.value=Value +GeneralPurposeArtifactViewer.dates.created=Created +GeneralPurposeArtifactViewer.dates.end=End +GeneralPurposeArtifactViewer.dates.start=Start GeneralPurposeArtifactViewer.details.attrHeader=Details GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details GeneralPurposeArtifactViewer.details.cachedHeader=Cached File @@ -53,6 +56,7 @@ GeneralPurposeArtifactViewer.details.datesHeader=Dates GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File GeneralPurposeArtifactViewer.details.file=File GeneralPurposeArtifactViewer.details.historyHeader=Visit Details +GeneralPurposeArtifactViewer.details.otherHeader=Other GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source GeneralPurposeArtifactViewer.unknown.text=Unknown diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 9326feb308..695e5cf652 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -29,9 +29,12 @@ import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import javax.swing.JLabel; import javax.swing.JMenuItem; @@ -75,6 +78,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID()}; + private static final List TYPES_WITH_DATE_SECTION = Arrays.asList(new Integer[]{BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()}); private final GridBagLayout gridBagLayout = new GridBagLayout(); private final GridBagConstraints gridBagConstraints = new GridBagConstraints(); private final Map orderingMap = new HashMap<>(); @@ -130,9 +134,6 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i String dataSourceName = Bundle.GeneralPurposeArtifactViewer_unknown_text(); String sourceFileName = Bundle.GeneralPurposeArtifactViewer_unknown_text(); Map> attributeMap = new HashMap<>(); - String cookieCreatedDate = ""; - String cookieStartDate = ""; - String cookieEndDate = ""; try { // Get all the attributes and group them by the attributeType for (BlackboardAttribute bba : artifact.getAttributes()) { @@ -140,15 +141,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i if (attrList == null) { attrList = new ArrayList<>(); } - if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()) { - cookieCreatedDate = bba.getDisplayString(); - } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()) { - cookieStartDate = bba.getDisplayString(); - } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()) { - cookieEndDate = bba.getDisplayString(); - } else { - attrList.add(bba); - } + attrList.add(bba); attributeMap.put(bba.getAttributeType().getTypeID(), attrList); } dataSourceName = artifact.getDataSource().getName(); @@ -156,7 +149,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to get attributes for artifact " + artifact.getArtifactID(), ex); } - updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName, cookieCreatedDate, cookieStartDate, cookieEndDate); + updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName); } this.setLayout(this.gridBagLayout); this.revalidate(); @@ -240,8 +233,12 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i * @param sourceFileName The name of the file that caused the creation of * the artifact. */ + @NbBundle.Messages({"GeneralPurposeArtifactViewer.dates.created=Created", + "GeneralPurposeArtifactViewer.dates.start=Start", + "GeneralPurposeArtifactViewer.dates.end=End", + "GeneralPurposeArtifactViewer.details.otherHeader=Other"}) @ThreadConfined(type = ThreadConfined.ThreadType.AWT) - private void updateView(Integer artifactTypeId, Map> attributeMap, String dataSourceName, String sourceFileName, String cookieCreatedDate, String cookieStartDate, String cookieEndDate) { + private void updateView(Integer artifactTypeId, Map> attributeMap, String dataSourceName, String sourceFileName) { if (!(artifactTypeId < 1 || artifactTypeId >= Integer.MAX_VALUE)) { addDetailsHeader(artifactTypeId); Integer[] orderingArray = orderingMap.get(artifactTypeId); @@ -256,20 +253,28 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } } - - if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { + if (TYPES_WITH_DATE_SECTION.contains(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID())) { addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); - if (!StringUtils.isBlank(cookieCreatedDate)) { - addNameValueRow("Created", cookieCreatedDate); + List attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()); + if (attrList != null) { + for (BlackboardAttribute bba : attrList) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_created(), bba.getDisplayString()); + } } - if (!StringUtils.isBlank(cookieStartDate)) { - addNameValueRow("Start", cookieStartDate); + attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()); + if (attrList != null) { + for (BlackboardAttribute bba : attrList) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_start(), bba.getDisplayString()); + } } - if (!StringUtils.isBlank(cookieCreatedDate)) { - addNameValueRow("End", cookieEndDate); + attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()); + if (attrList != null) { + for (BlackboardAttribute bba : attrList) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_end(), bba.getDisplayString()); + } } } - addHeader("Other"); + addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); for (int key : attributeMap.keySet()) { for (BlackboardAttribute bba : attributeMap.get(key)) { addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); From 9eef7a2bf7a4fa8bd458a598eca34969603044c8 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 12:38:25 -0500 Subject: [PATCH 05/26] 7050 attempt to fix layout --- .../artifactviewers/GeneralPurposeArtifactViewer.form | 6 +++--- .../artifactviewers/GeneralPurposeArtifactViewer.java | 6 +++--- .../discovery/ui/AbstractArtifactDetailsPanel.java | 8 ++++++++ .../autopsy/discovery/ui/DomainArtifactsTabPanel.java | 2 +- .../sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form index 7fb4b28206..60fdfc6c4b 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form @@ -3,7 +3,7 @@
- + @@ -21,12 +21,12 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 695e5cf652..496d6146ad 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -208,17 +208,17 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // //GEN-BEGIN:initComponents private void initComponents() { - setPreferredSize(new java.awt.Dimension(0, 0)); + setPreferredSize(new java.awt.Dimension(400, 50)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 400, Short.MAX_VALUE) + .addGap(0, 0, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 300, Short.MAX_VALUE) + .addGap(0, 0, Short.MAX_VALUE) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java index b36e93728a..b56e60aa8f 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java @@ -18,7 +18,9 @@ */ package org.sleuthkit.autopsy.discovery.ui; +import java.awt.Component; import javax.swing.JPanel; +import javax.swing.JScrollPane; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -28,6 +30,12 @@ import org.sleuthkit.datamodel.BlackboardArtifact; */ public abstract class AbstractArtifactDetailsPanel extends JPanel { + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) + public Component getComponent() { + // Slap a vertical scrollbar on the panel. + return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + } + private static final long serialVersionUID = 1L; /** diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java index 1bc31e1d9b..3bc5ae14a7 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java @@ -91,7 +91,7 @@ final class DomainArtifactsTabPanel extends JPanel { break; } if (rightPanel != null) { - jSplitPane1.setRightComponent(new JScrollPane(rightPanel)); + jSplitPane1.setRightComponent(rightPanel.getComponent()); } } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index ad7dc0bcb5..ce85e8eb31 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -64,7 +64,7 @@ class MiniTimelinePanel extends javax.swing.JPanel { rightPanel = new GeneralPurposeArtifactViewer(); } rightPanel.setArtifact(artifact); - mainSplitPane.setRightComponent(new JScrollPane(rightPanel)); + mainSplitPane.setRightComponent(rightPanel.getComponent()); validate(); repaint(); } @@ -88,7 +88,7 @@ class MiniTimelinePanel extends javax.swing.JPanel { artifactListPanel.addSelectionListener(artifactListener); leftSplitPane.setLeftComponent(dateListPanel); leftSplitPane.setRightComponent(artifactListPanel); - mainSplitPane.setRightComponent(rightPanel); + mainSplitPane.setRightComponent(rightPanel.getComponent()); } /** From 636c010fee64d701115d7978ef6cbc6656d8a82e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 7 Dec 2020 12:45:01 -0500 Subject: [PATCH 06/26] 7050 second attempt to fix formatting --- .../GeneralPurposeArtifactViewer.form | 24 +++++++-------- .../GeneralPurposeArtifactViewer.java | 30 ++++++++----------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form index 60fdfc6c4b..f7c2393ad2 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form @@ -18,16 +18,16 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 496d6146ad..cbb48e1632 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -151,7 +151,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName); } - this.setLayout(this.gridBagLayout); + detailsScrollPane.setLayout(this.gridBagLayout); this.revalidate(); this.repaint(); } @@ -208,18 +208,11 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // //GEN-BEGIN:initComponents private void initComponents() { - setPreferredSize(new java.awt.Dimension(400, 50)); + detailsScrollPane = new javax.swing.JScrollPane(); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); + setPreferredSize(new java.awt.Dimension(400, 50)); + setLayout(new java.awt.BorderLayout()); + add(detailsScrollPane, java.awt.BorderLayout.CENTER); }// //GEN-END:initComponents /** @@ -329,7 +322,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // the first section if (gridBagConstraints.gridy != 0) { gridBagConstraints.gridy++; - add(new javax.swing.JLabel(" "), gridBagConstraints); + detailsScrollPane.add(new javax.swing.JLabel(" "), gridBagConstraints); addLineEndGlue(); } gridBagConstraints.gridy++; @@ -342,7 +335,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // make it large and bold headingLabel.setFont(headingLabel.getFont().deriveFont(Font.BOLD, headingLabel.getFont().getSize() + 2)); // add to panel - add(headingLabel, gridBagConstraints); + detailsScrollPane.add(headingLabel, gridBagConstraints); // reset constraints to normal gridBagConstraints.gridwidth = LABEL_WIDTH; // add line end glue @@ -373,7 +366,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i gridBagConstraints.weightx = GLUE_WEIGHT_X; // take up all the horizontal space gridBagConstraints.fill = GridBagConstraints.BOTH; javax.swing.Box.Filler horizontalFiller = new javax.swing.Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(32767, 0)); - add(horizontalFiller, gridBagConstraints); + detailsScrollPane.add(horizontalFiller, gridBagConstraints); // restore fill & weight gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = TEXT_WEIGHT_X; @@ -387,7 +380,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i gridBagConstraints.weighty = 1.0; // take up all the vertical space gridBagConstraints.fill = GridBagConstraints.VERTICAL; javax.swing.Box.Filler vertFiller = new javax.swing.Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(0, 32767)); - add(vertFiller, gridBagConstraints); + detailsScrollPane.add(vertFiller, gridBagConstraints); } /** @@ -406,7 +399,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // set text keyLabel.setText(keyString + ": "); // add to panel - add(keyLabel, gridBagConstraints); + detailsScrollPane.add(keyLabel, gridBagConstraints); return keyLabel; } @@ -437,7 +430,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } }); // add label to panel - add(valueField, cloneConstraints); + detailsScrollPane.add(valueField, cloneConstraints); // end the line addLineEndGlue(); return valueField; @@ -470,5 +463,6 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane detailsScrollPane; // End of variables declaration//GEN-END:variables } From 29ee882abc569fd9e4f3a1601651cbf647447b3b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 8 Dec 2020 10:23:08 -0500 Subject: [PATCH 07/26] 7050 yet another try to fix scroll panels --- .../GeneralPurposeArtifactViewer.form | 35 +++++++- .../GeneralPurposeArtifactViewer.java | 80 ++++++++++++++----- 2 files changed, 95 insertions(+), 20 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form index f7c2393ad2..94dfd5c072 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form @@ -3,7 +3,7 @@
- + @@ -16,11 +16,22 @@ + + + + + + + + + + + @@ -28,6 +39,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index cbb48e1632..8df228a4c3 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -31,18 +31,14 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.logging.Level; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.SwingUtilities; -import org.apache.commons.lang.StringUtils; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.coreutils.Logger; @@ -73,7 +69,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i private static final Integer[] DEFAULT_ORDERING = new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID(), @@ -90,8 +86,13 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i public GeneralPurposeArtifactViewer() { addOrderings(); initComponents(); + detailsPanel.setLayout(gridBagLayout); } + /** + * Private helper method to add the orderings used for each artifact type to + * the map for lookup. + */ private void addOrderings() { orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), @@ -151,9 +152,15 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName); } - detailsScrollPane.setLayout(this.gridBagLayout); - this.revalidate(); - this.repaint(); + detailsScrollPane.setViewportView(detailsPanel); + detailsPanel.updateUI(); + detailsPanel.revalidate(); + detailsPanel.repaint(); + detailsScrollPane.updateUI(); + detailsScrollPane.validate(); + detailsScrollPane.repaint(); + revalidate(); + repaint(); } /** @@ -162,7 +169,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private void resetComponent() { // clear the panel - this.removeAll(); + detailsPanel.removeAll(); gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.gridy = 0; gridBagConstraints.gridx = LABEL_COLUMN; @@ -175,8 +182,8 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @Override public Component getComponent() { - // Slap a vertical scrollbar on the panel. - return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +// Slap a vertical scrollbar on the panel. + return this; //new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @@ -209,9 +216,31 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i private void initComponents() { detailsScrollPane = new javax.swing.JScrollPane(); + detailsPanel = new javax.swing.JPanel(); - setPreferredSize(new java.awt.Dimension(400, 50)); + setPreferredSize(new java.awt.Dimension(0, 0)); setLayout(new java.awt.BorderLayout()); + + detailsScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + detailsScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + detailsScrollPane.setMinimumSize(new java.awt.Dimension(0, 0)); + detailsScrollPane.setPreferredSize(new java.awt.Dimension(0, 0)); + + detailsPanel.setPreferredSize(new java.awt.Dimension(0, 0)); + + javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); + detailsPanel.setLayout(detailsPanelLayout); + detailsPanelLayout.setHorizontalGroup( + detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + detailsPanelLayout.setVerticalGroup( + detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + + detailsScrollPane.setViewportView(detailsPanel); + add(detailsScrollPane, java.awt.BorderLayout.CENTER); }// //GEN-END:initComponents @@ -247,21 +276,33 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } if (TYPES_WITH_DATE_SECTION.contains(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID())) { - addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + boolean headerAdded = false; List attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()); if (attrList != null) { + if (!headerAdded) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + headerAdded = true; + } for (BlackboardAttribute bba : attrList) { addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_created(), bba.getDisplayString()); } } attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()); if (attrList != null) { + if (!headerAdded) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + headerAdded = true; + } for (BlackboardAttribute bba : attrList) { addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_start(), bba.getDisplayString()); } } attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()); if (attrList != null) { + if (!headerAdded) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + headerAdded = true; + } for (BlackboardAttribute bba : attrList) { addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_end(), bba.getDisplayString()); } @@ -322,7 +363,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // the first section if (gridBagConstraints.gridy != 0) { gridBagConstraints.gridy++; - detailsScrollPane.add(new javax.swing.JLabel(" "), gridBagConstraints); + detailsPanel.add(new javax.swing.JLabel(" "), gridBagConstraints); addLineEndGlue(); } gridBagConstraints.gridy++; @@ -335,7 +376,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // make it large and bold headingLabel.setFont(headingLabel.getFont().deriveFont(Font.BOLD, headingLabel.getFont().getSize() + 2)); // add to panel - detailsScrollPane.add(headingLabel, gridBagConstraints); + detailsPanel.add(headingLabel, gridBagConstraints); // reset constraints to normal gridBagConstraints.gridwidth = LABEL_WIDTH; // add line end glue @@ -366,7 +407,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i gridBagConstraints.weightx = GLUE_WEIGHT_X; // take up all the horizontal space gridBagConstraints.fill = GridBagConstraints.BOTH; javax.swing.Box.Filler horizontalFiller = new javax.swing.Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(32767, 0)); - detailsScrollPane.add(horizontalFiller, gridBagConstraints); + detailsPanel.add(horizontalFiller, gridBagConstraints); // restore fill & weight gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = TEXT_WEIGHT_X; @@ -380,7 +421,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i gridBagConstraints.weighty = 1.0; // take up all the vertical space gridBagConstraints.fill = GridBagConstraints.VERTICAL; javax.swing.Box.Filler vertFiller = new javax.swing.Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(0, 32767)); - detailsScrollPane.add(vertFiller, gridBagConstraints); + detailsPanel.add(vertFiller, gridBagConstraints); } /** @@ -399,7 +440,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // set text keyLabel.setText(keyString + ": "); // add to panel - detailsScrollPane.add(keyLabel, gridBagConstraints); + detailsPanel.add(keyLabel, gridBagConstraints); return keyLabel; } @@ -430,7 +471,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } }); // add label to panel - detailsScrollPane.add(valueField, cloneConstraints); + detailsPanel.add(valueField, cloneConstraints); // end the line addLineEndGlue(); return valueField; @@ -463,6 +504,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JPanel detailsPanel; private javax.swing.JScrollPane detailsScrollPane; // End of variables declaration//GEN-END:variables } From c1672df249b26e0758d9970fb72c60424d21f88e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 9 Dec 2020 09:50:42 -0500 Subject: [PATCH 08/26] 7050 clean up dates section --- .../GeneralPurposeArtifactViewer.java | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 8df228a4c3..b569bad33c 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -39,6 +39,7 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JTextPane; import javax.swing.SwingUtilities; +import org.apache.commons.lang.StringUtils; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.coreutils.Logger; @@ -277,36 +278,10 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } if (TYPES_WITH_DATE_SECTION.contains(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID())) { boolean headerAdded = false; - List attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()); - if (attrList != null) { - if (!headerAdded) { - addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); - headerAdded = true; - } - for (BlackboardAttribute bba : attrList) { - addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_created(), bba.getDisplayString()); - } - } - attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()); - if (attrList != null) { - if (!headerAdded) { - addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); - headerAdded = true; - } - for (BlackboardAttribute bba : attrList) { - addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_start(), bba.getDisplayString()); - } - } - attrList = attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()); - if (attrList != null) { - if (!headerAdded) { - addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); - headerAdded = true; - } - for (BlackboardAttribute bba : attrList) { - addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_end(), bba.getDisplayString()); - } - } + headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_created(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()), headerAdded); + headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_start(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()), headerAdded); + headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_end(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()), headerAdded); + addDates("", attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); } addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); for (int key : attributeMap.keySet()) { @@ -322,6 +297,34 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } + /** + * Private helper method to add all dates in a given attribute list. + * + * @param label Specific String to use in place of attributes display + * name. + * @param attrList List of attributes to add dates for. + * @param headerExists If the "Dates" header has already been displayed. + * + * @return True if the "Dates" header has been displayed, false otherwise. + */ + private boolean addDates(String label, List attrList, boolean headerExists) { + boolean headerAdded = headerExists; + if (attrList != null) { + if (!headerAdded) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_datesHeader()); + headerAdded = true; + } + String labelToUse = label; + for (BlackboardAttribute bba : attrList) { + if (StringUtils.isBlank(label)) { + labelToUse = bba.getAttributeType().getDisplayName(); + } + addNameValueRow(labelToUse, bba.getDisplayString()); + } + } + return headerAdded; + } + @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details", "GeneralPurposeArtifactViewer.details.historyHeader=Visit Details", "GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File", From 5bc17a19b09c68e911192b7f70941afaacb66aa3 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 11 Dec 2020 10:41:02 -0500 Subject: [PATCH 09/26] 7050 fix scroll bars --- .../GeneralPurposeArtifactViewer.form | 54 +++++-------------- .../GeneralPurposeArtifactViewer.java | 24 ++------- 2 files changed, 17 insertions(+), 61 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form index 94dfd5c072..c2451e28cb 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.form @@ -1,11 +1,6 @@
- - - - - @@ -21,46 +16,25 @@ - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index b569bad33c..2e8d6a9d11 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -37,6 +37,7 @@ import java.util.logging.Level; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.SwingUtilities; import org.apache.commons.lang.StringUtils; @@ -153,13 +154,6 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } updateView(artifact.getArtifactTypeID(), attributeMap, dataSourceName, sourceFileName); } - detailsScrollPane.setViewportView(detailsPanel); - detailsPanel.updateUI(); - detailsPanel.revalidate(); - detailsPanel.repaint(); - detailsScrollPane.updateUI(); - detailsScrollPane.validate(); - detailsScrollPane.repaint(); revalidate(); repaint(); } @@ -184,7 +178,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @Override public Component getComponent() { // Slap a vertical scrollbar on the panel. - return this; //new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); } @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @@ -216,19 +210,10 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // //GEN-BEGIN:initComponents private void initComponents() { - detailsScrollPane = new javax.swing.JScrollPane(); detailsPanel = new javax.swing.JPanel(); - setPreferredSize(new java.awt.Dimension(0, 0)); setLayout(new java.awt.BorderLayout()); - detailsScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - detailsScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - detailsScrollPane.setMinimumSize(new java.awt.Dimension(0, 0)); - detailsScrollPane.setPreferredSize(new java.awt.Dimension(0, 0)); - - detailsPanel.setPreferredSize(new java.awt.Dimension(0, 0)); - javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); detailsPanel.setLayout(detailsPanelLayout); detailsPanelLayout.setHorizontalGroup( @@ -240,9 +225,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i .addGap(0, 0, Short.MAX_VALUE) ); - detailsScrollPane.setViewportView(detailsPanel); - - add(detailsScrollPane, java.awt.BorderLayout.CENTER); + add(detailsPanel, java.awt.BorderLayout.PAGE_START); }// //GEN-END:initComponents /** @@ -508,6 +491,5 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel detailsPanel; - private javax.swing.JScrollPane detailsScrollPane; // End of variables declaration//GEN-END:variables } From d4bf9d4396bffefacb183ea051272f428256ff27 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 12:36:55 -0500 Subject: [PATCH 10/26] fix time label --- .../artifactviewers/GeneralPurposeArtifactViewer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 5c8f74909b..c1adb5b6c0 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -244,6 +244,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @NbBundle.Messages({"GeneralPurposeArtifactViewer.dates.created=Created", "GeneralPurposeArtifactViewer.dates.start=Start", "GeneralPurposeArtifactViewer.dates.end=End", + "GeneralPurposeArtifactViewer.dates.time=Time", "GeneralPurposeArtifactViewer.details.otherHeader=Other"}) @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private void updateView(BlackboardArtifact artifact, Map> attributeMap, String dataSourceName, String sourceFileName) { @@ -271,7 +272,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_created(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()), headerAdded); headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_start(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()), headerAdded); headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_end(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()), headerAdded); - addDates("", attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); + addDates(Bundle.GeneralPurposeArtifactViewer_dates_time(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); } addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); for (int key : attributeMap.keySet()) { From 1575d05f2b970069cf28797b761f68aed57ba417 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 12:48:44 -0500 Subject: [PATCH 11/26] fix conditional search labels --- .../GeneralPurposeArtifactViewer.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index c1adb5b6c0..a6a8522553 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -245,6 +245,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i "GeneralPurposeArtifactViewer.dates.start=Start", "GeneralPurposeArtifactViewer.dates.end=End", "GeneralPurposeArtifactViewer.dates.time=Time", + "GeneralPurposeArtifactViewer.term.label=Term", "GeneralPurposeArtifactViewer.details.otherHeader=Other"}) @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private void updateView(BlackboardArtifact artifact, Map> attributeMap, String dataSourceName, String sourceFileName) { @@ -260,9 +261,18 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i if (attrList != null) { for (BlackboardAttribute bba : attrList) { if (bba.getAttributeType().getTypeName().startsWith("TSK_DATETIME")) { - addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); + if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_dates_time(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); + } else { + addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); + } + } else { - addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); + if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); + } else { + addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); + } } } } @@ -272,7 +282,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_created(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()), headerAdded); headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_start(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()), headerAdded); headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_end(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()), headerAdded); - addDates(Bundle.GeneralPurposeArtifactViewer_dates_time(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); + addDates(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getDisplayName(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); } addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); for (int key : attributeMap.keySet()) { From edceaede905d3a847f183ea916501102759c70be Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 12:51:28 -0500 Subject: [PATCH 12/26] update bundle messages --- .../artifactviewers/Bundle.properties-MERGED | 2 ++ .../artifactviewers/GeneralPurposeArtifactViewer.java | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index d3573080ff..dada8efef8 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -47,6 +47,7 @@ DefaultTableArtifactContentViewer.attrsTableHeader.value=Value GeneralPurposeArtifactViewer.dates.created=Created GeneralPurposeArtifactViewer.dates.end=End GeneralPurposeArtifactViewer.dates.start=Start +GeneralPurposeArtifactViewer.dates.time=Time GeneralPurposeArtifactViewer.details.attrHeader=Details GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details GeneralPurposeArtifactViewer.details.cachedHeader=Cached File @@ -59,6 +60,7 @@ GeneralPurposeArtifactViewer.details.historyHeader=Visit Details GeneralPurposeArtifactViewer.details.otherHeader=Other GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source +GeneralPurposeArtifactViewer.term.label=Term GeneralPurposeArtifactViewer.unknown.text=Unknown GeneralPurposeArtifactViewer_menuitem_copy=Copy MessageAccountPanel.account.justification=Account found in Message artifact diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index a6a8522553..c9f4108859 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -266,13 +266,11 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } else { addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); } - + } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) { + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); } else { - if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) { - addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); - } else { - addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); - } + addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); + } } } From 827105eb4385e0adadaae07a86e83b01a2917a96 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 13:03:05 -0500 Subject: [PATCH 13/26] scroll to start of line --- .../artifactviewers/GeneralPurposeArtifactViewer.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index c9f4108859..52c843136c 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -24,6 +24,7 @@ import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; +import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; @@ -179,7 +180,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @Override public Component getComponent() { -// Slap a vertical scrollbar on the panel. + // Slap a vertical scrollbar on the panel return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); } @@ -328,6 +329,11 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i return headerAdded; } + /** + * Helper method to add an artifact specific details header. + * + * @param artifactTypeId ID of artifact type to add header for. + */ @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details", "GeneralPurposeArtifactViewer.details.historyHeader=Visit Details", "GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File", @@ -469,6 +475,8 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i cloneConstraints.fill = GridBagConstraints.BOTH; // set text valueField.setText(valueString); + // scroll to start of text + valueField.setCaretPosition(0); // attach a right click menu with Copy option valueField.addMouseListener(new java.awt.event.MouseAdapter() { @Override From 3c62819c717671c0445a5beab66ede164963e44c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 13:05:53 -0500 Subject: [PATCH 14/26] remove unused import --- .../artifactviewers/GeneralPurposeArtifactViewer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 52c843136c..b16ca3fe4b 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -24,7 +24,6 @@ import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; From 4e4d1a33629abcb4d48069ee6c6c28844e8a889c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 13:17:51 -0500 Subject: [PATCH 15/26] 7050 fix swapped artifact type and remove extra import --- .../artifactviewers/GeneralPurposeArtifactViewer.java | 2 +- .../org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index b16ca3fe4b..eab0bca1ad 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -343,7 +343,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i String header; if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) { header = Bundle.GeneralPurposeArtifactViewer_details_historyHeader(); - } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_ACCOUNT_TYPE.getTypeID()) { + } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) { header = Bundle.GeneralPurposeArtifactViewer_details_bookmarkHeader(); } else if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) { header = Bundle.GeneralPurposeArtifactViewer_details_cachedHeader(); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index ce85e8eb31..f577622a36 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.discovery.ui; import com.google.common.eventbus.Subscribe; import java.util.logging.Level; -import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; From 35e62d0cf7d44789b0f781a6c9129930fb6fb54b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 16 Dec 2020 15:04:35 -0500 Subject: [PATCH 16/26] 7050 change username and domain placement --- .../GeneralPurposeArtifactViewer.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index eab0bca1ad..ceeee78e80 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -73,7 +73,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i private static final Integer[] DEFAULT_ORDERING = new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID(), @@ -102,14 +102,16 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), @@ -117,14 +119,17 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_USER_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); From 44e432f285a280433e800e9cb40c1318504d4c70 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Dec 2020 18:10:08 -0500 Subject: [PATCH 17/26] 7050 fix header names and file path --- .../GeneralPurposeArtifactViewer.java | 28 ++++++++++--------- .../discovery/ui/ArtifactsListPanel.java | 18 +++++++++--- .../discovery/ui/Bundle.properties-MERGED | 2 ++ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index ceeee78e80..6428a3e5bc 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -104,13 +104,13 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID(), @@ -128,7 +128,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); - orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), + orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID(), new Integer[]{BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), @@ -155,7 +155,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i attributeMap.put(bba.getAttributeType().getTypeID(), attrList); } dataSourceName = artifact.getDataSource().getName(); - sourceFileName = artifact.getParent().getName(); + sourceFileName = artifact.getParent().getUniquePath(); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to get attributes for artifact " + artifact.getArtifactID(), ex); } @@ -253,7 +253,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i "GeneralPurposeArtifactViewer.term.label=Term", "GeneralPurposeArtifactViewer.details.otherHeader=Other"}) @ThreadConfined(type = ThreadConfined.ThreadType.AWT) - private void updateView(BlackboardArtifact artifact, Map> attributeMap, String dataSourceName, String sourceFileName) { + private void updateView(BlackboardArtifact artifact, Map> attributeMap, String dataSourceName, String sourceFilePath) { final Integer artifactTypeId = artifact.getArtifactTypeID(); if (!(artifactTypeId < 1 || artifactTypeId >= Integer.MAX_VALUE)) { addDetailsHeader(artifactTypeId); @@ -287,19 +287,21 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i headerAdded = addDates(Bundle.GeneralPurposeArtifactViewer_dates_end(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()), headerAdded); addDates(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getDisplayName(), attributeMap.remove(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()), headerAdded); } - addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); - for (int key : attributeMap.keySet()) { - for (BlackboardAttribute bba : attributeMap.get(key)) { - if (bba.getAttributeType().getTypeName().startsWith("TSK_DATETIME")) { - addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); - } else { - addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); + if (!attributeMap.keySet().isEmpty()) { + addHeader(Bundle.GeneralPurposeArtifactViewer_details_otherHeader()); + for (int key : attributeMap.keySet()) { + for (BlackboardAttribute bba : attributeMap.get(key)) { + if (bba.getAttributeType().getTypeName().startsWith("TSK_DATETIME")) { + addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); + } else { + addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); + } } } } addHeader(Bundle.GeneralPurposeArtifactViewer_details_sourceHeader()); addNameValueRow(Bundle.GeneralPurposeArtifactViewer_details_dataSource(), dataSourceName); - addNameValueRow(Bundle.GeneralPurposeArtifactViewer_details_file(), sourceFileName); + addNameValueRow(Bundle.GeneralPurposeArtifactViewer_details_file(), sourceFilePath); // add veritcal glue at the end addPageEndGlue(); } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java index 20a234681f..6efaa5ecba 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java @@ -327,6 +327,8 @@ final class ArtifactsListPanel extends AbstractArtifactListPanel { @NbBundle.Messages({"ArtifactsListPanel.titleColumn.name=Title", "ArtifactsListPanel.fileNameColumn.name=Name", "ArtifactsListPanel.dateColumn.name=Date/Time", + "ArtifactsListPanel.urlColumn.name=URL", + "ArtifactsListPanel.termColumn.name=Term", "ArtifactsListPanel.mimeTypeColumn.name=MIME Type"}) @Override public String getColumnName(int column) { @@ -334,11 +336,19 @@ final class ArtifactsListPanel extends AbstractArtifactListPanel { case 0: return Bundle.ArtifactsListPanel_dateColumn_name(); case 1: - if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE || artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD) { - return Bundle.ArtifactsListPanel_fileNameColumn_name(); - } else { - return Bundle.ArtifactsListPanel_titleColumn_name(); + if (artifactType != null) { + switch (artifactType) { + case TSK_WEB_CACHE: + case TSK_WEB_DOWNLOAD: + return Bundle.ArtifactsListPanel_fileNameColumn_name(); + case TSK_WEB_COOKIE: + return Bundle.ArtifactsListPanel_urlColumn_name(); + case TSK_WEB_SEARCH_QUERY: + return Bundle.ArtifactsListPanel_termColumn_name(); + default: + } } + return Bundle.ArtifactsListPanel_titleColumn_name(); case 2: return Bundle.ArtifactsListPanel_mimeTypeColumn_name(); default: diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED index 608ac005ae..1af75daf16 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED @@ -3,7 +3,9 @@ ArtifactMenuMouseAdapter_label=Extract Files ArtifactsListPanel.dateColumn.name=Date/Time ArtifactsListPanel.fileNameColumn.name=Name ArtifactsListPanel.mimeTypeColumn.name=MIME Type +ArtifactsListPanel.termColumn.name=Term ArtifactsListPanel.titleColumn.name=Title +ArtifactsListPanel.urlColumn.name=URL ArtifactsListPanel.value.noValue=No value available. ArtifactTypeFilterPanel.selectionNeeded.text=At least one Result type must be selected. CTL_OpenDiscoveryAction=Discovery From ae9789d08b575d49dfe1c644afca5a780fadcd6e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Dec 2020 18:23:11 -0500 Subject: [PATCH 18/26] 7050 add (no longer exists) --- .../GeneralPurposeArtifactViewer.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 6428a3e5bc..828960537b 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -57,7 +57,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ @ServiceProvider(service = ArtifactContentViewer.class) public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel implements ArtifactContentViewer { - + private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(GeneralPurposeArtifactViewer.class.getName()); // Number of columns in the gridbag layout. @@ -134,7 +134,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()}); } - + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @NbBundle.Messages({"GeneralPurposeArtifactViewer.unknown.text=Unknown"}) @Override @@ -180,14 +180,14 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.insets = ROW_INSETS; } - + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @Override public Component getComponent() { // Slap a vertical scrollbar on the panel return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); } - + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @Override public boolean isSupported(BlackboardArtifact artifact) { @@ -202,7 +202,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS.getTypeID() || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_AUTOFILL.getTypeID()); } - + @NbBundle.Messages({"GeneralPurposeArtifactViewer.details.attrHeader=Details", "GeneralPurposeArtifactViewer.details.sourceHeader=Source", "GeneralPurposeArtifactViewer.details.dataSource=Data Source", @@ -251,7 +251,8 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i "GeneralPurposeArtifactViewer.dates.end=End", "GeneralPurposeArtifactViewer.dates.time=Time", "GeneralPurposeArtifactViewer.term.label=Term", - "GeneralPurposeArtifactViewer.details.otherHeader=Other"}) + "GeneralPurposeArtifactViewer.details.otherHeader=Other", + "GeneralPurposeArtifactViewer.noFile.text= (no longer exists)"}) @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private void updateView(BlackboardArtifact artifact, Map> attributeMap, String dataSourceName, String sourceFilePath) { final Integer artifactTypeId = artifact.getArtifactTypeID(); @@ -271,11 +272,17 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } else { addNameValueRow(bba.getAttributeType().getDisplayName(), TimeUtilities.epochToTime(bba.getValueLong(), ContentUtils.getTimeZone(artifact))); } - } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID() && bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) { + } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID() && artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) { addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); + } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH) { + String displayString = bba.getDisplayString(); + if (attributeMap.containsKey(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID())) { + displayString += Bundle.GeneralPurposeArtifactViewer_noFile_text(); + } + addNameValueRow(bba.getAttributeType().getDisplayName(), displayString); } else { addNameValueRow(bba.getAttributeType().getDisplayName(), bba.getDisplayString()); - + } } } From 45d19ba585e39f9b7e7117bb01454d86cfa4988a Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Dec 2020 19:09:29 -0500 Subject: [PATCH 19/26] 7050 fix results content viewer when artifacts content is not parent --- .../DataContentViewerArtifact.java | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java index b6a1373236..04715f1f4a 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java @@ -501,24 +501,37 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat Lookup lookup = selectedNode.getLookup(); // Get the content. We may get BlackboardArtifacts, ignore those here. - ArrayList artifacts = new ArrayList<>(); Collection contents = lookup.lookupAll(Content.class); if (contents.isEmpty()) { return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); } Content underlyingContent = null; + //find the first non-artifact content from the lookup results for (Content content : contents) { if ((content != null) && (!(content instanceof BlackboardArtifact))) { - // Get all of the blackboard artifacts associated with the content. These are what this - // viewer displays. - try { - artifacts = content.getAllArtifacts(); - underlyingContent = content; - break; - } catch (TskException ex) { - logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS - return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); + underlyingContent = content; + break; + } + } + ArrayList contentArtifacts = new ArrayList<>(); + if (underlyingContent != null) { + try { + //get the artifacts seperately for the use case where an artifact is about a file that exists other than its parent such as a TSK_WEB_DOWNLOAD or TSK_WEB_CACHE + Collection nodeArtifacts = lookup.lookupAll(BlackboardArtifact.class); + if (!nodeArtifacts.isEmpty()) { + BlackboardArtifact originalArtifact = nodeArtifacts.iterator().next(); + if (!underlyingContent.equals(originalArtifact.getParent())) { + contentArtifacts.add(originalArtifact); + } } + if (contentArtifacts.isEmpty()) { + // Get all of the blackboard artifacts associated with the content. These are what this + // viewer displays. + contentArtifacts = underlyingContent.getAllArtifacts(); + } + } catch (TskException ex) { + logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS + return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); } } @@ -528,7 +541,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat // Build the new artifact contents cache. ArrayList artifactContents = new ArrayList<>(); - for (BlackboardArtifact artifact : artifacts) { + for (BlackboardArtifact artifact : contentArtifacts) { artifactContents.add(artifact); } @@ -537,7 +550,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat int index = 0; BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class); if (artifact != null) { - index = artifacts.indexOf(artifact); + index = contentArtifacts.indexOf(artifact); if (index == -1) { index = 0; } else { @@ -547,9 +560,9 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) { long assocArtifactId = attr.getValueLong(); int assocArtifactIndex = -1; - for (BlackboardArtifact art : artifacts) { + for (BlackboardArtifact art : contentArtifacts) { if (assocArtifactId == art.getArtifactID()) { - assocArtifactIndex = artifacts.indexOf(art); + assocArtifactIndex = contentArtifacts.indexOf(art); break; } } From fcac5fcc8d9e454dd6eca170446cf85345fa5e99 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Dec 2020 19:46:08 -0500 Subject: [PATCH 20/26] 7050 add missing getTypeId --- .../artifactviewers/GeneralPurposeArtifactViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 828960537b..7d518f4634 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -274,7 +274,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i } } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT.getTypeID() && artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) { addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); - } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH) { + } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) { String displayString = bba.getDisplayString(); if (attributeMap.containsKey(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID())) { displayString += Bundle.GeneralPurposeArtifactViewer_noFile_text(); From 32cbeb0c322a788f315e91ebd90c5387abd10cb6 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Dec 2020 21:41:25 -0500 Subject: [PATCH 21/26] 7050 adjust other content viewers to disable when download content is parent --- .../DataContentViewerOtherCases.java | 58 ++++++++++-- .../autopsy/contentviewers/FileViewer.java | 22 ++++- .../autopsy/contentviewers/Metadata.java | 72 +++++++++------ .../contextviewer/ContextViewer.java | 90 +++++++++++-------- .../textcontentviewer/TextContentViewer.java | 24 ++++- .../corecomponents/DataContentViewerHex.java | 21 ++++- 6 files changed, 207 insertions(+), 80 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java index 56922c7bfb..70198bc678 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -52,9 +52,11 @@ import javax.swing.JPanel; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import org.apache.commons.lang.StringUtils; import org.joda.time.DateTimeZone; import org.joda.time.LocalDateTime; import org.openide.nodes.Node; +import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.casemodule.Case; @@ -76,6 +78,7 @@ import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskData; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; /** * View correlation results from other cases @@ -466,11 +469,16 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi if (bbArtifact != null && CentralRepository.isEnabled()) { ret.addAll(CorrelationAttributeUtil.makeCorrAttrsForCorrelation(bbArtifact)); } + boolean isSupported = false; + try { + isSupported = this.file != null && this.file.getSize() > 0 && isDownloadParentSupported(node); + } catch (TskCoreException ex) { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } // we can correlate based on the MD5 if it is enabled - if (this.file != null && CentralRepository.isEnabled() && this.file.getSize() > 0) { + if (isSupported && CentralRepository.isEnabled()) { try { - List artifactTypes = CentralRepository.getInstance().getDefinedCorrelationTypes(); String md5 = this.file.getMd5Hash(); if (md5 != null && !md5.isEmpty() && null != artifactTypes && !artifactTypes.isEmpty()) { @@ -498,7 +506,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi LOGGER.log(Level.SEVERE, "Error connecting to DB", ex); // NON-NLS } // If EamDb not enabled, get the Files default correlation type to allow Other Occurances to be enabled. - } else if (this.file != null && this.file.getSize() > 0) { + } else if (isSupported) { String md5 = this.file.getMd5Hash(); if (md5 != null && !md5.isEmpty()) { try { @@ -517,10 +525,39 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } } - return ret; } + /** + * Private helper method to check if the node is an TSK_WEB_DOWNLOAD or + * TSK_WEB_CACHE artifact and if it is, if the file reflects the parent file + * or the downloaded file. + * + * @param node The node to check support for. + * + * @return False if the node is for a Web Cache or a Web Download artifact, + * and that artifact's content file is it's parent. + * + * @throws TskCoreException Unable to retrieve the parent of the artifact in + * this node. + */ + private boolean isDownloadParentSupported(Node node) throws TskCoreException { + if (node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + try { + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && this.file.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + throw new TskCoreException(String.format("Error getting parent of artifact with type %s and objID = %d can not confirm content with name %s and objId = %d is not the parent. Other occurences will not correlate on the file.", theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), this.file.getName(), this.file.getId()), ex); + } + } + return true; + } + @Messages({"DataContentViewerOtherCases.earliestCaseNotAvailable= Not Enabled."}) /** * Gets the list of Eam Cases and determines the earliest case creation @@ -701,11 +738,16 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi this.file = this.getAbstractFileFromNode(node); if (CentralRepository.isEnabled()) { return !getCorrelationAttributesFromNode(node).isEmpty(); - } else { - return this.file != null - && this.file.getSize() > 0 - && ((this.file.getMd5Hash() != null) && (!this.file.getMd5Hash().isEmpty())); + } else if (this.file == null || this.file.getSize() <= 0 || StringUtils.isBlank(file.getMd5Hash())) { + return false; } + boolean isSupported = false; + try { + isSupported = isDownloadParentSupported(node); + } catch (TskCoreException ex) { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } + return isSupported; } @Override diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java index 0a50fb0ec9..e6168b03d3 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java @@ -28,8 +28,11 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.TskCoreException; /** * Generic Application content viewer @@ -82,8 +85,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer * * @param file * - * @return FileTypeViewer, null if no known content viewer supports the - * file + * @return FileTypeViewer, null if no known content viewer supports the file */ private FileTypeViewer getSupportingViewer(AbstractFile file) { FileTypeViewer viewer = mimeTypeToViewerMap.get(file.getMIMEType()); @@ -193,7 +195,21 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer if ((aFile == null) || (aFile.isDir())) { return false; } - + if (node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + try { + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && aFile.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + LOGGER.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. File content viewer will not be supported.", + theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), aFile.getName(), aFile.getId()), ex); + return false; + } + } String mimeType = aFile.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", aFile.getName()); //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java index 45dae8e2e0..e8db7301a7 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java @@ -29,6 +29,7 @@ import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; @@ -50,7 +51,7 @@ import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM; public class Metadata extends javax.swing.JPanel implements DataContentViewer { private static final Logger LOGGER = Logger.getLogger(Metadata.class.getName()); - + /** * Creates new form Metadata */ @@ -176,7 +177,6 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.created"), ContentUtils.getStringTime(file.getCrtime(), file)); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.changed"), ContentUtils.getStringTime(file.getCtime(), file)); - String md5 = file.getMd5Hash(); if (md5 == null) { md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc"); @@ -189,12 +189,12 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString()); addAcquisitionDetails(sb, dataSource); - + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(file.getId())); if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), file.getLocalAbsPath()); } - + try { List associatedObjectArtifacts = file.getArtifacts(ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT); if (!associatedObjectArtifacts.isEmpty()) { @@ -207,14 +207,14 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { } } } catch (TskCoreException ex) { - sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage()); + sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage()); } - + endTable(sb); /* - * If we have a file system file, grab the more detailed metadata text - * too + * If we have a file system file, grab the more detailed metadata + * text too */ try { if (file instanceof FsContent) { @@ -226,11 +226,11 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { for (String str : fsFile.getMetaDataText()) { sb.append(str).append("
"); //NON-NLS - /* - * Very long results can cause the UI to hang before displaying, - * so truncate the results if necessary. + /* + * Very long results can cause the UI to hang before + * displaying, so truncate the results if necessary. */ - if(sb.length() > 50000){ + if (sb.length() > 50000) { sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.truncated")); break; } @@ -246,7 +246,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { } catch (TskCoreException ex) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getName()); } - addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName()); + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName()); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(image.getSize())); try { @@ -282,46 +282,46 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { StringBuilder pathValues = new StringBuilder("
"); pathValues.append(imagePaths[0]); pathValues.append("
"); - for (int i=1; i < imagePaths.length; i++) { + for (int i = 1; i < imagePaths.length; i++) { pathValues.append("
"); pathValues.append(imagePaths[i]); pathValues.append("
"); } addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), pathValues.toString()); } else { - addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), NbBundle.getMessage(this.getClass(), "Metadata.nodeText.none")); } } - + setText(sb.toString()); jTextPane1.setCaretPosition(0); this.setCursor(null); } - + /** - * Adds a row for download source from the given associated artifact, - * if the associated artifacts specifies a source. - * - * @param sb string builder. + * Adds a row for download source from the given associated artifact, if the + * associated artifacts specifies a source. + * + * @param sb string builder. * @param associatedArtifact - * + * * @throws TskCoreException if there is an error */ - private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact ) throws TskCoreException { - if (associatedArtifact != null && - ((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) || - (associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID())) ) { + private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact) throws TskCoreException { + if (associatedArtifact != null + && ((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) + || (associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()))) { BlackboardAttribute urlAttr = associatedArtifact.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL)); if (urlAttr != null) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.downloadSource"), urlAttr.getValueString()); } } } - + /** * Add the acquisition details to the results (if applicable) - * + * * @param sb The output StringBuilder object * @param dataSource The data source (may be null) */ @@ -369,6 +369,22 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { public boolean isSupported(Node node) { Image image = node.getLookup().lookup(Image.class); AbstractFile file = node.getLookup().lookup(AbstractFile.class); + if (file != null && node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + try { + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && file.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + LOGGER.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Metadata viewer will not be supported.", + theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), file.getName(), file.getId()), ex); + return false; + } + } + return (file != null) || (image != null); } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java index c223f577b0..a63e3e6f85 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java @@ -36,6 +36,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT; @@ -225,6 +226,21 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte // check if the node has an abstract file and the file has any context defining artifacts. if (node.getLookup().lookup(AbstractFile.class) != null) { AbstractFile abstractFile = node.getLookup().lookup(AbstractFile.class); + if (node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + try { + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && abstractFile.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Context content viewer will not be supported.", + theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), abstractFile.getName(), abstractFile.getId()), ex); + return false; + } + } for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) { List artifactsList; try { @@ -249,8 +265,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } @NbBundle.Messages({ - "ContextViewer.unknownSource=Unknown ", - }) + "ContextViewer.unknownSource=Unknown ",}) /** * Looks for context providing artifacts for the given file and populates * the source context. @@ -263,7 +278,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private void populatePanels(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); - + // Check for all context artifacts boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) { @@ -292,7 +307,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte contextContainer.add(usagePanel); } } - + contextContainer.setBackground(javax.swing.UIManager.getDefaults().getColor("window")); contextContainer.setEnabled(foundASource); contextContainer.setVisible(foundASource); @@ -301,12 +316,12 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte jScrollPane.setVisible(foundASource); jScrollPane.repaint(); jScrollPane.revalidate(); - - + } /** - * Resolves an TSK_ASSOCIATED_OBJECT artifact and adds it to the appropriate panel + * Resolves an TSK_ASSOCIATED_OBJECT artifact and adds it to the appropriate + * panel * * @param artifact Artifact that may provide context. * @@ -358,16 +373,16 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == associatedArtifact.getArtifactTypeID()) { String sourceName = Bundle.ContextViewer_recentDocs(); String sourceText = recentDocArtifactToString(associatedArtifact); - ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); + ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); contextUsagePanels.add(usagePanel); - + } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == associatedArtifact.getArtifactTypeID()) { String sourceName = Bundle.ContextViewer_programExecution(); String sourceText = programExecArtifactToString(associatedArtifact); - ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); + ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); contextUsagePanels.add(usagePanel); } - + Collections.sort(contextSourcePanels, new SortByDateTime()); Collections.sort(contextUsagePanels, new SortByDateTime()); } @@ -399,8 +414,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } /** - * Returns a display string with recent Doc - * artifact. + * Returns a display string with recent Doc artifact. * * @param artifact artifact to get doc from. * @@ -415,9 +429,9 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private String recentDocArtifactToString(BlackboardArtifact artifact) throws TskCoreException { StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN); Map attributesMap = getAttributesMap(artifact); - + BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == artifact.getArtifactTypeID()) { if (attribute != null && attribute.getValueLong() > 0) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_on()); @@ -429,8 +443,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } /** - * Returns a display string with Program Execution - * artifact. + * Returns a display string with Program Execution artifact. * * @param artifact artifact to get doc from. * @@ -445,9 +458,9 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private String programExecArtifactToString(BlackboardArtifact artifact) throws TskCoreException { StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN); Map attributesMap = getAttributesMap(artifact); - + BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == artifact.getArtifactTypeID()) { if (attribute != null && attribute.getValueLong() > 0) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_runOn()); @@ -538,8 +551,9 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte return attributeMap; } - + interface DateTimePanel { + /** * Return the date time value for this panel. * @@ -547,28 +561,28 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte */ Long getDateTime(); } - - /** + + /** * Return the dateTime value for the given message artifact. - * - * @param artifact - * + * + * @param artifact + * * @return Long dateTime value or null if the attribute was not found. - * - * @throws TskCoreException + * + * @throws TskCoreException */ private Long getArtifactDateTime(BlackboardArtifact artifact) throws TskCoreException { - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() == artifact.getArtifactTypeID()) { - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT)); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT)); } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID() || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) { - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); } return (attribute != null ? attribute.getValueLong() : null); } - + /** * Class for sorting lists of DateTimePanels. */ @@ -578,18 +592,18 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte public int compare(DateTimePanel panel1, DateTimePanel panel2) { Long dateTime1 = panel1.getDateTime(); Long dateTime2 = panel2.getDateTime(); - - if(dateTime1 == null && dateTime2 == null) { + + if (dateTime1 == null && dateTime2 == null) { return 0; - } else if(dateTime1 == null) { + } else if (dateTime1 == null) { return -1; - } else if(dateTime2 == null) { + } else if (dateTime2 == null) { return 1; } - + return dateTime1.compareTo(dateTime2); } - + } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java index d7f853caab..299a6d5677 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java @@ -19,11 +19,16 @@ package org.sleuthkit.autopsy.contentviewers.textcontentviewer; import java.awt.Component; +import java.util.logging.Level; import org.openide.nodes.Node; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.TskCoreException; /** * A DataContentViewer that displays text with the TextViewers available. @@ -33,6 +38,7 @@ public class TextContentViewer implements DataContentViewer { private final TextContentViewerPanel panel; private volatile Node currentNode = null; + private static final Logger logger = Logger.getLogger(TextContentViewer.class.getName()); /** * No arg constructor for creating the main instance of this Content Viewer. @@ -96,12 +102,26 @@ public class TextContentViewer implements DataContentViewer { if (file == null) { return false; } - + if (node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + try { + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && file.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Text content viewer will not be supported.", + theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), file.getName(), file.getId()), ex); + return false; + } + } // disable the text content viewer for directories and empty files if (file.isDir() || file.getSize() == 0) { return false; } - + return panel.isSupported(node); } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java index be8f854b96..c3320cfb38 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java @@ -44,8 +44,10 @@ import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import static org.sleuthkit.autopsy.corecomponents.Bundle.*; import org.sleuthkit.autopsy.coreutils.FileUtil; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.datamodel.DataConversion; +import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -606,7 +608,24 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont return false; } Content content = DataContentViewerUtility.getDefaultContent(node); - return content != null && content.getSize() > 0; + if (content == null || content.getSize() <= 0) { + return false; + } else if (node instanceof BlackboardArtifactNode) { + BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); + //disable the content viewer when a download or cached file does not exist instead of displaying its parent + try { + if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && content.getId() == theArtifact.getParent().getId()) { + return false; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm content with name %s and objId = %d is not the parent. Hex content viewer will not be supported.", + theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), content.getName(), content.getId()), ex); + return false; + } + } + return true; } @Override From 76766dd205e71a36b4e3cb63fbfc0e7aa2d8fb36 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 21 Dec 2020 10:04:21 -0500 Subject: [PATCH 22/26] 7050 fix no longer exists logic --- .../contentviewers/artifactviewers/Bundle.properties-MERGED | 1 + .../artifactviewers/GeneralPurposeArtifactViewer.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index dada8efef8..11c1bcc8bb 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -60,6 +60,7 @@ GeneralPurposeArtifactViewer.details.historyHeader=Visit Details GeneralPurposeArtifactViewer.details.otherHeader=Other GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source +GeneralPurposeArtifactViewer.noFile.text=\ (no longer exists) GeneralPurposeArtifactViewer.term.label=Term GeneralPurposeArtifactViewer.unknown.text=Unknown GeneralPurposeArtifactViewer_menuitem_copy=Copy diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 7d518f4634..65370ea480 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -276,7 +276,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i addNameValueRow(Bundle.GeneralPurposeArtifactViewer_term_label(), bba.getDisplayString()); } else if (bba.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) { String displayString = bba.getDisplayString(); - if (attributeMap.containsKey(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID())) { + if (!attributeMap.containsKey(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID())) { displayString += Bundle.GeneralPurposeArtifactViewer_noFile_text(); } addNameValueRow(bba.getAttributeType().getDisplayName(), displayString); From 0a61c05097d02af051c2f44de97238a3ffe05b30 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 21 Dec 2020 14:09:22 -0500 Subject: [PATCH 23/26] 7050 content viewer approach to handling artifact for file other than downloaded file --- .../autopsy/contentviewers/FileViewer.java | 56 +++++++++---------- .../autopsy/contentviewers/Metadata.java | 4 ++ .../GeneralPurposeArtifactViewer.java | 1 + .../textcontentviewer/TextContentViewer.java | 4 ++ .../DataContentViewerArtifact.java | 4 +- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java index e6168b03d3..9604486df5 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java @@ -40,11 +40,11 @@ import org.sleuthkit.datamodel.TskCoreException; @ServiceProvider(service = DataContentViewer.class, position = 3) @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives public class FileViewer extends javax.swing.JPanel implements DataContentViewer { - + private static final int CONFIDENCE_LEVEL = 5; private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(FileViewer.class.getName()); - + private final Map mimeTypeToViewerMap = new HashMap<>(); // TBD: This hardcoded list of viewers should be replaced with a dynamic lookup @@ -56,7 +56,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer new WindowsRegistryViewer(), new PDFViewer() }; - + private FileTypeViewer lastViewer; /** @@ -74,9 +74,9 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer } }); } - + initComponents(); - + LOGGER.log(Level.INFO, "Created ApplicationContentViewer instance: {0}", this); //NON-NLS } @@ -112,18 +112,18 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer // End of variables declaration//GEN-END:variables @Override public void setNode(Node selectedNode) { - + resetComponent(); - - if (selectedNode == null) { + + if (selectedNode == null || !isSupported(selectedNode)) { return; } - + AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if ((file == null) || (file.isDir())) { return; } - + String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS @@ -135,62 +135,62 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return; } else { FileTypeViewer viewer = getSupportingViewer(file); if (viewer != null) { lastViewer = viewer; - + viewer.setFile(file); this.removeAll(); this.add(viewer.getComponent()); this.validate(); } } - + } - + @Override @NbBundle.Messages("ApplicationContentViewer.title=Application") public String getTitle() { return Bundle.ApplicationContentViewer_title(); } - + @Override @NbBundle.Messages("ApplicationContentViewer.toolTip=Displays file contents.") public String getToolTip() { return Bundle.ApplicationContentViewer_toolTip(); } - + @Override public DataContentViewer createInstance() { return new FileViewer(); } - + @Override public Component getComponent() { return this; } - + @Override public void resetComponent() { - + if (lastViewer != null) { lastViewer.resetComponent(); } this.removeAll(); lastViewer = null; } - + @Override public boolean isSupported(Node node) { - + if (node == null) { return false; } - + AbstractFile aFile = node.getLookup().lookup(AbstractFile.class); if ((aFile == null) || (aFile.isDir())) { return false; @@ -221,20 +221,20 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return false; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return false; } else { return (getSupportingViewer(aFile) != null); } - + } - + @Override public int isPreferred(Node node) { AbstractFile file = node.getLookup().lookup(AbstractFile.class); String mimeType = file.getMIMEType(); - + if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS try { @@ -245,7 +245,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return 0; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return 0; } else { @@ -253,7 +253,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return CONFIDENCE_LEVEL; } } - + return 0; } } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java index e8db7301a7..fcf18f77ff 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java @@ -149,6 +149,10 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { "Metadata.nodeText.none=None"}) @Override public void setNode(Node node) { + if ((node == null) || (!isSupported(node))) { + resetComponent(); + return; + } AbstractFile file = node.getLookup().lookup(AbstractFile.class); Image image = node.getLookup().lookup(Image.class); DataSource dataSource = node.getLookup().lookup(DataSource.class); diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java index 65370ea480..00b906a792 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/GeneralPurposeArtifactViewer.java @@ -190,6 +190,7 @@ public class GeneralPurposeArtifactViewer extends AbstractArtifactDetailsPanel i @ThreadConfined(type = ThreadConfined.ThreadType.AWT) @Override + public boolean isSupported(BlackboardArtifact artifact) { return (artifact != null) && (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID() diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java index 299a6d5677..67241594a8 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java @@ -58,6 +58,10 @@ public class TextContentViewer implements DataContentViewer { @Override public void setNode(Node selectedNode) { + if ((selectedNode == null) || (!isSupported(selectedNode))) { + resetComponent(); + return; + } currentNode = selectedNode; panel.setNode(currentNode); diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java index 04715f1f4a..5f5a3313e6 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java @@ -520,7 +520,9 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat Collection nodeArtifacts = lookup.lookupAll(BlackboardArtifact.class); if (!nodeArtifacts.isEmpty()) { BlackboardArtifact originalArtifact = nodeArtifacts.iterator().next(); - if (!underlyingContent.equals(originalArtifact.getParent())) { + if ((originalArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() + || originalArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) + && underlyingContent.getId() == originalArtifact.getParent().getId()) { contentArtifacts.add(originalArtifact); } } From e48136ac201dfd4d7d8ab9cdaca32b9d8ff4e070 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Dec 2020 10:28:59 -0500 Subject: [PATCH 24/26] 7050 undo content viewer changes --- .../autopsy/contentviewers/FileViewer.java | 78 +++++++--------- .../autopsy/contentviewers/Metadata.java | 76 ++++++---------- .../artifactviewers/Bundle.properties-MERGED | 16 +--- .../contextviewer/ContextViewer.java | 90 ++++++++----------- .../textcontentviewer/TextContentViewer.java | 28 +----- 5 files changed, 100 insertions(+), 188 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java index 9604486df5..0a50fb0ec9 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/FileViewer.java @@ -28,11 +28,8 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.TskCoreException; /** * Generic Application content viewer @@ -40,11 +37,11 @@ import org.sleuthkit.datamodel.TskCoreException; @ServiceProvider(service = DataContentViewer.class, position = 3) @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives public class FileViewer extends javax.swing.JPanel implements DataContentViewer { - + private static final int CONFIDENCE_LEVEL = 5; private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(FileViewer.class.getName()); - + private final Map mimeTypeToViewerMap = new HashMap<>(); // TBD: This hardcoded list of viewers should be replaced with a dynamic lookup @@ -56,7 +53,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer new WindowsRegistryViewer(), new PDFViewer() }; - + private FileTypeViewer lastViewer; /** @@ -74,9 +71,9 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer } }); } - + initComponents(); - + LOGGER.log(Level.INFO, "Created ApplicationContentViewer instance: {0}", this); //NON-NLS } @@ -85,7 +82,8 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer * * @param file * - * @return FileTypeViewer, null if no known content viewer supports the file + * @return FileTypeViewer, null if no known content viewer supports the + * file */ private FileTypeViewer getSupportingViewer(AbstractFile file) { FileTypeViewer viewer = mimeTypeToViewerMap.get(file.getMIMEType()); @@ -112,18 +110,18 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer // End of variables declaration//GEN-END:variables @Override public void setNode(Node selectedNode) { - + resetComponent(); - - if (selectedNode == null || !isSupported(selectedNode)) { + + if (selectedNode == null) { return; } - + AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if ((file == null) || (file.isDir())) { return; } - + String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS @@ -135,81 +133,67 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return; } else { FileTypeViewer viewer = getSupportingViewer(file); if (viewer != null) { lastViewer = viewer; - + viewer.setFile(file); this.removeAll(); this.add(viewer.getComponent()); this.validate(); } } - + } - + @Override @NbBundle.Messages("ApplicationContentViewer.title=Application") public String getTitle() { return Bundle.ApplicationContentViewer_title(); } - + @Override @NbBundle.Messages("ApplicationContentViewer.toolTip=Displays file contents.") public String getToolTip() { return Bundle.ApplicationContentViewer_toolTip(); } - + @Override public DataContentViewer createInstance() { return new FileViewer(); } - + @Override public Component getComponent() { return this; } - + @Override public void resetComponent() { - + if (lastViewer != null) { lastViewer.resetComponent(); } this.removeAll(); lastViewer = null; } - + @Override public boolean isSupported(Node node) { - + if (node == null) { return false; } - + AbstractFile aFile = node.getLookup().lookup(AbstractFile.class); if ((aFile == null) || (aFile.isDir())) { return false; } - if (node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - try { - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && aFile.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - LOGGER.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. File content viewer will not be supported.", - theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), aFile.getName(), aFile.getId()), ex); - return false; - } - } + String mimeType = aFile.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", aFile.getName()); //NON-NLS @@ -221,20 +205,20 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return false; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return false; } else { return (getSupportingViewer(aFile) != null); } - + } - + @Override public int isPreferred(Node node) { AbstractFile file = node.getLookup().lookup(AbstractFile.class); String mimeType = file.getMIMEType(); - + if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); //NON-NLS try { @@ -245,7 +229,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return 0; } } - + if (mimeType.equalsIgnoreCase("application/octet-stream")) { return 0; } else { @@ -253,7 +237,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer return CONFIDENCE_LEVEL; } } - + return 0; } } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java index fcf18f77ff..45dae8e2e0 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Metadata.java @@ -29,7 +29,6 @@ import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; @@ -51,7 +50,7 @@ import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM; public class Metadata extends javax.swing.JPanel implements DataContentViewer { private static final Logger LOGGER = Logger.getLogger(Metadata.class.getName()); - + /** * Creates new form Metadata */ @@ -149,10 +148,6 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { "Metadata.nodeText.none=None"}) @Override public void setNode(Node node) { - if ((node == null) || (!isSupported(node))) { - resetComponent(); - return; - } AbstractFile file = node.getLookup().lookup(AbstractFile.class); Image image = node.getLookup().lookup(Image.class); DataSource dataSource = node.getLookup().lookup(DataSource.class); @@ -181,6 +176,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.created"), ContentUtils.getStringTime(file.getCrtime(), file)); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.changed"), ContentUtils.getStringTime(file.getCtime(), file)); + String md5 = file.getMd5Hash(); if (md5 == null) { md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc"); @@ -193,12 +189,12 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString()); addAcquisitionDetails(sb, dataSource); - + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(file.getId())); if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), file.getLocalAbsPath()); } - + try { List associatedObjectArtifacts = file.getArtifacts(ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT); if (!associatedObjectArtifacts.isEmpty()) { @@ -211,14 +207,14 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { } } } catch (TskCoreException ex) { - sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage()); + sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage()); } - + endTable(sb); /* - * If we have a file system file, grab the more detailed metadata - * text too + * If we have a file system file, grab the more detailed metadata text + * too */ try { if (file instanceof FsContent) { @@ -230,11 +226,11 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { for (String str : fsFile.getMetaDataText()) { sb.append(str).append("
"); //NON-NLS - /* - * Very long results can cause the UI to hang before - * displaying, so truncate the results if necessary. + /* + * Very long results can cause the UI to hang before displaying, + * so truncate the results if necessary. */ - if (sb.length() > 50000) { + if(sb.length() > 50000){ sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.truncated")); break; } @@ -250,7 +246,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { } catch (TskCoreException ex) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getName()); } - addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName()); + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName()); addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(image.getSize())); try { @@ -286,46 +282,46 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { StringBuilder pathValues = new StringBuilder("
"); pathValues.append(imagePaths[0]); pathValues.append("
"); - for (int i = 1; i < imagePaths.length; i++) { + for (int i=1; i < imagePaths.length; i++) { pathValues.append("
"); pathValues.append(imagePaths[i]); pathValues.append("
"); } addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), pathValues.toString()); } else { - addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), + addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), NbBundle.getMessage(this.getClass(), "Metadata.nodeText.none")); } } - + setText(sb.toString()); jTextPane1.setCaretPosition(0); this.setCursor(null); } - + /** - * Adds a row for download source from the given associated artifact, if the - * associated artifacts specifies a source. - * - * @param sb string builder. + * Adds a row for download source from the given associated artifact, + * if the associated artifacts specifies a source. + * + * @param sb string builder. * @param associatedArtifact - * + * * @throws TskCoreException if there is an error */ - private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact) throws TskCoreException { - if (associatedArtifact != null - && ((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) - || (associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()))) { + private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact ) throws TskCoreException { + if (associatedArtifact != null && + ((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) || + (associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID())) ) { BlackboardAttribute urlAttr = associatedArtifact.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL)); if (urlAttr != null) { addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.downloadSource"), urlAttr.getValueString()); } } } - + /** * Add the acquisition details to the results (if applicable) - * + * * @param sb The output StringBuilder object * @param dataSource The data source (may be null) */ @@ -373,22 +369,6 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer { public boolean isSupported(Node node) { Image image = node.getLookup().lookup(Image.class); AbstractFile file = node.getLookup().lookup(AbstractFile.class); - if (file != null && node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - try { - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && file.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - LOGGER.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Metadata viewer will not be supported.", - theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), file.getName(), file.getId()), ex); - return false; - } - } - return (file != null) || (image != null); } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index c529a8aa9d..c9c1535975 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -46,24 +46,10 @@ DataContentViewerArtifact.failedToGetSourcePath.message=Failed to get source fil DefaultTableArtifactContentViewer.attrsTableHeader.sources=Source(s) DefaultTableArtifactContentViewer.attrsTableHeader.type=Type DefaultTableArtifactContentViewer.attrsTableHeader.value=Value -GeneralPurposeArtifactViewer.dates.created=Created -GeneralPurposeArtifactViewer.dates.end=End -GeneralPurposeArtifactViewer.dates.start=Start -GeneralPurposeArtifactViewer.dates.time=Time -GeneralPurposeArtifactViewer.details.attrHeader=Details -GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details -GeneralPurposeArtifactViewer.details.cachedHeader=Cached File -GeneralPurposeArtifactViewer.details.cookieHeader=Cookie Details +GeneralPurposeArtifactViewer.details.attrHeader=Attributes GeneralPurposeArtifactViewer.details.dataSource=Data Source -GeneralPurposeArtifactViewer.details.datesHeader=Dates -GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File GeneralPurposeArtifactViewer.details.file=File -GeneralPurposeArtifactViewer.details.historyHeader=Visit Details -GeneralPurposeArtifactViewer.details.otherHeader=Other -GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source -GeneralPurposeArtifactViewer.noFile.text=\ (no longer exists) -GeneralPurposeArtifactViewer.term.label=Term GeneralPurposeArtifactViewer.unknown.text=Unknown GeneralPurposeArtifactViewer_menuitem_copy=Copy MessageAccountPanel.account.justification=Account found in Message artifact diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java index a63e3e6f85..c223f577b0 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/contextviewer/ContextViewer.java @@ -36,7 +36,6 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT; @@ -226,21 +225,6 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte // check if the node has an abstract file and the file has any context defining artifacts. if (node.getLookup().lookup(AbstractFile.class) != null) { AbstractFile abstractFile = node.getLookup().lookup(AbstractFile.class); - if (node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - try { - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && abstractFile.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Context content viewer will not be supported.", - theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), abstractFile.getName(), abstractFile.getId()), ex); - return false; - } - } for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) { List artifactsList; try { @@ -265,7 +249,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } @NbBundle.Messages({ - "ContextViewer.unknownSource=Unknown ",}) + "ContextViewer.unknownSource=Unknown ", + }) /** * Looks for context providing artifacts for the given file and populates * the source context. @@ -278,7 +263,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private void populatePanels(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); - + // Check for all context artifacts boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) { @@ -307,7 +292,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte contextContainer.add(usagePanel); } } - + contextContainer.setBackground(javax.swing.UIManager.getDefaults().getColor("window")); contextContainer.setEnabled(foundASource); contextContainer.setVisible(foundASource); @@ -316,12 +301,12 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte jScrollPane.setVisible(foundASource); jScrollPane.repaint(); jScrollPane.revalidate(); - + + } /** - * Resolves an TSK_ASSOCIATED_OBJECT artifact and adds it to the appropriate - * panel + * Resolves an TSK_ASSOCIATED_OBJECT artifact and adds it to the appropriate panel * * @param artifact Artifact that may provide context. * @@ -373,16 +358,16 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == associatedArtifact.getArtifactTypeID()) { String sourceName = Bundle.ContextViewer_recentDocs(); String sourceText = recentDocArtifactToString(associatedArtifact); - ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); + ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); contextUsagePanels.add(usagePanel); - + } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == associatedArtifact.getArtifactTypeID()) { String sourceName = Bundle.ContextViewer_programExecution(); String sourceText = programExecArtifactToString(associatedArtifact); - ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); + ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime); contextUsagePanels.add(usagePanel); } - + Collections.sort(contextSourcePanels, new SortByDateTime()); Collections.sort(contextUsagePanels, new SortByDateTime()); } @@ -414,7 +399,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } /** - * Returns a display string with recent Doc artifact. + * Returns a display string with recent Doc + * artifact. * * @param artifact artifact to get doc from. * @@ -429,9 +415,9 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private String recentDocArtifactToString(BlackboardArtifact artifact) throws TskCoreException { StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN); Map attributesMap = getAttributesMap(artifact); - + BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == artifact.getArtifactTypeID()) { if (attribute != null && attribute.getValueLong() > 0) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_on()); @@ -443,7 +429,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte } /** - * Returns a display string with Program Execution artifact. + * Returns a display string with Program Execution + * artifact. * * @param artifact artifact to get doc from. * @@ -458,9 +445,9 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte private String programExecArtifactToString(BlackboardArtifact artifact) throws TskCoreException { StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN); Map attributesMap = getAttributesMap(artifact); - + BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == artifact.getArtifactTypeID()) { if (attribute != null && attribute.getValueLong() > 0) { appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_runOn()); @@ -551,9 +538,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte return attributeMap; } - + interface DateTimePanel { - /** * Return the date time value for this panel. * @@ -561,28 +547,28 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte */ Long getDateTime(); } - - /** + + /** * Return the dateTime value for the given message artifact. - * - * @param artifact - * + * + * @param artifact + * * @return Long dateTime value or null if the attribute was not found. - * - * @throws TskCoreException + * + * @throws TskCoreException */ private Long getArtifactDateTime(BlackboardArtifact artifact) throws TskCoreException { - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + if (BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() == artifact.getArtifactTypeID()) { - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT)); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT)); } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID() || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) { - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); } return (attribute != null ? attribute.getValueLong() : null); } - + /** * Class for sorting lists of DateTimePanels. */ @@ -592,18 +578,18 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte public int compare(DateTimePanel panel1, DateTimePanel panel2) { Long dateTime1 = panel1.getDateTime(); Long dateTime2 = panel2.getDateTime(); - - if (dateTime1 == null && dateTime2 == null) { + + if(dateTime1 == null && dateTime2 == null) { return 0; - } else if (dateTime1 == null) { + } else if(dateTime1 == null) { return -1; - } else if (dateTime2 == null) { + } else if(dateTime2 == null) { return 1; } - + return dateTime1.compareTo(dateTime2); } - + } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java index 67241594a8..d7f853caab 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/textcontentviewer/TextContentViewer.java @@ -19,16 +19,11 @@ package org.sleuthkit.autopsy.contentviewers.textcontentviewer; import java.awt.Component; -import java.util.logging.Level; import org.openide.nodes.Node; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; -import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.TskCoreException; /** * A DataContentViewer that displays text with the TextViewers available. @@ -38,7 +33,6 @@ public class TextContentViewer implements DataContentViewer { private final TextContentViewerPanel panel; private volatile Node currentNode = null; - private static final Logger logger = Logger.getLogger(TextContentViewer.class.getName()); /** * No arg constructor for creating the main instance of this Content Viewer. @@ -58,10 +52,6 @@ public class TextContentViewer implements DataContentViewer { @Override public void setNode(Node selectedNode) { - if ((selectedNode == null) || (!isSupported(selectedNode))) { - resetComponent(); - return; - } currentNode = selectedNode; panel.setNode(currentNode); @@ -106,26 +96,12 @@ public class TextContentViewer implements DataContentViewer { if (file == null) { return false; } - if (node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - try { - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && file.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm file with name %s and objId = %d is not the parent. Text content viewer will not be supported.", - theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), file.getName(), file.getId()), ex); - return false; - } - } + // disable the text content viewer for directories and empty files if (file.isDir() || file.getSize() == 0) { return false; } - + return panel.isSupported(node); } From ad81882247bca077a1e7028cb691d7b33f36e835 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Dec 2020 10:39:10 -0500 Subject: [PATCH 25/26] 7050 roll back other content viewer changes --- .../DataContentViewerOtherCases.java | 58 +++---------------- .../DataContentViewerArtifact.java | 43 +++++--------- .../corecomponents/DataContentViewerHex.java | 21 +------ 3 files changed, 23 insertions(+), 99 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java index 70198bc678..56922c7bfb 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -52,11 +52,9 @@ import javax.swing.JPanel; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; -import org.apache.commons.lang.StringUtils; import org.joda.time.DateTimeZone; import org.joda.time.LocalDateTime; import org.openide.nodes.Node; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.casemodule.Case; @@ -78,7 +76,6 @@ import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskData; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; /** * View correlation results from other cases @@ -469,16 +466,11 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi if (bbArtifact != null && CentralRepository.isEnabled()) { ret.addAll(CorrelationAttributeUtil.makeCorrAttrsForCorrelation(bbArtifact)); } - boolean isSupported = false; - try { - isSupported = this.file != null && this.file.getSize() > 0 && isDownloadParentSupported(node); - } catch (TskCoreException ex) { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); - } // we can correlate based on the MD5 if it is enabled - if (isSupported && CentralRepository.isEnabled()) { + if (this.file != null && CentralRepository.isEnabled() && this.file.getSize() > 0) { try { + List artifactTypes = CentralRepository.getInstance().getDefinedCorrelationTypes(); String md5 = this.file.getMd5Hash(); if (md5 != null && !md5.isEmpty() && null != artifactTypes && !artifactTypes.isEmpty()) { @@ -506,7 +498,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi LOGGER.log(Level.SEVERE, "Error connecting to DB", ex); // NON-NLS } // If EamDb not enabled, get the Files default correlation type to allow Other Occurances to be enabled. - } else if (isSupported) { + } else if (this.file != null && this.file.getSize() > 0) { String md5 = this.file.getMd5Hash(); if (md5 != null && !md5.isEmpty()) { try { @@ -525,37 +517,8 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } } - return ret; - } - /** - * Private helper method to check if the node is an TSK_WEB_DOWNLOAD or - * TSK_WEB_CACHE artifact and if it is, if the file reflects the parent file - * or the downloaded file. - * - * @param node The node to check support for. - * - * @return False if the node is for a Web Cache or a Web Download artifact, - * and that artifact's content file is it's parent. - * - * @throws TskCoreException Unable to retrieve the parent of the artifact in - * this node. - */ - private boolean isDownloadParentSupported(Node node) throws TskCoreException { - if (node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - try { - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && this.file.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - throw new TskCoreException(String.format("Error getting parent of artifact with type %s and objID = %d can not confirm content with name %s and objId = %d is not the parent. Other occurences will not correlate on the file.", theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), this.file.getName(), this.file.getId()), ex); - } - } - return true; + return ret; } @Messages({"DataContentViewerOtherCases.earliestCaseNotAvailable= Not Enabled."}) @@ -738,16 +701,11 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi this.file = this.getAbstractFileFromNode(node); if (CentralRepository.isEnabled()) { return !getCorrelationAttributesFromNode(node).isEmpty(); - } else if (this.file == null || this.file.getSize() <= 0 || StringUtils.isBlank(file.getMd5Hash())) { - return false; + } else { + return this.file != null + && this.file.getSize() > 0 + && ((this.file.getMd5Hash() != null) && (!this.file.getMd5Hash().isEmpty())); } - boolean isSupported = false; - try { - isSupported = isDownloadParentSupported(node); - } catch (TskCoreException ex) { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); - } - return isSupported; } @Override diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java index 5f5a3313e6..b6a1373236 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java @@ -501,39 +501,24 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat Lookup lookup = selectedNode.getLookup(); // Get the content. We may get BlackboardArtifacts, ignore those here. + ArrayList artifacts = new ArrayList<>(); Collection contents = lookup.lookupAll(Content.class); if (contents.isEmpty()) { return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); } Content underlyingContent = null; - //find the first non-artifact content from the lookup results for (Content content : contents) { if ((content != null) && (!(content instanceof BlackboardArtifact))) { - underlyingContent = content; - break; - } - } - ArrayList contentArtifacts = new ArrayList<>(); - if (underlyingContent != null) { - try { - //get the artifacts seperately for the use case where an artifact is about a file that exists other than its parent such as a TSK_WEB_DOWNLOAD or TSK_WEB_CACHE - Collection nodeArtifacts = lookup.lookupAll(BlackboardArtifact.class); - if (!nodeArtifacts.isEmpty()) { - BlackboardArtifact originalArtifact = nodeArtifacts.iterator().next(); - if ((originalArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || originalArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && underlyingContent.getId() == originalArtifact.getParent().getId()) { - contentArtifacts.add(originalArtifact); - } + // Get all of the blackboard artifacts associated with the content. These are what this + // viewer displays. + try { + artifacts = content.getAllArtifacts(); + underlyingContent = content; + break; + } catch (TskException ex) { + logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS + return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); } - if (contentArtifacts.isEmpty()) { - // Get all of the blackboard artifacts associated with the content. These are what this - // viewer displays. - contentArtifacts = underlyingContent.getAllArtifacts(); - } - } catch (TskException ex) { - logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS - return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT); } } @@ -543,7 +528,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat // Build the new artifact contents cache. ArrayList artifactContents = new ArrayList<>(); - for (BlackboardArtifact artifact : contentArtifacts) { + for (BlackboardArtifact artifact : artifacts) { artifactContents.add(artifact); } @@ -552,7 +537,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat int index = 0; BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class); if (artifact != null) { - index = contentArtifacts.indexOf(artifact); + index = artifacts.indexOf(artifact); if (index == -1) { index = 0; } else { @@ -562,9 +547,9 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) { long assocArtifactId = attr.getValueLong(); int assocArtifactIndex = -1; - for (BlackboardArtifact art : contentArtifacts) { + for (BlackboardArtifact art : artifacts) { if (assocArtifactId == art.getArtifactID()) { - assocArtifactIndex = contentArtifacts.indexOf(art); + assocArtifactIndex = artifacts.indexOf(art); break; } } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java index c3320cfb38..be8f854b96 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java @@ -44,10 +44,8 @@ import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import static org.sleuthkit.autopsy.corecomponents.Bundle.*; import org.sleuthkit.autopsy.coreutils.FileUtil; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.datamodel.DataConversion; -import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -608,24 +606,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont return false; } Content content = DataContentViewerUtility.getDefaultContent(node); - if (content == null || content.getSize() <= 0) { - return false; - } else if (node instanceof BlackboardArtifactNode) { - BlackboardArtifact theArtifact = ((BlackboardArtifactNode) node).getArtifact(); - //disable the content viewer when a download or cached file does not exist instead of displaying its parent - try { - if ((theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() - || theArtifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) - && content.getId() == theArtifact.getParent().getId()) { - return false; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, String.format("Error getting parent of artifact with type %s and objID = %d can not confirm content with name %s and objId = %d is not the parent. Hex content viewer will not be supported.", - theArtifact.getArtifactTypeName(), theArtifact.getObjectID(), content.getName(), content.getId()), ex); - return false; - } - } - return true; + return content != null && content.getSize() > 0; } @Override From 1dd895dc72ac6e7c796a9883a2c790b46c27c47c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Dec 2020 10:54:27 -0500 Subject: [PATCH 26/26] 7050 Bundle properties file --- .../artifactviewers/Bundle.properties-MERGED | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED index c9c1535975..c529a8aa9d 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/artifactviewers/Bundle.properties-MERGED @@ -46,10 +46,24 @@ DataContentViewerArtifact.failedToGetSourcePath.message=Failed to get source fil DefaultTableArtifactContentViewer.attrsTableHeader.sources=Source(s) DefaultTableArtifactContentViewer.attrsTableHeader.type=Type DefaultTableArtifactContentViewer.attrsTableHeader.value=Value -GeneralPurposeArtifactViewer.details.attrHeader=Attributes +GeneralPurposeArtifactViewer.dates.created=Created +GeneralPurposeArtifactViewer.dates.end=End +GeneralPurposeArtifactViewer.dates.start=Start +GeneralPurposeArtifactViewer.dates.time=Time +GeneralPurposeArtifactViewer.details.attrHeader=Details +GeneralPurposeArtifactViewer.details.bookmarkHeader=Bookmark Details +GeneralPurposeArtifactViewer.details.cachedHeader=Cached File +GeneralPurposeArtifactViewer.details.cookieHeader=Cookie Details GeneralPurposeArtifactViewer.details.dataSource=Data Source +GeneralPurposeArtifactViewer.details.datesHeader=Dates +GeneralPurposeArtifactViewer.details.downloadHeader=Downloaded File GeneralPurposeArtifactViewer.details.file=File +GeneralPurposeArtifactViewer.details.historyHeader=Visit Details +GeneralPurposeArtifactViewer.details.otherHeader=Other +GeneralPurposeArtifactViewer.details.searchHeader=Web Search GeneralPurposeArtifactViewer.details.sourceHeader=Source +GeneralPurposeArtifactViewer.noFile.text=\ (no longer exists) +GeneralPurposeArtifactViewer.term.label=Term GeneralPurposeArtifactViewer.unknown.text=Unknown GeneralPurposeArtifactViewer_menuitem_copy=Copy MessageAccountPanel.account.justification=Account found in Message artifact