19 package org.sleuthkit.autopsy.centralrepository.datamodel;
21 import java.util.ArrayList;
22 import java.util.HashSet;
23 import java.util.List;
25 import java.util.logging.Level;
26 import org.openide.util.NbBundle.Messages;
34 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
36 import org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
60 @Messages({
"CorrelationAttributeUtil.emailaddresses.text=Email Addresses"})
62 return Bundle.CorrelationAttributeUtil_emailaddresses_text();
73 add(ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID());
74 add(ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID());
75 add(ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID());
76 add(ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID());
77 add(ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID());
78 add(ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID());
79 add(ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID());
80 add(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID());
81 add(ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID());
82 add(ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID());
83 add(ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID());
84 add(ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS.getTypeID());
85 add(ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID());
102 if(SOURCE_TYPES_FOR_CR_INSERT.contains(artifact.getArtifactTypeID())) {
109 return new ArrayList<>();
137 List<CorrelationAttributeInstance> correlationAttrs =
new ArrayList<>();
140 if (sourceArtifact != null) {
141 int artifactTypeID = sourceArtifact.getArtifactTypeID();
142 if (artifactTypeID == ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
143 BlackboardAttribute setNameAttr = sourceArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME));
147 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()
148 || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()
149 || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()
150 || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
153 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
157 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
160 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()
161 || artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()
162 || artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
165 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
170 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
174 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS.getTypeID()) {
178 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
181 }
else if (artifactTypeID == ARTIFACT_TYPE.TSK_CONTACT.getTypeID()
182 || artifactTypeID == ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
183 || artifactTypeID == ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
188 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", artifact), ex);
189 return correlationAttrs;
190 }
catch (TskCoreException ex) {
191 logger.log(Level.SEVERE, String.format(
"Error getting querying case database (%s)", artifact), ex);
192 return correlationAttrs;
194 logger.log(Level.SEVERE,
"Error getting current case", ex);
195 return correlationAttrs;
197 return correlationAttrs;
219 if (null != artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER))) {
220 value = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)).getValueString();
221 }
else if (null != artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM))) {
222 value = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM)).getValueString();
223 }
else if (null != artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO))) {
224 value = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO)).getValueString();
231 if(CommunicationsUtils.isValidPhoneNumber(value)) {
232 value = CommunicationsUtils.normalizePhoneNum(value);
234 if(corrAttr != null) {
235 corrAttrInstances.add(corrAttr);
255 BlackboardArtifact sourceArtifact = null;
256 if (BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() == artifact.getArtifactTypeID()) {
257 BlackboardAttribute assocArtifactAttr = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
258 if (assocArtifactAttr != null) {
262 sourceArtifact = artifact;
264 return sourceArtifact;
283 BlackboardAttribute accountTypeAttribute = acctArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE));
284 String accountTypeStr = accountTypeAttribute.getValueString();
288 Account.Type predefinedAccountType = Account.Type.PREDEFINED_ACCOUNT_TYPES.stream().filter(type -> type.getTypeName().equalsIgnoreCase(accountTypeStr)).findAny().orElse(null);
291 if (Account.Type.DEVICE.getTypeName().equalsIgnoreCase(accountTypeStr) ==
false && predefinedAccountType != null) {
300 BlackboardAttribute accountIdAttribute = acctArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ID));
301 String accountIdStr = accountIdAttribute.getValueString();
307 if (corrAttr != null) {
309 corrAttr.setAccountId(crAccount.
getId());
310 corrAttrInstances.add(corrAttr);
333 BlackboardAttribute attribute = artifact.getAttribute(
new BlackboardAttribute.Type(artAttrType));
334 if (attribute != null) {
335 String value = attribute.getValueString();
336 if ((null != value) && (value.isEmpty() ==
false)) {
339 corrAttrInstances.add(inst);
365 AbstractFile bbSourceFile = currentCase.
getSleuthkitCase().getAbstractFileById(artifact.getObjectID());
366 if (null == bbSourceFile) {
367 logger.log(Level.SEVERE,
"Error creating artifact instance. Abstract File was null.");
377 bbSourceFile.getParentPath() + bbSourceFile.
getName(),
379 TskData.FileKnown.UNKNOWN,
380 bbSourceFile.getId());
382 }
catch (TskCoreException ex) {
383 logger.log(Level.SEVERE, String.format(
"Error getting querying case database (%s)", artifact), ex);
385 }
catch (CentralRepoException ex) {
386 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", artifact), ex);
389 logger.log(Level.WARNING, String.format(
"Error creating correlation attribute instance (%s)", artifact), ex);
391 }
catch (NoCurrentCaseException ex) {
392 logger.log(Level.SEVERE,
"Error getting current case", ex);
426 if (null == correlationCase) {
431 }
catch (TskCoreException ex) {
432 logger.log(Level.SEVERE, String.format(
"Error getting querying case database (%s)", file), ex);
434 }
catch (CentralRepoException ex) {
435 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", file), ex);
437 }
catch (NoCurrentCaseException ex) {
438 logger.log(Level.SEVERE,
"Error getting current case", ex);
445 }
catch (CentralRepoException ex) {
446 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", file), ex);
449 logger.log(Level.WARNING, String.format(
"Error creating correlation attribute instance (%s)", file), ex);
459 if (correlationAttributeInstance == null && file.getMd5Hash() != null) {
460 String filePath = (file.getParentPath() + file.getName()).toLowerCase();
463 }
catch (CentralRepoException ex) {
464 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", file), ex);
467 logger.log(Level.WARNING, String.format(
"Error creating correlation attribute instance (%s)", file), ex);
472 return correlationAttributeInstance;
500 String md5 = file.getMd5Hash();
501 if (md5 == null || md5.isEmpty() || HashUtility.isNoDataMd5(md5)) {
514 file.getParentPath() + file.
getName(),
516 TskData.FileKnown.UNKNOWN,
519 }
catch (TskCoreException ex) {
520 logger.log(Level.SEVERE, String.format(
"Error querying case database (%s)", file), ex);
522 }
catch (CentralRepoException ex) {
523 logger.log(Level.SEVERE, String.format(
"Error querying central repository (%s)", file), ex);
526 logger.log(Level.WARNING, String.format(
"Error creating correlation attribute instance (%s)", file), ex);
528 }
catch (NoCurrentCaseException ex) {
529 logger.log(Level.SEVERE,
"Error getting current case", ex);
546 switch (file.getType()) {
559 return file.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC);
561 logger.log(Level.WARNING,
"Unexpected file type {0}", file.getType().getName());
static final int EMAIL_TYPE_ID
static final int USBID_TYPE_ID
static String getEmailAddressAttrDisplayName()
static CorrelationAttributeInstance makeCorrAttr(BlackboardArtifact artifact, CorrelationAttributeInstance.Type correlationType, String value)
static final int ICCID_TYPE_ID
CorrelationAttributeUtil()
static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource)
static CorrelationAttributeInstance makeCorrAttrFromFile(AbstractFile file)
CorrelationCase getCase(Case autopsyCase)
static final int IMEI_TYPE_ID
static final Logger logger
static List< CorrelationAttributeInstance > makeCorrAttrsForCorrelation(BlackboardArtifact artifact)
static boolean isSupportedAbstractFileType(AbstractFile file)
static void makeCorrAttrsFromCommunicationArtifacts(List< CorrelationAttributeInstance > corrAttrInstances, BlackboardArtifact artifact)
static final int DOMAIN_TYPE_ID
static final int PHONE_TYPE_ID
static CorrelationAttributeInstance getCorrAttrForFile(AbstractFile file)
SleuthkitCase getSleuthkitCase()
static void makeCorrAttrFromArtifactAttr(List< CorrelationAttributeInstance > corrAttrInstances, BlackboardArtifact artifact, ATTRIBUTE_TYPE artAttrType, int typeId)
CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, CorrelationDataSource correlationDataSource, String value, String filePath)
static final int MAC_TYPE_ID
int getCorrelationTypeId()
static BlackboardArtifact getCorrAttrSourceArtifact(BlackboardArtifact artifact)
static List< CorrelationAttributeInstance > makeCorrAttrsToSave(BlackboardArtifact artifact)
static final int IMSI_TYPE_ID
synchronized static Logger getLogger(String name)
static void makeCorrAttrFromAcctArtifact(List< CorrelationAttributeInstance > corrAttrInstances, BlackboardArtifact acctArtifact)
CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId)
static Case getCurrentCaseThrows()
static final int SSID_TYPE_ID
CentralRepoAccountType getAccountTypeByName(String accountTypeName)
static CentralRepository getInstance()
static final Set< Integer > SOURCE_TYPES_FOR_CR_INSERT
static final int FILES_TYPE_ID
CentralRepoAccount getOrCreateAccount(CentralRepoAccount.CentralRepoAccountType crAccountType, String accountUniqueID)