5709: Email attachments.

- address review comments.
This commit is contained in:
Raman Arora 2019-12-11 19:21:50 -05:00
parent 858d50765c
commit a96e7d6859
5 changed files with 17 additions and 14 deletions

View File

@ -227,6 +227,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
// maps the artifact type to its child node // maps the artifact type to its child node
private final HashMap<BlackboardArtifact.Type, TypeNode> typeNodeList = new HashMap<>(); private final HashMap<BlackboardArtifact.Type, TypeNode> typeNodeList = new HashMap<>();
@SuppressWarnings("deprecation")
TypeFactory() { TypeFactory() {
super(); super();

View File

@ -259,11 +259,13 @@ public class DataResultFilterNode extends FilterNode {
protected Node[] createNodes(Node key) { protected Node[] createNodes(Node key) {
// if displaying the results from the Data Source tree // if displaying the results from the Data Source tree
// filter out artifacts // filter out artifacts
// unless there are message artifacts with attachments as children
// In older versions of Autopsy, attachments were children of email/message artifacts
// and hence email/messages with attachments are shown in the tree data source tree,
BlackboardArtifact art = key.getLookup().lookup(BlackboardArtifact.class); BlackboardArtifact art = key.getLookup().lookup(BlackboardArtifact.class);
if (art != null && filterArtifacts if (art != null && filterArtifacts
&& ((DirectoryTreeUtils.showMessagesInDirTree() == false) && ((FilterNodeUtils.showMessagesInDatasourceTree() == false)
|| (DirectoryTreeUtils.showMessagesInDirTree() || (FilterNodeUtils.showMessagesInDatasourceTree()
&& art.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() && art.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()
&& art.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()))) { && art.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()))) {
return new Node[]{}; return new Node[]{};

View File

@ -132,7 +132,7 @@ class DirectoryTreeFilterNode extends FilterNode {
} }
} else if (child instanceof BlackboardArtifact) { } else if (child instanceof BlackboardArtifact) {
if (DirectoryTreeUtils.showMessagesInDirTree()) { if (FilterNodeUtils.showMessagesInDatasourceTree()) {
// In older versions of Autopsy, attachments were children of email/message artifacts // In older versions of Autopsy, attachments were children of email/message artifacts
// and hence email/messages with attachments are shown in the directory tree. // and hence email/messages with attachments are shown in the directory tree.
BlackboardArtifact bba = (BlackboardArtifact) child; BlackboardArtifact bba = (BlackboardArtifact) child;

View File

@ -26,7 +26,7 @@ import org.sleuthkit.datamodel.CaseDbSchemaVersionNumber;
* Utility class for Directory tree. * Utility class for Directory tree.
* *
*/ */
final class DirectoryTreeUtils { final class FilterNodeUtils {
private static final int ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER = 8; private static final int ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER = 8;
private static final int ATTACHMENT_CHILDOF_MSG_MAX_DB_MINOR_VER = 4; private static final int ATTACHMENT_CHILDOF_MSG_MAX_DB_MINOR_VER = 4;
@ -34,7 +34,7 @@ final class DirectoryTreeUtils {
/** /**
* Empty private constructor * Empty private constructor
*/ */
private DirectoryTreeUtils() { private FilterNodeUtils() {
} }
@ -43,8 +43,8 @@ final class DirectoryTreeUtils {
* hence messages with any attachment children are shown in the directory * hence messages with any attachment children are shown in the directory
* tree. * tree.
* *
* At 8.4, attachments are tracked as an attribute, and the message artifact * At 8.4 and later, attachments are tracked as an attribute, and the message
* don't need to be shown in the directory tree. * artifacts don't need to be shown in the directory tree.
* *
* This method may be used to check the schema version and behave * This method may be used to check the schema version and behave
* accordingly, in order to maintain backward compatibility. * accordingly, in order to maintain backward compatibility.
@ -52,15 +52,15 @@ final class DirectoryTreeUtils {
* @return True if messages with attachment children should be shown in * @return True if messages with attachment children should be shown in
* directory tree. * directory tree.
*/ */
static boolean showMessagesInDirTree() { static boolean showMessagesInDatasourceTree() {
boolean showMessagesInDirTree = true; boolean showMessagesInDatasourceTree = true;
if (Case.isCaseOpen()) { if (Case.isCaseOpen()) {
CaseDbSchemaVersionNumber version = Case.getCurrentCase().getSleuthkitCase().getDBSchemaCreationVersion(); CaseDbSchemaVersionNumber version = Case.getCurrentCase().getSleuthkitCase().getDBSchemaCreationVersion();
showMessagesInDirTree showMessagesInDatasourceTree
= ((version.getMajor() < ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER) = ((version.getMajor() < ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER)
|| (version.getMajor() == ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER && version.getMinor() < ATTACHMENT_CHILDOF_MSG_MAX_DB_MINOR_VER)); || (version.getMajor() == ATTACHMENT_CHILDOF_MSG_MAX_DB_MAJOR_VER && version.getMinor() < ATTACHMENT_CHILDOF_MSG_MAX_DB_MINOR_VER));
} }
return showMessagesInDirTree; return showMessagesInDatasourceTree;
} }
} }

View File

@ -138,7 +138,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
communicationArtifactsHelper = new CommunicationArtifactsHelper(currentCase.getSleuthkitCase(), communicationArtifactsHelper = new CommunicationArtifactsHelper(currentCase.getSleuthkitCase(),
EmailParserModuleFactory.getModuleName(), abstractFile, Account.Type.EMAIL); EmailParserModuleFactory.getModuleName(), abstractFile, Account.Type.EMAIL);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Failed to create CommunicationArtifactsHelper for file %s", abstractFile.getName()), ex); logger.log(Level.SEVERE, String.format("Failed to create CommunicationArtifactsHelper for file with object id = %d", abstractFile.getId()), ex);
return ProcessResult.ERROR; return ProcessResult.ERROR;
} }