This commit is contained in:
eugene.livis 2024-04-10 15:36:08 -04:00
parent a2378ff326
commit 2c4b795a46
5 changed files with 32 additions and 23 deletions

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2024 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -54,7 +54,7 @@ final public class TagNameDefinition implements Comparable<TagNameDefinition> {
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<TagNameDefinition> {
* @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<TagNameDefinition> {
Integer version = getPropertyFileVersion();
List<TagNameDefinition> 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<TagNameDefinition> {
List<String> 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));
}
}

View File

@ -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<ContentTag> tags = tagsManager.getContentTagsByContent(content);

View File

@ -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<TagName> 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);
}

View File

@ -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(""));
}

View File

@ -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());
}