mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
do not create bb attributes with empty comments if comment not set
This commit is contained in:
parent
f442847c84
commit
bd6d89c786
@ -168,7 +168,8 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
|
|||||||
} else {
|
} else {
|
||||||
switch (attribute.getValueType()) {
|
switch (attribute.getValueType()) {
|
||||||
case STRING:
|
case STRING:
|
||||||
map.put(attribute.getAttributeTypeDisplayName(), attribute.getValueString());
|
String valString = attribute.getValueString();
|
||||||
|
map.put(attribute.getAttributeTypeDisplayName(), valString == null ? "":valString);
|
||||||
break;
|
break;
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
map.put(attribute.getAttributeTypeDisplayName(), attribute.getValueInt());
|
map.put(attribute.getAttributeTypeDisplayName(), attribute.getValueInt());
|
||||||
|
@ -63,6 +63,8 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
public static final String NAME = "Tags";
|
public static final String NAME = "Tags";
|
||||||
private static final String TAG_ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
|
private static final String TAG_ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
|
||||||
private Map<BlackboardArtifact.ARTIFACT_TYPE, Map<String, List<BlackboardArtifact>>> tags;
|
private Map<BlackboardArtifact.ARTIFACT_TYPE, Map<String, List<BlackboardArtifact>>> tags;
|
||||||
|
|
||||||
|
private static final String EMPTY_COMMENT = "No Comment";
|
||||||
|
|
||||||
Tags(SleuthkitCase skCase) {
|
Tags(SleuthkitCase skCase) {
|
||||||
this.skCase = skCase;
|
this.skCase = skCase;
|
||||||
@ -383,7 +385,7 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
*
|
*
|
||||||
* @param file to create tag for
|
* @param file to create tag for
|
||||||
* @param tagName TSK_TAG_NAME
|
* @param tagName TSK_TAG_NAME
|
||||||
* @param comment the tag comment
|
* @param comment the tag comment, or null if not present
|
||||||
*/
|
*/
|
||||||
public static void createTag(AbstractFile file, String tagName, String comment) {
|
public static void createTag(AbstractFile file, String tagName, String comment) {
|
||||||
try {
|
try {
|
||||||
@ -393,10 +395,13 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
|
|
||||||
BlackboardAttribute attr1 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAG_NAME.getTypeID(),
|
BlackboardAttribute attr1 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAG_NAME.getTypeID(),
|
||||||
"", tagName);
|
"", tagName);
|
||||||
BlackboardAttribute attr2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT.getTypeID(),
|
|
||||||
"", comment);
|
|
||||||
attrs.add(attr1);
|
attrs.add(attr1);
|
||||||
attrs.add(attr2);
|
|
||||||
|
if (comment != null && ! comment.isEmpty()) {
|
||||||
|
BlackboardAttribute attr2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT.getTypeID(),
|
||||||
|
"", comment);
|
||||||
|
attrs.add(attr2);
|
||||||
|
}
|
||||||
bookArt.addAttributes(attrs);
|
bookArt.addAttributes(attrs);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Failed to create tag for " + file.getName());
|
logger.log(Level.SEVERE, "Failed to create tag for " + file.getName());
|
||||||
@ -408,7 +413,7 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
*
|
*
|
||||||
* @param artifact to create tag for
|
* @param artifact to create tag for
|
||||||
* @param tagName TSK_TAG_NAME
|
* @param tagName TSK_TAG_NAME
|
||||||
* @param comment the tag comment
|
* @param comment the tag comment or null if not present
|
||||||
*/
|
*/
|
||||||
public static void createTag(BlackboardArtifact artifact, String tagName, String comment) {
|
public static void createTag(BlackboardArtifact artifact, String tagName, String comment) {
|
||||||
try {
|
try {
|
||||||
@ -422,12 +427,17 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
|
|
||||||
BlackboardAttribute attr1 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAG_NAME.getTypeID(),
|
BlackboardAttribute attr1 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAG_NAME.getTypeID(),
|
||||||
"", tagName);
|
"", tagName);
|
||||||
BlackboardAttribute attr2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT.getTypeID(),
|
|
||||||
|
if (comment != null && ! comment.isEmpty()) {
|
||||||
|
BlackboardAttribute attr2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT.getTypeID(),
|
||||||
"", comment);
|
"", comment);
|
||||||
|
attrs.add(attr2);
|
||||||
|
}
|
||||||
|
|
||||||
BlackboardAttribute attr3 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAGGED_ARTIFACT.getTypeID(),
|
BlackboardAttribute attr3 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TAGGED_ARTIFACT.getTypeID(),
|
||||||
"", artifact.getArtifactID());
|
"", artifact.getArtifactID());
|
||||||
attrs.add(attr1);
|
attrs.add(attr1);
|
||||||
attrs.add(attr2);
|
|
||||||
attrs.add(attr3);
|
attrs.add(attr3);
|
||||||
bookArt.addAttributes(attrs);
|
bookArt.addAttributes(attrs);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
@ -550,7 +560,7 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
logger.log(Level.SEVERE, "Failed to get artifact " + tagArtifactId + " from case.");
|
logger.log(Level.SEVERE, "Failed to get artifact " + tagArtifactId + " from case.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return EMPTY_COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||||
<SyntheticProperties>
|
<SyntheticProperties>
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
|
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||||
</SyntheticProperties>
|
</SyntheticProperties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="closeDialog"/>
|
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="closeDialog"/>
|
||||||
|
@ -236,11 +236,7 @@ public class TagDialog extends javax.swing.JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getComment() {
|
String getComment() {
|
||||||
String comment = commentText.getText();
|
return commentText.getText();
|
||||||
if (comment == null || comment.isEmpty()) {
|
|
||||||
return "No Comment";
|
|
||||||
}
|
|
||||||
return comment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TagDialogResult getResult() {
|
TagDialogResult getResult() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user