Merge remote-tracking branch 'upstream/develop' into 7673-postartifacts-feeds-pipeline-other-apis

This commit is contained in:
Richard Cordovano 2021-11-01 11:34:12 -04:00
commit 4978eb11e5
2 changed files with 17 additions and 17 deletions

View File

@ -149,7 +149,8 @@ class MessageArtifactWorker extends SwingWorker<MessageArtifactWorker.MesssageAr
static Optional<BlackboardArtifact> getAssociatedArtifact(final BlackboardArtifact artifact) throws TskCoreException { static Optional<BlackboardArtifact> getAssociatedArtifact(final BlackboardArtifact artifact) throws TskCoreException {
BlackboardAttribute attribute = artifact.getAttribute(TSK_ASSOCIATED_TYPE); BlackboardAttribute attribute = artifact.getAttribute(TSK_ASSOCIATED_TYPE);
if (attribute != null) { if (attribute != null) {
return Optional.of(artifact.getSleuthkitCase().getArtifactByArtifactId(attribute.getValueLong())); //in the context of the Message content viewer the associated artifact will always be a data artifact
return Optional.of(artifact.getSleuthkitCase().getBlackboard().getDataArtifactById(attribute.getValueLong()));
} }
return Optional.empty(); return Optional.empty();
} }

View File

@ -45,7 +45,6 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.ImageUtils; import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.autopsy.report.ReportProgressPanel;
import static org.sleuthkit.autopsy.casemodule.services.TagsManager.getNotableTagLabel; import static org.sleuthkit.autopsy.casemodule.services.TagsManager.getNotableTagLabel;
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils; import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
@ -358,7 +357,7 @@ class TableReportGenerator {
// Give the modules the rows for the content tags. // Give the modules the rows for the content tags.
for (ContentTag tag : tags) { for (ContentTag tag : tags) {
try { try {
if(shouldFilterFromReport(tag.getContent())) { if (shouldFilterFromReport(tag.getContent())) {
continue; continue;
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
@ -366,7 +365,7 @@ class TableReportGenerator {
logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS
return; return;
} }
// skip tags that we are not reporting on // skip tags that we are not reporting on
String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : "";
if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) {
@ -451,15 +450,15 @@ class TableReportGenerator {
// Give the modules the rows for the content tags. // Give the modules the rows for the content tags.
for (BlackboardArtifactTag tag : tags) { for (BlackboardArtifactTag tag : tags) {
try { try {
if(shouldFilterFromReport(tag.getContent())) { if (shouldFilterFromReport(tag.getContent())) {
continue; continue;
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags")); errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedGetBBArtifactTags"));
logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS logger.log(Level.SEVERE, "Failed to access content data from the case database.", ex); //NON-NLS
return; return;
} }
String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; String notableString = tag.getName().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : "";
if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) { if (passesTagNamesFilter(tag.getName().getDisplayName() + notableString) == false) {
continue; continue;
@ -813,7 +812,7 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) { if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath();
if(shouldFilterFromReport(f)) { if (shouldFilterFromReport(f)) {
continue; continue;
} }
} }
@ -973,7 +972,7 @@ class TableReportGenerator {
AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId); AbstractFile f = openCase.getSleuthkitCase().getAbstractFileById(objId);
if (f != null) { if (f != null) {
uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath(); uniquePath = openCase.getSleuthkitCase().getAbstractFileById(objId).getUniquePath();
if(shouldFilterFromReport(f)) { if (shouldFilterFromReport(f)) {
continue; continue;
} }
} }
@ -1217,11 +1216,11 @@ class TableReportGenerator {
private List<ArtifactData> getFilteredArtifacts(BlackboardArtifact.Type type, HashSet<String> tagNamesFilter) { private List<ArtifactData> getFilteredArtifacts(BlackboardArtifact.Type type, HashSet<String> tagNamesFilter) {
List<ArtifactData> artifacts = new ArrayList<>(); List<ArtifactData> artifacts = new ArrayList<>();
try { try {
for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifacts(type.getTypeID())) { for (BlackboardArtifact artifact : Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboard().getArtifacts(Collections.singletonList(type), settings.getSelectedDataSources())) {
if(shouldFilterFromReport(artifact)) { if (shouldFilterFromReport(artifact)) {
continue; continue;
} }
List<BlackboardArtifactTag> tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact); List<BlackboardArtifactTag> tags = Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact);
HashSet<String> uniqueTagNames = new HashSet<>(); HashSet<String> uniqueTagNames = new HashSet<>();
for (BlackboardArtifactTag tag : tags) { for (BlackboardArtifactTag tag : tags) {
@ -1339,7 +1338,7 @@ class TableReportGenerator {
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH))); new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH)));
columns.add(new AttributeColumn(NbBundle.getMessage(this.getClass(), "ReportGenerator.artTableColHdr.dateTime"), columns.add(new AttributeColumn(NbBundle.getMessage(this.getClass(), "ReportGenerator.artTableColHdr.dateTime"),
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED ))); new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED)));
attributeTypeSet.remove(new Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID)); attributeTypeSet.remove(new Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
} else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID() == artifactTypeId) { } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID() == artifactTypeId) {
@ -1817,19 +1816,19 @@ class TableReportGenerator {
return ""; return "";
} }
/** /**
* Indicates if the content should be filtered from the report. * Indicates if the content should be filtered from the report.
*/ */
private boolean shouldFilterFromReport(Content content) throws TskCoreException { private boolean shouldFilterFromReport(Content content) throws TskCoreException {
if(this.settings.getSelectedDataSources() == null) { if (this.settings.getSelectedDataSources() == null) {
return false; return false;
} }
if (content.getDataSource() == null) { if (content.getDataSource() == null) {
return false; return false;
} }
long dataSourceId = content.getDataSource().getId(); long dataSourceId = content.getDataSource().getId();
return !this.settings.getSelectedDataSources().contains(dataSourceId); return !this.settings.getSelectedDataSources().contains(dataSourceId);
} }