mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Merge pull request #7171 from APriestman/7867_saveCorrAttributes
7867 Add correlation type and value to previously seen/unseen artifacts
This commit is contained in:
commit
f93cef333c
@ -67,6 +67,8 @@ import org.sleuthkit.datamodel.Blackboard;
|
|||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_TYPE;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_VALUE;
|
||||||
import org.sleuthkit.datamodel.OsAccount;
|
import org.sleuthkit.datamodel.OsAccount;
|
||||||
import org.sleuthkit.datamodel.OsAccountInstance;
|
import org.sleuthkit.datamodel.OsAccountInstance;
|
||||||
import org.sleuthkit.datamodel.Score;
|
import org.sleuthkit.datamodel.Score;
|
||||||
@ -713,7 +715,8 @@ public final class CaseEventListener implements PropertyChangeListener {
|
|||||||
|
|
||||||
// Look up and create artifacts for previously seen accounts if requested
|
// Look up and create artifacts for previously seen accounts if requested
|
||||||
if (IngestEventsListener.isFlagSeenDevices()) {
|
if (IngestEventsListener.isFlagSeenDevices()) {
|
||||||
List<CorrelationAttributeInstance> previousOccurences = dbManager.getArtifactInstancesByTypeValue(CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.OSACCOUNT_TYPE_ID), correlationAttributeInstance.getCorrelationValue());
|
CorrelationAttributeInstance.Type osAcctType = CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.OSACCOUNT_TYPE_ID);
|
||||||
|
List<CorrelationAttributeInstance> previousOccurences = dbManager.getArtifactInstancesByTypeValue(osAcctType, correlationAttributeInstance.getCorrelationValue());
|
||||||
for (CorrelationAttributeInstance instance : previousOccurences) {
|
for (CorrelationAttributeInstance instance : previousOccurences) {
|
||||||
if (!instance.getCorrelationCase().getCaseUUID().equals(correlationAttributeInstance.getCorrelationCase().getCaseUUID())) {
|
if (!instance.getCorrelationCase().getCaseUUID().equals(correlationAttributeInstance.getCorrelationCase().getCaseUUID())) {
|
||||||
SleuthkitCase tskCase = osAccount.getSleuthkitCase();
|
SleuthkitCase tskCase = osAccount.getSleuthkitCase();
|
||||||
@ -723,6 +726,12 @@ public final class CaseEventListener implements PropertyChangeListener {
|
|||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_SET_NAME, MODULE_NAME,
|
TSK_SET_NAME, MODULE_NAME,
|
||||||
Bundle.CaseEventsListener_prevExists_text()),
|
Bundle.CaseEventsListener_prevExists_text()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_TYPE, MODULE_NAME,
|
||||||
|
osAcctType.getDisplayName()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_VALUE, MODULE_NAME,
|
||||||
|
correlationAttributeInstance.getCorrelationValue()),
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_COMMENT, MODULE_NAME,
|
TSK_COMMENT, MODULE_NAME,
|
||||||
Bundle.CaseEventsListener_prevCaseComment_text()));
|
Bundle.CaseEventsListener_prevCaseComment_text()));
|
||||||
|
@ -56,6 +56,8 @@ import org.sleuthkit.autopsy.coreutils.ThreadUtils;
|
|||||||
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED;
|
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_TYPE;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_VALUE;
|
||||||
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisEvent;
|
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisEvent;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
@ -208,11 +210,18 @@ public class IngestEventsListener {
|
|||||||
*/
|
*/
|
||||||
@NbBundle.Messages({"IngestEventsListener.prevTaggedSet.text=Previously Tagged As Notable (Central Repository)",
|
@NbBundle.Messages({"IngestEventsListener.prevTaggedSet.text=Previously Tagged As Notable (Central Repository)",
|
||||||
"IngestEventsListener.prevCaseComment.text=Previous Case: "})
|
"IngestEventsListener.prevCaseComment.text=Previous Case: "})
|
||||||
static private void makeAndPostPreviousNotableArtifact(BlackboardArtifact originalArtifact, List<String> caseDisplayNames) {
|
static private void makeAndPostPreviousNotableArtifact(BlackboardArtifact originalArtifact, List<String> caseDisplayNames,
|
||||||
|
CorrelationAttributeInstance.Type aType, String value) {
|
||||||
Collection<BlackboardAttribute> attributesForNewArtifact = Arrays.asList(
|
Collection<BlackboardAttribute> attributesForNewArtifact = Arrays.asList(
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_SET_NAME, MODULE_NAME,
|
TSK_SET_NAME, MODULE_NAME,
|
||||||
Bundle.IngestEventsListener_prevTaggedSet_text()),
|
Bundle.IngestEventsListener_prevTaggedSet_text()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_TYPE, MODULE_NAME,
|
||||||
|
aType.getDisplayName()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_VALUE, MODULE_NAME,
|
||||||
|
value),
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_COMMENT, MODULE_NAME,
|
TSK_COMMENT, MODULE_NAME,
|
||||||
Bundle.IngestEventsListener_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
Bundle.IngestEventsListener_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
||||||
@ -231,10 +240,17 @@ public class IngestEventsListener {
|
|||||||
"# {0} - typeName",
|
"# {0} - typeName",
|
||||||
"# {1} - count",
|
"# {1} - count",
|
||||||
"IngestEventsListener.prevCount.text=Number of previous {0}: {1}"})
|
"IngestEventsListener.prevCount.text=Number of previous {0}: {1}"})
|
||||||
static private void makeAndPostPreviousSeenArtifact(BlackboardArtifact originalArtifact, List<String> caseDisplayNames) {
|
static private void makeAndPostPreviousSeenArtifact(BlackboardArtifact originalArtifact, List<String> caseDisplayNames,
|
||||||
|
CorrelationAttributeInstance.Type aType, String value) {
|
||||||
Collection<BlackboardAttribute> attributesForNewArtifact = Arrays.asList(new BlackboardAttribute(
|
Collection<BlackboardAttribute> attributesForNewArtifact = Arrays.asList(new BlackboardAttribute(
|
||||||
TSK_SET_NAME, MODULE_NAME,
|
TSK_SET_NAME, MODULE_NAME,
|
||||||
Bundle.IngestEventsListener_prevExists_text()),
|
Bundle.IngestEventsListener_prevExists_text()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_TYPE, MODULE_NAME,
|
||||||
|
aType.getDisplayName()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_VALUE, MODULE_NAME,
|
||||||
|
value),
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_COMMENT, MODULE_NAME,
|
TSK_COMMENT, MODULE_NAME,
|
||||||
Bundle.IngestEventsListener_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
Bundle.IngestEventsListener_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
||||||
@ -248,8 +264,14 @@ public class IngestEventsListener {
|
|||||||
* @param originalArtifact the artifact to create the "previously unseen" item
|
* @param originalArtifact the artifact to create the "previously unseen" item
|
||||||
* for
|
* for
|
||||||
*/
|
*/
|
||||||
static private void makeAndPostPreviouslyUnseenArtifact(BlackboardArtifact originalArtifact) {
|
static private void makeAndPostPreviouslyUnseenArtifact(BlackboardArtifact originalArtifact, CorrelationAttributeInstance.Type aType, String value) {
|
||||||
Collection<BlackboardAttribute> attributesForNewArtifact = new ArrayList<>();
|
Collection<BlackboardAttribute> attributesForNewArtifact = Arrays.asList(
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_TYPE, MODULE_NAME,
|
||||||
|
aType.getDisplayName()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_VALUE, MODULE_NAME,
|
||||||
|
value));
|
||||||
makeAndPostArtifact(BlackboardArtifact.Type.TSK_PREVIOUSLY_UNSEEN, originalArtifact, attributesForNewArtifact, "");
|
makeAndPostArtifact(BlackboardArtifact.Type.TSK_PREVIOUSLY_UNSEEN, originalArtifact, attributesForNewArtifact, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +508,7 @@ public class IngestEventsListener {
|
|||||||
caseDisplayNames = dbManager.getListCasesHavingArtifactInstancesKnownBad(eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
caseDisplayNames = dbManager.getListCasesHavingArtifactInstancesKnownBad(eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
||||||
if (!caseDisplayNames.isEmpty()) {
|
if (!caseDisplayNames.isEmpty()) {
|
||||||
makeAndPostPreviousNotableArtifact(bbArtifact,
|
makeAndPostPreviousNotableArtifact(bbArtifact,
|
||||||
caseDisplayNames);
|
caseDisplayNames, eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
||||||
}
|
}
|
||||||
} catch (CorrelationAttributeNormalizationException ex) {
|
} catch (CorrelationAttributeNormalizationException ex) {
|
||||||
LOGGER.log(Level.INFO, String.format("Unable to flag notable item: %s.", eamArtifact.toString()), ex);
|
LOGGER.log(Level.INFO, String.format("Unable to flag notable item: %s.", eamArtifact.toString()), ex);
|
||||||
@ -507,7 +529,7 @@ public class IngestEventsListener {
|
|||||||
for (CorrelationAttributeInstance instance : previousOccurences) {
|
for (CorrelationAttributeInstance instance : previousOccurences) {
|
||||||
if (!instance.getCorrelationCase().getCaseUUID().equals(eamArtifact.getCorrelationCase().getCaseUUID())) {
|
if (!instance.getCorrelationCase().getCaseUUID().equals(eamArtifact.getCorrelationCase().getCaseUUID())) {
|
||||||
caseDisplayNames = dbManager.getListCasesHavingArtifactInstances(eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
caseDisplayNames = dbManager.getListCasesHavingArtifactInstances(eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
||||||
makeAndPostPreviousSeenArtifact(bbArtifact, caseDisplayNames);
|
makeAndPostPreviousSeenArtifact(bbArtifact, caseDisplayNames, eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -530,7 +552,7 @@ public class IngestEventsListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (previousOccurences.isEmpty()) {
|
if (previousOccurences.isEmpty()) {
|
||||||
makeAndPostPreviouslyUnseenArtifact(bbArtifact);
|
makeAndPostPreviouslyUnseenArtifact(bbArtifact, eamArtifact.getCorrelationType(), eamArtifact.getCorrelationValue());
|
||||||
}
|
}
|
||||||
} catch (CorrelationAttributeNormalizationException ex) {
|
} catch (CorrelationAttributeNormalizationException ex) {
|
||||||
LOGGER.log(Level.INFO, String.format("Unable to flag previously unseen application: %s.", eamArtifact.toString()), ex);
|
LOGGER.log(Level.INFO, String.format("Unable to flag previously unseen application: %s.", eamArtifact.toString()), ex);
|
||||||
|
@ -52,6 +52,8 @@ import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_PREVI
|
|||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
|
||||||
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_TYPE;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CORRELATION_VALUE;
|
||||||
import org.sleuthkit.datamodel.HashUtility;
|
import org.sleuthkit.datamodel.HashUtility;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
@ -151,7 +153,7 @@ final class CentralRepoIngestModule implements FileIngestModule {
|
|||||||
List<String> caseDisplayNamesList = dbManager.getListCasesHavingArtifactInstancesKnownBad(filesType, md5);
|
List<String> caseDisplayNamesList = dbManager.getListCasesHavingArtifactInstancesKnownBad(filesType, md5);
|
||||||
HealthMonitor.submitTimingMetric(timingMetric);
|
HealthMonitor.submitTimingMetric(timingMetric);
|
||||||
if (!caseDisplayNamesList.isEmpty()) {
|
if (!caseDisplayNamesList.isEmpty()) {
|
||||||
postCorrelatedBadFileToBlackboard(abstractFile, caseDisplayNamesList);
|
postCorrelatedBadFileToBlackboard(abstractFile, caseDisplayNamesList, filesType, md5);
|
||||||
}
|
}
|
||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
logger.log(Level.SEVERE, "Error searching database for artifact.", ex); // NON-NLS
|
logger.log(Level.SEVERE, "Error searching database for artifact.", ex); // NON-NLS
|
||||||
@ -332,11 +334,17 @@ final class CentralRepoIngestModule implements FileIngestModule {
|
|||||||
* @param abstractFile The file from which to create an artifact.
|
* @param abstractFile The file from which to create an artifact.
|
||||||
* @param caseDisplayNames Case names to be added to a TSK_COMMON attribute.
|
* @param caseDisplayNames Case names to be added to a TSK_COMMON attribute.
|
||||||
*/
|
*/
|
||||||
private void postCorrelatedBadFileToBlackboard(AbstractFile abstractFile, List<String> caseDisplayNames) {
|
private void postCorrelatedBadFileToBlackboard(AbstractFile abstractFile, List<String> caseDisplayNames, CorrelationAttributeInstance.Type aType, String value) {
|
||||||
Collection<BlackboardAttribute> attributes = Arrays.asList(
|
Collection<BlackboardAttribute> attributes = Arrays.asList(
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_SET_NAME, MODULE_NAME,
|
TSK_SET_NAME, MODULE_NAME,
|
||||||
Bundle.CentralRepoIngestModule_prevTaggedSet_text()),
|
Bundle.CentralRepoIngestModule_prevTaggedSet_text()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_TYPE, MODULE_NAME,
|
||||||
|
aType.getDisplayName()),
|
||||||
|
new BlackboardAttribute(
|
||||||
|
TSK_CORRELATION_VALUE, MODULE_NAME,
|
||||||
|
value),
|
||||||
new BlackboardAttribute(
|
new BlackboardAttribute(
|
||||||
TSK_COMMENT, MODULE_NAME,
|
TSK_COMMENT, MODULE_NAME,
|
||||||
Bundle.CentralRepoIngestModule_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
Bundle.CentralRepoIngestModule_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(","))));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user