From a2378ff326b342b2c1da3b4f75e77941993efc68 Mon Sep 17 00:00:00 2001 From: "eugene.livis" Date: Wed, 3 Apr 2024 10:17:24 -0400 Subject: [PATCH 1/5] First cut --- .../autopsy/actions/AddTagAction.java | 2 +- .../autopsy/actions/GetTagNameDialog.java | 6 +-- .../autopsy/actions/ReplaceTagAction.java | 2 +- .../services/TagNameDefinition.java | 45 +++++++++++-------- .../casemodule/services/TagNameDialog.java | 2 +- .../casemodule/services/TagOptionsPanel.java | 8 ++-- .../casemodule/services/TagsManager.java | 26 +++++------ .../application/OtherOccurrences.java | 4 +- .../datamodel/CentralRepoDbUtil.java | 2 +- .../eventlisteners/CaseEventListener.java | 14 +++--- .../infrastructure/ReportVisualPanel2.java | 2 +- .../infrastructure/TableReportGenerator.java | 10 ++--- .../report/modules/html/HTMLReport.java | 2 +- .../PortableCaseReportModule.java | 2 +- .../org/sleuthkit/autopsy/tags/TagUtils.java | 2 +- 15 files changed, 68 insertions(+), 61 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java index ff3dc08e04..564499680c 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java @@ -239,7 +239,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { */ private JMenuItem createMenutItem(TagName tagName) { String tagDisplayName = tagName.getDisplayName(); - String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); if (tagDisplayName.equals(TagsManager.getBookmarkTagDisplayName())) { diff --git a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java index 2617d08df3..c6b1e7b9c4 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/actions/GetTagNameDialog.java @@ -174,10 +174,10 @@ public class GetTagNameDialog extends JDialog { private final String name; private final String description; - private final TskData.FileKnown status; + private final TskData.TagType status; private final TagName.HTML_COLOR color; - AddTagNameWorker(String name, String description, TskData.FileKnown status, TagName.HTML_COLOR color) { + AddTagNameWorker(String name, String description, TskData.TagType status, TagName.HTML_COLOR color) { this.name = name; this.description = description; this.status = status; @@ -375,7 +375,7 @@ public class GetTagNameDialog extends JDialog { private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed String tagDisplayName = tagNameField.getText(); String userTagDescription = descriptionTextArea.getText(); - TskData.FileKnown status = notableCheckbox.isSelected() ? TskData.FileKnown.BAD : TskData.FileKnown.UNKNOWN; + TskData.TagType status = notableCheckbox.isSelected() ? TskData.TagType.BAD : TskData.TagType.SUSPICIOUS; if (tagDisplayName.isEmpty()) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(), diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java index 34ed836e3e..1d263bc407 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -226,7 +226,7 @@ abstract class ReplaceTagAction extends AbstractAction implements */ private JMenuItem createMenutItem(TagName tagName, Set tagNamesToDisable, Collection selectedTags) { String tagDisplayName = tagName.getDisplayName(); - String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); if (tagDisplayName.equals(TagsManager.getBookmarkTagDisplayName())) { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java index 24f208f421..25345615b4 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java @@ -59,15 +59,15 @@ final public class TagNameDefinition implements Comparable { private final String displayName; private final String description; private final TagName.HTML_COLOR color; - private final TskData.FileKnown knownStatus; + private final TskData.TagType tagType; private static final List STANDARD_TAGS_DEFINITIONS = new ArrayList<>(); private static final List PROJECT_VIC_NAMES_NO_LONGER_USED = new ArrayList<>(); static { - STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_bookmark_text(), "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN)); - STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_followUp_text(), "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN)); - STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_notableItem_text(), "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD)); + STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_bookmark_text(), "", TagName.HTML_COLOR.NONE, TskData.TagType.SUSPICIOUS)); + STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_followUp_text(), "", TagName.HTML_COLOR.NONE, TskData.TagType.SUSPICIOUS)); + STANDARD_TAGS_DEFINITIONS.add(new TagNameDefinition(Bundle.TagNameDefinition_predefTagNames_notableItem_text(), "", TagName.HTML_COLOR.NONE, TskData.TagType.BAD)); PROJECT_VIC_NAMES_NO_LONGER_USED.add("CAT-1: Child Exploitation (Illegal)"); PROJECT_VIC_NAMES_NO_LONGER_USED.add("CAT-2: Child Exploitation (Non-Illegal/Age Difficult)"); @@ -79,18 +79,25 @@ final public class TagNameDefinition implements Comparable { /** * Constructs a tag name definition consisting of a display name, - * description, color and knownStatus. + * description, color and tag type. * * @param displayName The display name for the tag name. * @param description The description for the tag name. * @param color The color for the tag name. * @param status The status denoted by the tag name. */ - public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) { + /* ELTODO public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) { this.displayName = displayName; this.description = description; this.color = color; - this.knownStatus = status; + this.tagType = status; + }*/ + + public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.TagType status) { + this.displayName = displayName; + this.description = description; + this.color = color; + this.tagType = status; } static Collection getStandardTagNameDefinitions() { @@ -164,10 +171,10 @@ final public class TagNameDefinition implements Comparable { /** * The status which will be applied to items with this tag. * - * @return a value of TskData.FileKnown which is associated with this tag + * @return a value of TskData.TagType which is associated with this tag */ - public TskData.FileKnown getKnownStatus() { - return knownStatus; + public TskData.TagType getTagType() { + return tagType; } /** @@ -212,7 +219,7 @@ final public class TagNameDefinition implements Comparable { return false; } boolean sameName = this.getDisplayName().equals(((TagNameDefinition) obj).getDisplayName()); - boolean sameStatus = this.getKnownStatus().equals(((TagNameDefinition) obj).getKnownStatus()); + boolean sameStatus = this.getTagType().equals(((TagNameDefinition) obj).getTagType()); return sameName && sameStatus; } @@ -231,13 +238,13 @@ final public class TagNameDefinition implements Comparable { * that is used by the tags settings file. */ private String toSettingsFormat() { - return displayName + "," + description + "," + color.name() + "," + knownStatus.toString(); + return displayName + "," + description + "," + color.name() + "," + tagType.toString(); } TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { - tagName = caseDb.getTaggingManager().addOrUpdateTagName(displayName, description, color, knownStatus); + tagName = caseDb.getTaggingManager().addOrUpdateTagName(displayName, description, color, tagType); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error saving tag name definition", ex); } @@ -251,7 +258,7 @@ final public class TagNameDefinition implements Comparable { * The currently custom tags properties are stored in one string property * value separated by ;. The properties of an individual tag are comma * separated in the format of: - * tag_name,tag_description,tag_color,known_status + * tag_name,tag_description,tag_color,tag_type * * In prior versions of autopsy the known_status was stored in the central * repository, therefore the properties file only had three values. @@ -279,7 +286,7 @@ final public class TagNameDefinition implements Comparable { String[] attributes = tagProps.split(","); definitions.add(new TagNameDefinition(attributes[0], attributes[1], - TagName.HTML_COLOR.valueOf(attributes[2]), TskData.FileKnown.valueOf(attributes[3]))); + TagName.HTML_COLOR.valueOf(attributes[2]), TskData.TagType.valueOf(attributes[3]))); } return definitions; @@ -332,18 +339,18 @@ final public class TagNameDefinition implements Comparable { List notableTagList = null; for (String tagProps : individualTags) { String[] attributes = tagProps.split(","); - TskData.FileKnown fileKnown = TskData.FileKnown.UNKNOWN; + TskData.TagType fileKnown = TskData.TagType.SUSPICIOUS; if (attributes.length == 3) { // If notableTagList is null load it from the CR. if (notableTagList == null) { - notableTagList = getCRNotableList(); + notableTagList = getCRNotableList(); // ELTODO handle backwards compatibility } else { if (notableTagList.contains(attributes[0])) { - fileKnown = TskData.FileKnown.BAD; + fileKnown = TskData.TagType.BAD; } } } else { - fileKnown = TskData.FileKnown.valueOf(attributes[3]); + fileKnown = TskData.TagType.valueOf(attributes[3]); } definitions.add(new TagNameDefinition(attributes[0], attributes[1], diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java index 79207aaaaa..dccd8ae38a 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java @@ -62,7 +62,7 @@ final class TagNameDialog extends javax.swing.JDialog { initComponents(); tagNameTextField.setText(tagNameToEdit.getDisplayName()); descriptionTextArea.setText(tagNameToEdit.getDescription()); - notableCheckbox.setSelected(tagNameToEdit.getKnownStatus() == TskData.FileKnown.BAD); + notableCheckbox.setSelected(tagNameToEdit.getTagType() == TskData.TagType.BAD); tagNameTextField.setEnabled(false); this.display(); } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java index 2ef9869adc..a0947b468b 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java @@ -314,7 +314,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { TagNameDialog dialog = new TagNameDialog(); TagNameDialog.BUTTON_PRESSED result = dialog.getResult(); if (result == TagNameDialog.BUTTON_PRESSED.OK) { - TskData.FileKnown status = dialog.isTagNotable() ? TskData.FileKnown.BAD : TskData.FileKnown.UNKNOWN; + TskData.TagType status = dialog.isTagNotable() ? TskData.TagType.BAD : TskData.TagType.SUSPICIOUS; TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), dialog.getTagDesciption(), DEFAULT_COLOR, status); /* * If tag name already exists, don't add the tag name. @@ -348,7 +348,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { TagNameDialog dialog = new TagNameDialog(originalTagName); TagNameDialog.BUTTON_PRESSED result = dialog.getResult(); if (result == TagNameDialog.BUTTON_PRESSED.OK) { - TskData.FileKnown status = dialog.isTagNotable() ? TskData.FileKnown.BAD : TskData.FileKnown.UNKNOWN; + TskData.TagType status = dialog.isTagNotable() ? TskData.TagType.BAD : TskData.TagType.SUSPICIOUS; TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), dialog.getTagDesciption(), DEFAULT_COLOR, status); /* * If tag name already exists, don't add the tag name. @@ -359,7 +359,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { tagNamesList.setSelectedValue(newTagType, true); updatePanel(); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - if (originalTagName.getKnownStatus() != newTagType.getKnownStatus() && Case.isCaseOpen()) { + if (originalTagName.getTagType() != newTagType.getTagType() && Case.isCaseOpen()) { updatedStatusTags.add(newTagType.getDisplayName()); } } @@ -449,7 +449,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { deleteTagNameButton.setEnabled(enableEdit); if (isSelected) { descriptionTextArea.setText(tagNamesList.getSelectedValue().getDescription()); - if (tagNamesList.getSelectedValue().getKnownStatus() == TskData.FileKnown.BAD) { + if (tagNamesList.getSelectedValue().getTagType() == TskData.TagType.BAD) { notableYesOrNoLabel.setText("Yes"); } else { notableYesOrNoLabel.setText("No"); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index a4bd51bcce..4f004884c5 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -188,7 +188,7 @@ public class TagsManager implements Closeable { } /** - * Gets the set of display names of notable (TskData.FileKnown.BAD) tag + * Gets the set of display names of notable (TskData.TagType.BAD) tag * types. If a case is not open the list will only include only the user * defined custom tags. Otherwise the list will include all notable tags. * @@ -197,7 +197,7 @@ public class TagsManager implements Closeable { public static List getNotableTagDisplayNames() { List tagDisplayNames = new ArrayList<>(); for (TagNameDefinition tagDef : TagNameDefinition.getTagNameDefinitions()) { - if (tagDef.getKnownStatus() == TskData.FileKnown.BAD) { + if (tagDef.getTagType() == TskData.TagType.BAD) { tagDisplayNames.add(tagDef.getDisplayName()); } } @@ -205,7 +205,7 @@ public class TagsManager implements Closeable { try { TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); for (TagName tagName : tagsManager.getAllTagNames()) { - if (tagName.getKnownStatus() == TskData.FileKnown.BAD + if (tagName.getTagType() == TskData.TagType.BAD && !tagDisplayNames.contains(tagName.getDisplayName())) { tagDisplayNames.add(tagName.getDisplayName()); } @@ -303,14 +303,14 @@ public class TagsManager implements Closeable { // add the standard tag names for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) { - taggingMgr.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); + taggingMgr.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getTagType()); } //Assume new case and add all tag sets for (TagSetDefinition setDef : TagSetDefinition.readTagSetDefinitions()) { List tagNamesInSet = new ArrayList<>(); for (TagNameDefinition tagNameDef : setDef.getTagNameDefinitions()) { - tagNamesInSet.add(taggingMgr.addOrUpdateTagName(tagNameDef.getDisplayName(), tagNameDef.getDescription(), tagNameDef.getColor(), tagNameDef.getKnownStatus())); + tagNamesInSet.add(taggingMgr.addOrUpdateTagName(tagNameDef.getDisplayName(), tagNameDef.getDescription(), tagNameDef.getColor(), tagNameDef.getTagType())); } if (!tagNamesInSet.isEmpty()) { @@ -505,7 +505,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN); + return addTagName(displayName, "", TagName.HTML_COLOR.NONE, TskData.TagType.SUSPICIOUS); } /** @@ -524,7 +524,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, description, TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN); + return addTagName(displayName, description, TagName.HTML_COLOR.NONE, TskData.TagType.SUSPICIOUS); } /** @@ -543,7 +543,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, description, color, TskData.FileKnown.UNKNOWN); + return addTagName(displayName, description, color, TskData.TagType.SUSPICIOUS); } /** @@ -553,8 +553,8 @@ public class TagsManager implements Closeable { * @param displayName The display name for the new tag type. * @param description The description for the new tag type. * @param color The color to associate with the new tag type. - * @param knownStatus The knownStatus to be used for the tag when - * correlating on the tagged item + * @param tagType The tagType to be used for the tag when + correlating on the tagged item * * @return A TagName object that can be used to add instances of the tag * type to the case database. @@ -563,12 +563,12 @@ public class TagsManager implements Closeable { * @throws TskCoreException If there is an error adding the tag * name to the case database. */ - public TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException { + public TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.TagType tagType) throws TagNameAlreadyExistsException, TskCoreException { synchronized (lock) { try { - TagName tagName = caseDb.getTaggingManager().addOrUpdateTagName(displayName, description, color, knownStatus); + TagName tagName = caseDb.getTaggingManager().addOrUpdateTagName(displayName, description, color, tagType); Set customTypes = TagNameDefinition.getTagNameDefinitions(); - customTypes.add(new TagNameDefinition(displayName, description, color, knownStatus)); + customTypes.add(new TagNameDefinition(displayName, description, color, tagType)); TagNameDefinition.setTagNameDefinitions(customTypes); return tagName; } catch (TskCoreException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java index ae35d971bf..61997e8de2 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java @@ -167,8 +167,8 @@ public final class OtherOccurrences { if (newNode.getKnown() != TskData.FileKnown.BAD) { List fileMatchTags = autopsyCase.getServices().getTagsManager().getContentTagsByContent(newFile); for (ContentTag tag : fileMatchTags) { - TskData.FileKnown tagKnownStatus = tag.getName().getKnownStatus(); - if (tagKnownStatus.equals(TskData.FileKnown.BAD)) { + TskData.TagType tagType = tag.getName().getTagType(); + if (tagType.equals(TskData.TagType.BAD)) { newNode.updateKnown(TskData.FileKnown.BAD); break; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java index 410e78e52d..8cc775192c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java @@ -307,7 +307,7 @@ public class CentralRepoDbUtil { } /** - * Conver thte Type's DbTableName string to the *_instances table name. + * Convert the Type's DbTableName string to the *_instances table name. * * @param type Correlation Type * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index 6610fcbd86..64a27e03de 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -482,10 +482,10 @@ public final class CaseEventListener implements PropertyChangeListener { for (BlackboardArtifactTag bbTag : artifactTags) { //start with assumption that none of the other tags applied to this Correlation Attribute will prevent it's status from being changed boolean hasTagWithConflictingKnownStatus = false; - // if the status of the tag has been changed to TskData.FileKnown.UNKNOWN + // if the status of the tag has been changed to TskData.TagType.UNKNOWN // we need to check the status of all other tags on this correlation attribute before changing // the status of the correlation attribute in the central repository - if (tagName.getKnownStatus() == TskData.FileKnown.UNKNOWN) { + if (tagName.getTagType() == TskData.TagType.UNKNOWN) { Content content = bbTag.getContent(); // If the content which this Blackboard Artifact Tag is linked to is an AbstractFile with KNOWN status then // it's status in the central reporsitory should not be changed to UNKNOWN @@ -503,7 +503,7 @@ public final class CaseEventListener implements PropertyChangeListener { continue; } //if any other tags on this artifact are Notable in status then this artifact can not have its status changed - if (TskData.FileKnown.BAD == t.getName().getKnownStatus()) { + if (TskData.TagType.BAD == t.getName().getTagType()) { //a tag with a conflicting status has been found, the status of this correlation attribute can not be modified hasTagWithConflictingKnownStatus = true; break; @@ -522,10 +522,10 @@ public final class CaseEventListener implements PropertyChangeListener { for (ContentTag contentTag : fileTags) { //start with assumption that none of the other tags applied to this ContentTag will prevent it's status from being changed boolean hasTagWithConflictingKnownStatus = false; - // if the status of the tag has been changed to TskData.FileKnown.UNKNOWN + // if the status of the tag has been changed to TskData.TagType.UNKNOWN // we need to check the status of all other tags on this file before changing // the status of the file in the central repository - if (tagName.getKnownStatus() == TskData.FileKnown.UNKNOWN) { + if (tagName.getTagType() == TskData.TagType.UNKNOWN) { Content content = contentTag.getContent(); TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); List tags = tagsManager.getContentTagsByContent(content); @@ -536,7 +536,7 @@ public final class CaseEventListener implements PropertyChangeListener { continue; } //if any other tags on this file are Notable in status then this file can not have its status changed - if (TskData.FileKnown.BAD == t.getName().getKnownStatus()) { + if (TskData.TagType.BAD == t.getName().getTagType()) { //a tag with a conflicting status has been found, the status of this file can not be modified hasTagWithConflictingKnownStatus = true; break; @@ -556,7 +556,7 @@ public final class CaseEventListener implements PropertyChangeListener { } } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Cannot update known status in central repository for tag: " + modifiedTagName, ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Cannot update tag type in central repository for tag: " + modifiedTagName, ex); //NON-NLS } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Cannot get central repository for tag: " + modifiedTagName, ex); //NON-NLS } catch (NoCurrentCaseException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java index 9a43174ae7..ddbfef840c 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java @@ -158,7 +158,7 @@ final class ReportVisualPanel2 extends JPanel { } for (TagName tagName : tagNamesInUse) { - String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; tagStates.put(tagName.getDisplayName() + notableString, Boolean.FALSE); } tags.addAll(tagStates.keySet()); diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java index 8a591d693e..96c2f58da0 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/TableReportGenerator.java @@ -94,7 +94,7 @@ class TableReportGenerator { String notableString = ""; for (TagName tagName : tagNamesInUse) { - notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; tagNames.add(tagName.getDisplayName() + notableString); } tagNamesFilter = new HashSet<>(tagNames); @@ -369,7 +369,7 @@ class TableReportGenerator { } // skip tags that we are not reporting on - String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tag.getName().getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { continue; } @@ -461,7 +461,7 @@ class TableReportGenerator { return; } - String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tag.getName().getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { continue; } @@ -1193,7 +1193,7 @@ class TableReportGenerator { try { List contentTags = Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByContent(content); for (ContentTag ct : contentTags) { - String notableString = ct.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = ct.getName().getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; allTags.add(ct.getName().getDisplayName() + notableString); } } catch (TskCoreException | NoCurrentCaseException ex) { @@ -1239,7 +1239,7 @@ class TableReportGenerator { List tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); HashSet uniqueTagNames = new HashSet<>(); for (BlackboardArtifactTag tag : tags) { - String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tag.getName().getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; uniqueTagNames.add(tag.getName().getDisplayName() + notableString); } if (failsTagFilter(uniqueTagNames, tagNamesFilter)) { diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java index 0d9ca80cb9..0f640885a4 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/html/HTMLReport.java @@ -954,7 +954,7 @@ public class HTMLReport implements TableReportModule { } for (int i = 0; i < contentTags.size(); i++) { ContentTag tag = contentTags.get(i); - String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tag.getName().getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; linkToThumbnail.append(tag.getName().getDisplayName()).append(notableString); if (i != contentTags.size() - 1) { linkToThumbnail.append(", "); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java index 1b022d069f..860739f91b 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java @@ -344,7 +344,7 @@ public class PortableCaseReportModule implements ReportModule { progressPanel.updateStatusLabel(Bundle.PortableCaseReportModule_generateReport_copyingTags()); try { for (TagName tagName : tagNames) { - TagName newTagName = portableSkCase.getTaggingManager().addOrUpdateTagName(tagName.getDisplayName(), tagName.getDescription(), tagName.getColor(), tagName.getKnownStatus()); + TagName newTagName = portableSkCase.getTaggingManager().addOrUpdateTagName(tagName.getDisplayName(), tagName.getDescription(), tagName.getColor(), tagName.getTagType()); oldTagNameToNewTagName.put(tagName, newTagName); } } catch (TskCoreException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/tags/TagUtils.java b/Core/src/org/sleuthkit/autopsy/tags/TagUtils.java index de93bed26e..aca445ea84 100755 --- a/Core/src/org/sleuthkit/autopsy/tags/TagUtils.java +++ b/Core/src/org/sleuthkit/autopsy/tags/TagUtils.java @@ -64,7 +64,7 @@ public final class TagUtils { logger.log(Level.SEVERE, String.format("Failed to get TagSet for TagName '%s' (ID=%d)", tagName.getDisplayName(), tagName.getId())); } - if (tagName.getKnownStatus() == TskData.FileKnown.BAD) { + if (tagName.getTagType() == TskData.TagType.BAD) { displayName += " (Notable)"; } From 2c4b795a46612b82adeac153f676fbb01ab8856f Mon Sep 17 00:00:00 2001 From: "eugene.livis" Date: Wed, 10 Apr 2024 15:36:08 -0400 Subject: [PATCH 2/5] Fixes --- .../services/TagNameDefinition.java | 29 ++++++++++++------- .../eventlisteners/CaseEventListener.java | 10 ++++--- .../imagegallery/ImageGalleryService.java | 12 ++++---- .../imagegallery/actions/AddTagAction.java | 2 +- .../imagegallery/actions/DeleteTagAction.java | 2 +- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java index 25345615b4..c8f04560e9 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2024 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +54,7 @@ final public class TagNameDefinition implements Comparable { private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS private static final String TAG_SETTING_VERSION_KEY = "CustomTagNameVersion"; - private static final int TAG_SETTINGS_VERSION = 1; + private static final int TAG_SETTINGS_VERSION = 2; // Changed tag type from TskData.FileKnown to TskData.TagType private final String displayName; private final String description; @@ -85,13 +85,15 @@ final public class TagNameDefinition implements Comparable { * @param description The description for the tag name. * @param color The color for the tag name. * @param status The status denoted by the tag name. + * @deprecated TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.TagType status) should be used instead. */ - /* ELTODO public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) { + @Deprecated + public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) { this.displayName = displayName; this.description = description; this.color = color; - this.tagType = status; - }*/ + this.tagType = TskData.TagType.convertFileKnownToTagType(status); + } public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.TagType status) { this.displayName = displayName; @@ -323,7 +325,7 @@ final public class TagNameDefinition implements Comparable { Integer version = getPropertyFileVersion(); List definitions = new ArrayList<>(); - if (version == null) { + if (version == null || version == 1) { String tagsProperty = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY); if (tagsProperty == null || tagsProperty.isEmpty()) { ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_SETTING_VERSION_KEY, Integer.toString(TAG_SETTINGS_VERSION)); @@ -339,22 +341,27 @@ final public class TagNameDefinition implements Comparable { List notableTagList = null; for (String tagProps : individualTags) { String[] attributes = tagProps.split(","); - TskData.TagType fileKnown = TskData.TagType.SUSPICIOUS; + TskData.TagType tagType = TskData.TagType.SUSPICIOUS; if (attributes.length == 3) { // If notableTagList is null load it from the CR. if (notableTagList == null) { - notableTagList = getCRNotableList(); // ELTODO handle backwards compatibility + notableTagList = getCRNotableList(); } else { if (notableTagList.contains(attributes[0])) { - fileKnown = TskData.TagType.BAD; + tagType = TskData.TagType.BAD; } } } else { - fileKnown = TskData.TagType.valueOf(attributes[3]); + if (version == 1) { + // handle backwards compatibility + tagType = TskData.TagType.convertFileKnownToTagType(TskData.FileKnown.valueOf(attributes[3])); + } else { + tagType = TskData.TagType.valueOf(attributes[3]); + } } definitions.add(new TagNameDefinition(attributes[0], attributes[1], - TagName.HTML_COLOR.valueOf(attributes[2]), fileKnown)); + TagName.HTML_COLOR.valueOf(attributes[2]), tagType)); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index 64a27e03de..c6f8b96275 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -482,10 +482,11 @@ public final class CaseEventListener implements PropertyChangeListener { for (BlackboardArtifactTag bbTag : artifactTags) { //start with assumption that none of the other tags applied to this Correlation Attribute will prevent it's status from being changed boolean hasTagWithConflictingKnownStatus = false; - // if the status of the tag has been changed to TskData.TagType.UNKNOWN + // if the status of the tag has been changed to TskData.TagType.UNKNOWN or TskData.TagType.SUSPICIOUS // we need to check the status of all other tags on this correlation attribute before changing // the status of the correlation attribute in the central repository - if (tagName.getTagType() == TskData.TagType.UNKNOWN) { + if (tagName.getTagType() == TskData.TagType.UNKNOWN + || tagName.getTagType() == TskData.TagType.SUSPICIOUS) { Content content = bbTag.getContent(); // If the content which this Blackboard Artifact Tag is linked to is an AbstractFile with KNOWN status then // it's status in the central reporsitory should not be changed to UNKNOWN @@ -522,10 +523,11 @@ public final class CaseEventListener implements PropertyChangeListener { for (ContentTag contentTag : fileTags) { //start with assumption that none of the other tags applied to this ContentTag will prevent it's status from being changed boolean hasTagWithConflictingKnownStatus = false; - // if the status of the tag has been changed to TskData.TagType.UNKNOWN + // if the status of the tag has been changed to TskData.TagType.UNKNOWN or TskData.TagType.SUSPICIOUS // we need to check the status of all other tags on this file before changing // the status of the file in the central repository - if (tagName.getTagType() == TskData.TagType.UNKNOWN) { + if (tagName.getTagType() == TskData.TagType.UNKNOWN + || tagName.getTagType() == TskData.TagType.SUSPICIOUS) { Content content = contentTag.getContent(); TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); List tags = tagsManager.getContentTagsByContent(content); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryService.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryService.java index 897b50ae2b..ff17afbdf2 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryService.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryService.java @@ -65,11 +65,11 @@ public class ImageGalleryService implements AutopsyService { static { // NOTE: The colors here are what will be shown in the border - PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT0, "", TagName.HTML_COLOR.GREEN, TskData.FileKnown.UNKNOWN)); - PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT1, "", TagName.HTML_COLOR.RED, TskData.FileKnown.BAD)); - PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT2, "", TagName.HTML_COLOR.YELLOW, TskData.FileKnown.BAD)); - PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT3, "", TagName.HTML_COLOR.FUCHSIA, TskData.FileKnown.BAD)); - PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT4, "", TagName.HTML_COLOR.BLUE, TskData.FileKnown.UNKNOWN)); + PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT0, "", TagName.HTML_COLOR.GREEN, TskData.TagType.SUSPICIOUS)); + PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT1, "", TagName.HTML_COLOR.RED, TskData.TagType.BAD)); + PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT2, "", TagName.HTML_COLOR.YELLOW, TskData.TagType.BAD)); + PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT3, "", TagName.HTML_COLOR.FUCHSIA, TskData.TagType.BAD)); + PROJECT_VIC_US_CATEGORIES.add(new TagNameDefinition(PV_US_CAT4, "", TagName.HTML_COLOR.BLUE, TskData.TagType.SUSPICIOUS)); } @Override @@ -149,7 +149,7 @@ public class ImageGalleryService implements AutopsyService { private void addProjetVicTagSet(Case currentCase) throws TskCoreException { List tagNames = new ArrayList<>(); for (TagNameDefinition def : PROJECT_VIC_US_CATEGORIES) { - tagNames.add(currentCase.getSleuthkitCase().getTaggingManager().addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus())); + tagNames.add(currentCase.getSleuthkitCase().getTaggingManager().addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getTagType())); } currentCase.getServices().getTagsManager().addTagSet(PROJECT_VIC_TAG_SET_NAME, tagNames); } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java index e6af400473..c75d6e5272 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java @@ -68,7 +68,7 @@ public class AddTagAction extends Action { this.selectedFileIDs = selectedFileIDs; this.tagName = tagName; setGraphic(controller.getTagsManager().getGraphic(tagName)); - String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; setText(tagName.getDisplayName() + notableString); setEventHandler(actionEvent -> addTagWithComment("")); } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteTagAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteTagAction.java index efe279bba3..c0ec387082 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteTagAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteTagAction.java @@ -66,7 +66,7 @@ public class DeleteTagAction extends Action { this.tagName = tagName; this.contentTag = contentTag; setGraphic(controller.getTagsManager().getGraphic(tagName)); - String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + String notableString = tagName.getTagType() == TskData.TagType.BAD ? TagsManager.getNotableTagLabel() : ""; setText(tagName.getDisplayName() + notableString); setEventHandler(actionEvent -> deleteTag()); } From c84579f49f222d418bd2169e1b53b926ba8f1457 Mon Sep 17 00:00:00 2001 From: "eugene.livis" Date: Wed, 10 Apr 2024 15:44:20 -0400 Subject: [PATCH 3/5] Supporting legacy APIs --- .../casemodule/services/TagNameDefinition.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java index c8f04560e9..4dce91c0ba 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java @@ -178,6 +178,17 @@ final public class TagNameDefinition implements Comparable { public TskData.TagType getTagType() { return tagType; } + + /** + * The status which will be applied to items with this tag. + * + * @return a value of TskData.FileKnown which is associated with this tag + * @deprecated getTagType() should be used instead. + */ + @Deprecated + public TskData.FileKnown getKnownStatus() { + return TskData.TagType.convertTagTypeToFileKnown(tagType); + } /** * Compares this tag name definition with the specified tag name definition From 91fd4caee90534bd99d61b229ad4e91a5cf9b479 Mon Sep 17 00:00:00 2001 From: "eugene.livis" Date: Wed, 10 Apr 2024 16:00:39 -0400 Subject: [PATCH 4/5] Support legacy API --- .../autopsy/casemodule/services/TagsManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index 4f004884c5..fc7a0fc9d8 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -545,6 +545,22 @@ public class TagsManager implements Closeable { public TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException { return addTagName(displayName, description, color, TskData.TagType.SUSPICIOUS); } + + /** + * + * @param displayName + * @param description + * @param color + * @param knownStatus + * @return + * @throws org.sleuthkit.autopsy.casemodule.services.TagsManager.TagNameAlreadyExistsException + * @throws TskCoreException + * @deprecated addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.TagType tagType) should be used instead + */ + @Deprecated + public TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException { + return addTagName(displayName, description, color, TskData.TagType.convertFileKnownToTagType(knownStatus)); + } /** * Adds a tag name entry to the case database and adds a corresponding tag From c913237966fb5b92d54ced9f3785e62f3b625ea4 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Tue, 16 Apr 2024 21:10:04 -0400 Subject: [PATCH 5/5] Update Chromium.java Add base directory to profile. Fix NPE in bookmarks --- .../autopsy/recentactivity/Chromium.java | 104 +++++++++--------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chromium.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chromium.java index 7f1449c609..bc91d9b9a8 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chromium.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chromium.java @@ -320,6 +320,8 @@ class Chromium extends Extract { jProfile = jElement.get("profile").getAsJsonObject(); //NON-NLS jInfoCache = jProfile.get("info_cache").getAsJsonObject(); } else { + userProfiles.put(browserLocation, "Default"); + browserLocations.put(browserLocation, browser); continue; } } catch (JsonIOException | JsonSyntaxException | IllegalStateException ex) { @@ -854,60 +856,62 @@ class Chromium extends Extract { Set bookmarkKeys = jRoot.keySet(); for (String bookmarkKey : bookmarkKeys) { JsonObject jBookmark = jRoot.get(bookmarkKey).getAsJsonObject(); //NON-NLS - JsonArray jBookmarkArray = jBookmark.getAsJsonArray("children"); //NON-NLS - for (JsonElement result : jBookmarkArray) { - JsonObject address = result.getAsJsonObject(); - if (address == null) { - continue; - } - JsonElement urlEl = address.get("url"); //NON-NLS - String url; - if (urlEl != null) { - url = urlEl.getAsString(); - } else { - url = ""; - } - String name; - JsonElement nameEl = address.get("name"); //NON-NLS - if (nameEl != null) { - name = nameEl.getAsString(); - } else { - name = ""; - } - Long date; - JsonElement dateEl = address.get("date_added"); //NON-NLS - if (dateEl != null) { - date = dateEl.getAsLong(); - } else { - date = Long.valueOf(0); - } - String domain = NetworkUtils.extractDomain(url); - Collection bbattributes = new ArrayList<>(); - //TODO Revisit usage of deprecated constructor as per TSK-583 - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL, - RecentActivityExtracterModuleFactory.getModuleName(), url)); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE, - RecentActivityExtracterModuleFactory.getModuleName(), name)); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, - RecentActivityExtracterModuleFactory.getModuleName(), (date / 1000000) - Long.valueOf("11644473600"))); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, - RecentActivityExtracterModuleFactory.getModuleName(), browserName)); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN, - RecentActivityExtracterModuleFactory.getModuleName(), domain)); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME, - RecentActivityExtracterModuleFactory.getModuleName(), userName)); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, - RecentActivityExtracterModuleFactory.getModuleName(), bookmarkKey)); + if (jBookmark.has("children")) { + JsonArray jBookmarkArray = jBookmark.getAsJsonArray("children"); //NON-NLS + for (JsonElement result : jBookmarkArray) { + JsonObject address = result.getAsJsonObject(); + if (address == null) { + continue; + } + JsonElement urlEl = address.get("url"); //NON-NLS + String url; + if (urlEl != null) { + url = urlEl.getAsString(); + } else { + url = ""; + } + String name; + JsonElement nameEl = address.get("name"); //NON-NLS + if (nameEl != null) { + name = nameEl.getAsString(); + } else { + name = ""; + } + Long date; + JsonElement dateEl = address.get("date_added"); //NON-NLS + if (dateEl != null) { + date = dateEl.getAsLong(); + } else { + date = Long.valueOf(0); + } + String domain = NetworkUtils.extractDomain(url); + Collection bbattributes = new ArrayList<>(); + //TODO Revisit usage of deprecated constructor as per TSK-583 + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL, + RecentActivityExtracterModuleFactory.getModuleName(), url)); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE, + RecentActivityExtracterModuleFactory.getModuleName(), name)); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, + RecentActivityExtracterModuleFactory.getModuleName(), (date / 1000000) - Long.valueOf("11644473600"))); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, + RecentActivityExtracterModuleFactory.getModuleName(), browserName)); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN, + RecentActivityExtracterModuleFactory.getModuleName(), domain)); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME, + RecentActivityExtracterModuleFactory.getModuleName(), userName)); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, + RecentActivityExtracterModuleFactory.getModuleName(), bookmarkKey)); - try { - bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_BOOKMARK, bookmarkFile, bbattributes)); - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, String.format("Failed to create bookmark artifact for file (%d)", bookmarkFile.getId()), ex); - } + try { + bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_BOOKMARK, bookmarkFile, bbattributes)); + } catch (TskCoreException ex) { + logger.log(Level.SEVERE, String.format("Failed to create bookmark artifact for file (%d)", bookmarkFile.getId()), ex); + } + } } - } + } if (!context.dataSourceIngestIsCancelled()) { postArtifacts(bbartifacts);