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;
 
   30 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
 
   32 import org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
 
   48     @Messages({
"EamArtifactUtil.emailaddresses.text=Email Addresses"})
 
   50         return Bundle.EamArtifactUtil_emailaddresses_text();
 
   66             boolean checkEnabled) {
 
   67         List<CorrelationAttributeInstance> eamArtifacts = 
new ArrayList<>();
 
   69             BlackboardArtifact artifactForInstance = null;
 
   70             if (BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() == artifact.getArtifactTypeID()) {
 
   72                 BlackboardAttribute attribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
 
   73                 if (attribute != null) {
 
   77                 artifactForInstance = artifact;
 
   79             if (artifactForInstance != null) {
 
   80                 int artifactTypeID = artifactForInstance.getArtifactTypeID();
 
   81                 if (artifactTypeID == ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
 
   82                     BlackboardAttribute setNameAttr = artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME));
 
   83                     if (setNameAttr != null
 
   87                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()
 
   88                         || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()
 
   89                         || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()
 
   90                         || artifactTypeID == ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
 
   92                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_CONTACT.getTypeID()
 
   93                         || artifactTypeID == ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
 
   94                         || artifactTypeID == ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
 
   97                     if (null != artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER))) {
 
   98                         value = artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)).getValueString();
 
   99                     } 
else if (null != artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM))) {
 
  100                         value = artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM)).getValueString();
 
  101                     } 
else if (null != artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO))) {
 
  102                         value = artifactForInstance.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO)).getValueString();
 
  106                         String newValue = value.replaceAll(
"\\D", 
"");
 
  107                         if (value.startsWith(
"+")) {
 
  108                             newValue = 
"+" + newValue;
 
  113                         if (value.length() > 5) {
 
  116                                 eamArtifacts.add(inst);
 
  120                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {    
 
  123                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {    
 
  125                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()
 
  126                         || artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()
 
  127                         || artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
 
  129                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {  
 
  133                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {  
 
  136                 } 
else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS.getTypeID()) {
 
  142             logger.log(Level.SEVERE, 
"Error getting defined correlation types.", ex); 
 
  144         } 
catch (TskCoreException ex) {
 
  145             logger.log(Level.SEVERE, 
"Error getting attribute while getting type from BlackboardArtifact.", ex); 
 
  148             logger.log(Level.SEVERE, 
"Exception while getting open case.", ex); 
 
  173         BlackboardAttribute attribute = artifact.getAttribute(
new BlackboardAttribute.Type(bbAttributeType));
 
  174         if (attribute != null) {
 
  175             String value = attribute.getValueString();
 
  176             if ((null != value) && (value.isEmpty() == 
false)) {
 
  179                     eamArtifacts.add(inst);
 
  198             AbstractFile bbSourceFile = currentCase.
getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID());
 
  199             if (null == bbSourceFile) {
 
  200                 logger.log(Level.SEVERE, 
"Error creating artifact instance. Abstract File was null."); 
 
  211                     bbSourceFile.getParentPath() + bbSourceFile.
getName(),
 
  213                     TskData.FileKnown.UNKNOWN,
 
  214                     bbSourceFile.getId());
 
  217             logger.log(Level.SEVERE, 
"Error creating artifact instance.", ex); 
 
  220             logger.log(Level.SEVERE, 
"Case is closed.", ex); 
 
  234         if (!(content instanceof AbstractFile)) {
 
  238         final AbstractFile file = (AbstractFile) content;
 
  251             if (null == correlationCase) {
 
  256         } 
catch (TskCoreException | EamDbException ex) {
 
  257             logger.log(Level.SEVERE, 
"Error retrieving correlation attribute.", ex);
 
  260             logger.log(Level.SEVERE, 
"Case is closed.", ex);
 
  268             logger.log(Level.WARNING, String.format(
 
  269                     "Correlation attribute could not be retrieved for '%s' (id=%d): %s",
 
  270                     content.getName(), content.getId(), ex.getMessage()));
 
  274         if (correlationAttributeInstance == null) {
 
  275             String value = file.getMd5Hash();
 
  276             String filePath = (file.getParentPath() + file.getName()).toLowerCase();
 
  280                 logger.log(Level.WARNING, String.format(
 
  281                         "Correlation attribute could not be retrieved for '%s' (id=%d): %s",
 
  282                         content.getName(), content.getId(), ex.getMessage()));
 
  287         return correlationAttributeInstance;
 
  305         if (!(content instanceof AbstractFile)) {
 
  309         final AbstractFile af = (AbstractFile) content;
 
  316         String md5 = af.getMd5Hash();
 
  317         if (md5 == null || md5.isEmpty() || HashUtility.isNoDataMd5(md5)) {
 
  330                     af.getParentPath() + af.
getName(),
 
  332                     TskData.FileKnown.UNKNOWN,
 
  336             logger.log(Level.SEVERE, 
"Error making correlation attribute.", ex);
 
  339             logger.log(Level.SEVERE, 
"Case is closed.", ex);
 
  358         switch (file.getType()) {
 
  371                 return file.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC);
 
  373                 logger.log(Level.WARNING, 
"Unexpected file type {0}", file.getType().getName());
 
static final int EMAIL_TYPE_ID
static List< CorrelationAttributeInstance > makeInstancesFromBlackboardArtifact(BlackboardArtifact artifact, boolean checkEnabled)
static final int USBID_TYPE_ID
static final int ICCID_TYPE_ID
static final Logger logger
static void addCorrelationAttributeToList(List< CorrelationAttributeInstance > eamArtifacts, BlackboardArtifact artifact, ATTRIBUTE_TYPE bbAttributeType, int typeId)
static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource)
static String getEmailAddressAttrString()
static boolean isSupportedAbstractFileType(AbstractFile file)
static final int IMEI_TYPE_ID
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)
static final int MAC_TYPE_ID
static final int IMSI_TYPE_ID
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 SSID_TYPE_ID
static final int FILES_TYPE_ID