mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Return a list of correlation artifacts when converting a blackboard artifact to capture more attributes
This commit is contained in:
parent
1e4a790d00
commit
d152d7a008
@ -358,8 +358,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
|
||||
|
||||
/**
|
||||
* Scan a Node for blackboard artifacts / content that we can correlate on
|
||||
* and create the corresponding Central Repository artifacts for
|
||||
* display
|
||||
* and create the corresponding Central Repository artifacts for display
|
||||
*
|
||||
* @param node The node to view
|
||||
*
|
||||
@ -380,10 +379,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
artifactTypes = dbManager.getCorrelationTypes();
|
||||
if (bbArtifact != null) {
|
||||
EamArtifact eamArtifact = EamArtifactUtil.fromBlackboardArtifact(bbArtifact, false, artifactTypes, false);
|
||||
if (eamArtifact != null) {
|
||||
ret.add(eamArtifact);
|
||||
}
|
||||
ret.addAll(EamArtifactUtil.fromBlackboardArtifact(bbArtifact, false, artifactTypes, false));
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error retrieving correlation types", ex); // NON-NLS
|
||||
@ -475,8 +471,8 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
|
||||
*
|
||||
* @param eamArtifact Artifact to use for ArtifactTypeEnum matching
|
||||
*
|
||||
* @return List of Central Repository Artifact Instances, empty
|
||||
* list if none found
|
||||
* @return List of Central Repository Artifact Instances, empty list if none
|
||||
* found
|
||||
*/
|
||||
public Collection<EamArtifactInstance> getReferenceInstancesAsArtifactInstances(EamArtifact eamArtifact) {
|
||||
Collection<EamArtifactInstance> eamArtifactInstances = new ArrayList<>();
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.centralrepository.datamodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
@ -46,31 +47,32 @@ public class EamArtifactUtil {
|
||||
return Bundle.EamArtifactUtil_emailaddresses_text();
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Static factory method to examine a BlackboardArtifact to determine if it
|
||||
* has contents that can be used for Correlation. If so, return a
|
||||
* EamArtifact with a single EamArtifactInstance within. If not, return
|
||||
* null.
|
||||
*
|
||||
* @param bbArtifact BlackboardArtifact to examine @return EamArtifact or
|
||||
* null
|
||||
* @param bbArtifact BlackboardArtifact to examine
|
||||
* @return List of EamArtifacts
|
||||
*/
|
||||
public static EamArtifact fromBlackboardArtifact(BlackboardArtifact bbArtifact,
|
||||
public static List<EamArtifact> fromBlackboardArtifact(BlackboardArtifact bbArtifact,
|
||||
boolean includeInstances,
|
||||
List<EamArtifact.Type> artifactTypes,
|
||||
boolean checkEnabled) {
|
||||
|
||||
EamArtifact eamArtifact = null;
|
||||
List<EamArtifact> eamArtifacts = new ArrayList<>();
|
||||
|
||||
for (EamArtifact.Type aType : artifactTypes) {
|
||||
if ((checkEnabled && aType.isEnabled()) || !checkEnabled) {
|
||||
eamArtifact = getTypeFromBlackboardArtifact(aType, bbArtifact);
|
||||
EamArtifact eamArtifact = getTypeFromBlackboardArtifact(aType, bbArtifact);
|
||||
if (eamArtifact != null) {
|
||||
eamArtifacts.add(eamArtifact);
|
||||
}
|
||||
if (null != eamArtifact) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (null != eamArtifact && includeInstances) {
|
||||
if (!eamArtifacts.isEmpty() && includeInstances) {
|
||||
try {
|
||||
AbstractFile af = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID());
|
||||
if (null == af) {
|
||||
@ -92,14 +94,17 @@ public class EamArtifactUtil {
|
||||
TskData.FileKnown.UNKNOWN,
|
||||
EamArtifactInstance.GlobalStatus.LOCAL
|
||||
);
|
||||
|
||||
for (EamArtifact eamArtifact : eamArtifacts) {
|
||||
eamArtifact.addInstance(eamInstance);
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error creating artifact instance.", ex); // NON-NLS
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return eamArtifact;
|
||||
return eamArtifacts;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.centralrepository.eventlisteners;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
@ -142,8 +143,8 @@ public class CaseEventListener implements PropertyChangeListener {
|
||||
|
||||
if (dbManager.getBadTags().contains(tagName.getDisplayName())) {
|
||||
try {
|
||||
EamArtifact eamArtifact = EamArtifactUtil.fromBlackboardArtifact(bbArtifact, true, dbManager.getCorrelationTypes(), true);
|
||||
if (null != eamArtifact) {
|
||||
List<EamArtifact> convertedArtifacts = EamArtifactUtil.fromBlackboardArtifact(bbArtifact, true, dbManager.getCorrelationTypes(), true);
|
||||
for (EamArtifact eamArtifact : convertedArtifacts) {
|
||||
eamArtifact.getInstances().get(0).setComment(bbTagAdded.getComment());
|
||||
Runnable r = new BadFileTagRunner(eamArtifact);
|
||||
// TODO: send r into a thread pool instead
|
||||
|
@ -44,7 +44,8 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
|
||||
/**
|
||||
* Listen for ingest events and update entries in the Central Repository database accordingly
|
||||
* Listen for ingest events and update entries in the Central Repository
|
||||
* database accordingly
|
||||
*/
|
||||
public class IngestEventsListener {
|
||||
|
||||
@ -92,9 +93,8 @@ public class IngestEventsListener {
|
||||
try {
|
||||
for (BlackboardArtifact bbArtifact : bbArtifacts) {
|
||||
// eamArtifact will be null OR a EamArtifact containing one EamArtifactInstance.
|
||||
EamArtifact eamArtifact = EamArtifactUtil.fromBlackboardArtifact(bbArtifact, true, dbManager.getCorrelationTypes(), true);
|
||||
if (null != eamArtifact) {
|
||||
|
||||
List<EamArtifact> convertedArtifacts = EamArtifactUtil.fromBlackboardArtifact(bbArtifact, true, dbManager.getCorrelationTypes(), true);
|
||||
for (EamArtifact eamArtifact : convertedArtifacts) {
|
||||
try {
|
||||
// Only do something with this artifact if it's unique within the job
|
||||
if (addedCeArtifactTrackerSet.add(eamArtifact.toString())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user