19 package org.sleuthkit.autopsy.centralrepository.datamodel;
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.logging.Level;
24 import org.openide.util.NbBundle.Messages;
46 @Messages({
"EamArtifactUtil.emailaddresses.text=Email Addresses"})
48 return Bundle.EamArtifactUtil_emailaddresses_text();
64 boolean checkEnabled) {
66 List<CorrelationAttributeInstance> eamArtifacts =
new ArrayList<>();
75 if ((checkEnabled && aType.isEnabled()) || !checkEnabled) {
78 if (correlationAttribute != null) {
79 eamArtifacts.add(correlationAttribute);
84 logger.log(Level.SEVERE,
"Error getting defined correlation types.", ex);
104 int artifactTypeID = bbArtifact.getArtifactTypeID();
107 if (BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() == artifactTypeID) {
109 BlackboardAttribute attribute = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
110 if (attribute != null) {
116 && BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID() == artifactTypeID) {
118 BlackboardAttribute setNameAttr = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME));
119 if (setNameAttr != null
121 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD)).getValueString();
124 && (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID() == artifactTypeID
125 || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID() == artifactTypeID
126 || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifactTypeID
127 || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID() == artifactTypeID)) {
130 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN)).getValueString();
132 && (BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID() == artifactTypeID
133 || BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID() == artifactTypeID
134 || BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID() == artifactTypeID)) {
136 if (null != bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER))) {
137 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)).getValueString();
138 }
else if (null != bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM))) {
139 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM)).getValueString();
140 }
else if (null != bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO))) {
141 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO)).getValueString();
146 String newValue = value.replaceAll(
"\\D",
"");
147 if (value.startsWith(
"+")) {
148 newValue =
"+" + newValue;
155 if (value.length() <= 5) {
161 && BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID() == artifactTypeID) {
163 value = bbArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_ID)).getValueString();
166 }
catch (TskCoreException ex) {
167 logger.log(Level.SEVERE,
"Error getting attribute while getting type from BlackboardArtifact.", ex);
170 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
193 AbstractFile bbSourceFile = currentCase.
getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID());
194 if (null == bbSourceFile) {
195 logger.log(Level.SEVERE,
"Error creating artifact instance. Abstract File was null.");
201 if (null == correlationCase) {
209 bbSourceFile.getParentPath() + bbSourceFile.
getName(),
211 TskData.FileKnown.UNKNOWN
215 logger.log(Level.SEVERE,
"Error creating artifact instance.", ex);
218 logger.log(Level.SEVERE,
"Case is closed.", ex);
232 if (!(content instanceof AbstractFile)) {
236 final AbstractFile file = (AbstractFile) content;
251 if (null == correlationCase) {
256 value = file.getMd5Hash();
257 filePath = (file.getParentPath() + file.getName()).toLowerCase();
259 logger.log(Level.SEVERE,
"Error retrieving correlation attribute.", ex);
262 logger.log(Level.SEVERE,
"Case is closed.", ex);
270 logger.log(Level.WARNING, String.format(
271 "Correlation attribute could not be retrieved for '%s' (id=%d): %s",
272 content.getName(), content.getId(), ex.getMessage()));
276 return correlationAttributeInstance;
294 if (!(content instanceof AbstractFile)) {
298 final AbstractFile af = (AbstractFile) content;
305 String md5 = af.getMd5Hash();
306 if (md5 == null || md5.isEmpty() || HashUtility.isNoDataMd5(md5)) {
314 if (null == correlationCase) {
322 af.getParentPath() + af.
getName());
325 logger.log(Level.SEVERE,
"Error making correlation attribute.", ex);
328 logger.log(Level.SEVERE,
"Case is closed.", ex);
347 switch (file.getType()) {
359 return file.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC);
361 logger.log(Level.WARNING,
"Unexpected file type {0}", file.getType().getName());
static final int EMAIL_TYPE_ID
static CorrelationAttributeInstance makeInstanceFromBlackboardArtifact(CorrelationAttributeInstance.Type correlationType, BlackboardArtifact bbArtifact)
static final int USBID_TYPE_ID
static final Logger logger
CorrelationCase newCase(CorrelationCase eamCase)
static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource)
static String getEmailAddressAttrString()
static boolean isSupportedAbstractFileType(AbstractFile file)
List< CorrelationAttributeInstance.Type > getDefinedCorrelationTypes()
static List< CorrelationAttributeInstance > makeInstancesFromBlackboardArtifact(BlackboardArtifact bbArtifact, boolean checkEnabled)
static EamDb getInstance()
CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, CorrelationDataSource correlationDataSource, String value, String filePath)
static CorrelationAttributeInstance getInstanceFromContent(Content content)
CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId)
static final int DOMAIN_TYPE_ID
static final int PHONE_TYPE_ID
SleuthkitCase getSleuthkitCase()
static CorrelationAttributeInstance makeInstanceFromContent(Content content)
CorrelationCase getCase(Case autopsyCase)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static CorrelationAttributeInstance makeCorrelationAttributeInstanceUsingTypeValue(BlackboardArtifact bbArtifact, CorrelationAttributeInstance.Type correlationType, String value)
static final int FILES_TYPE_ID