mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #6055 from kellykelly3/1489-cleanup-cvt-messagenode
6527: Cleaned up MessageNode createSheet to remove dup values
This commit is contained in:
commit
acf6bc634d
@ -17,7 +17,7 @@ ContactsViewer_columnHeader_Phone=Phone
|
|||||||
ContactsViewer_noContacts_message=<No contacts found for selected account>
|
ContactsViewer_noContacts_message=<No contacts found for selected account>
|
||||||
ContactsViewer_tabTitle=Contacts
|
ContactsViewer_tabTitle=Contacts
|
||||||
MediaViewer_Name=Media Attachments
|
MediaViewer_Name=Media Attachments
|
||||||
MessageNode_Node_Property_Attms=Attachments
|
MessageNode_Node_Property_Attms=Attachment Count
|
||||||
MessageNode_Node_Property_Date=Date
|
MessageNode_Node_Property_Date=Date
|
||||||
MessageNode_Node_Property_From=From
|
MessageNode_Node_Property_From=From
|
||||||
MessageNode_Node_Property_Subject=Subject
|
MessageNode_Node_Property_Subject=Subject
|
||||||
|
@ -48,22 +48,22 @@ import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments;
|
|||||||
class MessageNode extends BlackboardArtifactNode {
|
class MessageNode extends BlackboardArtifactNode {
|
||||||
|
|
||||||
public static final String UNTHREADED_ID = "<UNTHREADED>";
|
public static final String UNTHREADED_ID = "<UNTHREADED>";
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(MessageNode.class.getName());
|
private static final Logger logger = Logger.getLogger(MessageNode.class.getName());
|
||||||
|
|
||||||
private final String threadID;
|
private final String threadID;
|
||||||
|
|
||||||
private final Action preferredAction;
|
private final Action preferredAction;
|
||||||
|
|
||||||
MessageNode(BlackboardArtifact artifact, String threadID, Action preferredAction) {
|
MessageNode(BlackboardArtifact artifact, String threadID, Action preferredAction) {
|
||||||
super(artifact);
|
super(artifact);
|
||||||
|
|
||||||
this.preferredAction = preferredAction;
|
this.preferredAction = preferredAction;
|
||||||
|
|
||||||
final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); // NON-NLS
|
final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); // NON-NLS
|
||||||
String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); // NON-NLS
|
String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); // NON-NLS
|
||||||
setDisplayName(removeEndIgnoreCase.isEmpty() ? stripEnd : removeEndIgnoreCase);
|
setDisplayName(removeEndIgnoreCase.isEmpty() ? stripEnd : removeEndIgnoreCase);
|
||||||
|
|
||||||
this.threadID = threadID;
|
this.threadID = threadID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +73,12 @@ class MessageNode extends BlackboardArtifactNode {
|
|||||||
"MessageNode_Node_Property_To=To",
|
"MessageNode_Node_Property_To=To",
|
||||||
"MessageNode_Node_Property_Date=Date",
|
"MessageNode_Node_Property_Date=Date",
|
||||||
"MessageNode_Node_Property_Subject=Subject",
|
"MessageNode_Node_Property_Subject=Subject",
|
||||||
"MessageNode_Node_Property_Attms=Attachments"
|
"MessageNode_Node_Property_Attms=Attachment Count"
|
||||||
})
|
})
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sheet createSheet() {
|
protected Sheet createSheet() {
|
||||||
Sheet sheet = super.createSheet();
|
Sheet sheet = Sheet.createDefault();
|
||||||
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
|
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
|
||||||
if (sheetSet == null) {
|
if (sheetSet == null) {
|
||||||
sheetSet = Sheet.createPropertiesSet();
|
sheetSet = Sheet.createPropertiesSet();
|
||||||
@ -89,42 +89,45 @@ class MessageNode extends BlackboardArtifactNode {
|
|||||||
|
|
||||||
final BlackboardArtifact artifact = getArtifact();
|
final BlackboardArtifact artifact = getArtifact();
|
||||||
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
||||||
|
|
||||||
if(fromID == null ||
|
if (fromID == null
|
||||||
(fromID != TSK_EMAIL_MSG &&
|
|| (fromID != TSK_EMAIL_MSG
|
||||||
fromID != TSK_MESSAGE)) {
|
&& fromID != TSK_MESSAGE)) {
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
if (threadID != null) {
|
||||||
sheetSet.put(new NodeProperty<>("ThreadID", "ThreadID","",threadID == null ? UNTHREADED_ID : threadID)); //NON-NLS
|
sheetSet.put(new NodeProperty<>("ThreadID", "ThreadID", "", threadID)); //NON-NLS
|
||||||
|
}
|
||||||
sheetSet.put(new NodeProperty<>("Subject", Bundle.MessageNode_Node_Property_Subject(), "",
|
sheetSet.put(new NodeProperty<>("Subject", Bundle.MessageNode_Node_Property_Subject(), "",
|
||||||
getAttributeDisplayString(artifact, TSK_SUBJECT))); //NON-NLS
|
getAttributeDisplayString(artifact, TSK_SUBJECT))); //NON-NLS
|
||||||
try {
|
try {
|
||||||
sheetSet.put(new NodeProperty<>("Attms", Bundle.MessageNode_Node_Property_Attms(), "", getAttachmentsCount())); //NON-NLS
|
sheetSet.put(new NodeProperty<>("Attms", Bundle.MessageNode_Node_Property_Attms(), "", getAttachmentsCount())); //NON-NLS
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.WARNING, "Error loading attachment count for " + artifact, ex); //NON-NLS
|
logger.log(Level.WARNING, "Error loading attachment count for " + artifact, ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fromID) {
|
String msg_from = getAttributeDisplayString(artifact, TSK_EMAIL_FROM);
|
||||||
case TSK_EMAIL_MSG:
|
String msg_to = getAttributeDisplayString(artifact, TSK_EMAIL_TO);
|
||||||
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
String date = getAttributeDisplayString(artifact, TSK_DATETIME_SENT);
|
||||||
StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_FROM), " \t\n;"))); //NON-NLS
|
|
||||||
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
if (msg_from.isEmpty()) {
|
||||||
StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_TO), " \t\n;"))); //NON-NLS
|
msg_from = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM);
|
||||||
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
|
||||||
getAttributeDisplayString(artifact, TSK_DATETIME_SENT))); //NON-NLS
|
|
||||||
break;
|
|
||||||
case TSK_MESSAGE:
|
|
||||||
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
|
||||||
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM))); //NON-NLS
|
|
||||||
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
|
||||||
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO))); //NON-NLS
|
|
||||||
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
|
||||||
getAttributeDisplayString(artifact, TSK_DATETIME))); //NON-NLS
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (msg_to.isEmpty()) {
|
||||||
|
msg_to = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
|
||||||
|
}
|
||||||
|
if (date.isEmpty()) {
|
||||||
|
date = getAttributeDisplayString(artifact, TSK_DATETIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
||||||
|
msg_from)); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
||||||
|
msg_to)); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
||||||
|
date)); //NON-NLS
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,16 +141,16 @@ class MessageNode extends BlackboardArtifactNode {
|
|||||||
public String getSourceName() {
|
public String getSourceName() {
|
||||||
return getDisplayName();
|
return getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
String getThreadID() {
|
String getThreadID() {
|
||||||
return threadID;
|
return threadID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action getPreferredAction() {
|
public Action getPreferredAction() {
|
||||||
return preferredAction;
|
return preferredAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getAttachmentsCount() throws TskCoreException {
|
private int getAttachmentsCount() throws TskCoreException {
|
||||||
final BlackboardArtifact artifact = getArtifact();
|
final BlackboardArtifact artifact = getArtifact();
|
||||||
int attachmentsCount;
|
int attachmentsCount;
|
||||||
@ -158,8 +161,7 @@ class MessageNode extends BlackboardArtifactNode {
|
|||||||
try {
|
try {
|
||||||
MessageAttachments msgAttachments = BlackboardJsonAttrUtil.fromAttribute(attachmentsAttr, MessageAttachments.class);
|
MessageAttachments msgAttachments = BlackboardJsonAttrUtil.fromAttribute(attachmentsAttr, MessageAttachments.class);
|
||||||
return msgAttachments.getAttachmentsCount();
|
return msgAttachments.getAttachmentsCount();
|
||||||
}
|
} catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
|
||||||
catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
|
|
||||||
logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex);
|
logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user