Sleuth Kit Java Bindings (JNI)  4.8.0
Java bindings for using The Sleuth Kit
CommunicationArtifactsHelper.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2019-2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.datamodel.blackboardutils;
20 
21 import com.google.gson.Gson;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.List;
27 import org.apache.commons.lang3.StringUtils;
44 
65 public final class CommunicationArtifactsHelper extends ArtifactHelperBase {
66 
70  public enum MessageReadStatus {
71 
72  UNKNOWN("Unknown"),
73  UNREAD("Unread"),
74  READ("Read");
75 
76  private final String msgReadStr;
77 
78  MessageReadStatus(String readStatus) {
79  this.msgReadStr = readStatus;
80  }
81 
82  public String getDisplayName() {
83  return msgReadStr;
84  }
85  }
86 
90  public enum CommunicationDirection {
91  UNKNOWN("Unknown"),
92  INCOMING("Incoming"),
93  OUTGOING("Outgoing");
94 
95  private final String dirStr;
96 
97  CommunicationDirection(String dir) {
98  this.dirStr = dir;
99  }
100 
101  public String getDisplayName() {
102  return dirStr;
103  }
104  }
105 
109  public enum CallMediaType {
110  UNKNOWN("Unknown"),
111  AUDIO("Audio"), // Audio only call
112  VIDEO("Video"); // Video/multimedia call
113 
114  private final String typeStr;
115 
116  CallMediaType(String type) {
117  this.typeStr = type;
118  }
119 
120  public String getDisplayName() {
121  return typeStr;
122  }
123  }
124 
125  // 'self' account for the application being processed by the module.
126  private final Account.Type selfAccountType;
127  private final String selfAccountId;
128 
129  private AccountFileInstance selfAccountInstance = null;
130 
131  // Type of accounts to be created for the module using this helper.
132  private final Account.Type moduleAccountsType;
133 
152  String moduleName, Content srcContent, Account.Type accountsType) throws TskCoreException {
153 
154  super(caseDb, moduleName, srcContent);
155 
156  this.moduleAccountsType = accountsType;
157  this.selfAccountType = Account.Type.DEVICE;
158  this.selfAccountId = ((DataSource) getContent().getDataSource()).getDeviceId();
159  }
160 
180  public CommunicationArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Account.Type accountsType, Account.Type selfAccountType, String selfAccountId) throws TskCoreException {
181 
182  super(caseDb, moduleName, srcContent);
183 
184  this.moduleAccountsType = accountsType;
185  this.selfAccountType = selfAccountType;
186  this.selfAccountId = selfAccountId;
187  }
188 
210  public BlackboardArtifact addContact(String contactName,
211  String phoneNumber, String homePhoneNumber,
212  String mobilePhoneNumber, String emailAddr) throws TskCoreException, BlackboardException {
213  return addContact(contactName, phoneNumber,
214  homePhoneNumber, mobilePhoneNumber, emailAddr,
215  Collections.emptyList());
216  }
217 
243  public BlackboardArtifact addContact(String contactName,
244  String phoneNumber, String homePhoneNumber,
245  String mobilePhoneNumber, String emailAddr,
246  Collection<BlackboardAttribute> additionalAttributes) throws TskCoreException, BlackboardException {
247 
248  // check if the caller has included any phone/email/id in addtional attributes
249  boolean hasAnyIdAttribute = false;
250  if (additionalAttributes != null) {
251  for (BlackboardAttribute attr : additionalAttributes) {
252  if ((attr.getAttributeType().getTypeName().startsWith("TSK_PHONE"))
253  || (attr.getAttributeType().getTypeName().startsWith("TSK_EMAIL"))
254  || (attr.getAttributeType().getTypeName().startsWith("TSK_ID"))) {
255  hasAnyIdAttribute = true;
256  break;
257  }
258  }
259  }
260 
261  // At least one phone number or email address
262  // or an optional attribute with phone/email/id must be provided
263  if (StringUtils.isEmpty(phoneNumber) && StringUtils.isEmpty(homePhoneNumber)
264  && StringUtils.isEmpty(mobilePhoneNumber) && StringUtils.isEmpty(emailAddr)
265  && (!hasAnyIdAttribute)) {
266  throw new IllegalArgumentException("At least one phone number or email address or an id must be provided.");
267  }
268 
269  BlackboardArtifact contactArtifact;
270  Collection<BlackboardAttribute> attributes = new ArrayList<>();
271 
272  // create TSK_CONTACT artifact
273  contactArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_CONTACT);
274 
275  // construct attributes
276  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_NAME, contactName, attributes);
277 
278  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, phoneNumber, attributes);
279  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_HOME, homePhoneNumber, attributes);
280  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_MOBILE, mobilePhoneNumber, attributes);
281  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_EMAIL, emailAddr, attributes);
282 
283  // add attributes
284  attributes.addAll(additionalAttributes);
285  contactArtifact.addAttributes(attributes);
286 
287  // create an account for each specified contact method, and a relationship with self account
288  createContactMethodAccountAndRelationship(Account.Type.PHONE, phoneNumber, contactArtifact, 0);
289  createContactMethodAccountAndRelationship(Account.Type.PHONE, homePhoneNumber, contactArtifact, 0);
290  createContactMethodAccountAndRelationship(Account.Type.PHONE, mobilePhoneNumber, contactArtifact, 0);
291  createContactMethodAccountAndRelationship(Account.Type.EMAIL, emailAddr, contactArtifact, 0);
292 
293  // if the additional attribute list has any phone/email/id attributes, create accounts & relationships for those.
294  if ((additionalAttributes != null) && hasAnyIdAttribute) {
295  for (BlackboardAttribute bba : additionalAttributes) {
296  if (bba.getAttributeType().getTypeName().startsWith("TSK_PHONE")) {
297  createContactMethodAccountAndRelationship(Account.Type.PHONE, bba.getValueString(), contactArtifact, 0);
298  } else if (bba.getAttributeType().getTypeName().startsWith("TSK_EMAIL")) {
299  createContactMethodAccountAndRelationship(Account.Type.EMAIL, bba.getValueString(), contactArtifact, 0);
300  } else if (bba.getAttributeType().getTypeName().startsWith("TSK_ID")) {
301  createContactMethodAccountAndRelationship(this.moduleAccountsType, bba.getValueString(), contactArtifact, 0);
302  }
303  }
304  }
305 
306  // post artifact
307  getSleuthkitCase().getBlackboard().postArtifact(contactArtifact, getModuleName());
308 
309  return contactArtifact;
310  }
311 
319  private void createContactMethodAccountAndRelationship(Account.Type accountType,
320  String accountUniqueID, BlackboardArtifact sourceArtifact,
321  long dateTime) throws TskCoreException {
322 
323  // Find/Create an account instance for each of the contact method
324  // Create a relationship between selfAccount and contactAccount
325  if (!StringUtils.isEmpty(accountUniqueID)) {
326  AccountFileInstance contactAccountInstance = createAccountInstance(accountType, accountUniqueID);
327 
328  // Create a relationship between self account and the contact account
329  try {
330  getSleuthkitCase().getCommunicationsManager().addRelationships(getSelfAccountInstance(),
331  Collections.singletonList(contactAccountInstance), sourceArtifact, Relationship.Type.CONTACT, dateTime);
332  } catch (TskDataException ex) {
333  throw new TskCoreException(String.format("Failed to create relationship between account = %s and account = %s.",
334  getSelfAccountInstance().getAccount(), contactAccountInstance.getAccount()), ex);
335  }
336  }
337  }
338 
351  private AccountFileInstance createAccountInstance(Account.Type accountType, String accountUniqueID) throws TskCoreException {
352  return getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(accountType, accountUniqueID, getModuleName(), getContent());
353  }
354 
377  String messageType,
378  CommunicationDirection direction,
379  String senderId,
380  String recipientId,
381  long dateTime, MessageReadStatus readStatus,
382  String subject, String messageText, String threadId) throws TskCoreException, BlackboardException {
383  return addMessage(messageType, direction,
384  senderId, recipientId, dateTime, readStatus,
385  subject, messageText, threadId,
386  Collections.emptyList());
387  }
388 
411  public BlackboardArtifact addMessage(String messageType,
412  CommunicationDirection direction,
413  String senderId,
414  String recipientId,
415  long dateTime, MessageReadStatus readStatus, String subject,
416  String messageText, String threadId,
417  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
418 
419  return addMessage(messageType, direction,
420  senderId,
421  Arrays.asList(recipientId),
422  dateTime, readStatus,
423  subject, messageText, threadId,
424  otherAttributesList);
425  }
426 
449  public BlackboardArtifact addMessage(String messageType,
450  CommunicationDirection direction,
451  String senderId,
452  List<String> recipientIdsList,
453  long dateTime, MessageReadStatus readStatus,
454  String subject, String messageText, String threadId) throws TskCoreException, BlackboardException {
455  return addMessage(messageType, direction,
456  senderId, recipientIdsList,
457  dateTime, readStatus,
458  subject, messageText, threadId,
459  Collections.emptyList());
460  }
461 
484  public BlackboardArtifact addMessage(String messageType,
485  CommunicationDirection direction,
486  String senderId,
487  List<String> recipientIdsList,
488  long dateTime, MessageReadStatus readStatus,
489  String subject, String messageText,
490  String threadId,
491  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
492 
493  // Created message artifact.
494  BlackboardArtifact msgArtifact;
495  Collection<BlackboardAttribute> attributes = new ArrayList<>();
496 
497  // create TSK_MESSAGE artifact
498  msgArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_MESSAGE);
499 
500  // construct attributes
501  attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, getModuleName(), messageType));
502  addAttributeIfNotZero(ATTRIBUTE_TYPE.TSK_DATETIME, dateTime, attributes);
503 
504  addMessageReadStatusIfKnown(readStatus, attributes);
505  addCommDirectionIfKnown(direction, attributes);
506 
507  // set sender attribute and create sender account
508  AccountFileInstance senderAccountInstance = null;
509  if (!StringUtils.isEmpty(senderId)) {
510  senderAccountInstance = createAccountInstance(moduleAccountsType, senderId);
511  }
512 
513  // set recipient attribute and create recipient accounts
514  List<AccountFileInstance> recipientAccountsList = new ArrayList<>();
515  String recipientsStr = "";
516  if (!isEffectivelyEmpty(recipientIdsList)) {
517  for (String recipient : recipientIdsList) {
518  if (!StringUtils.isEmpty(recipient)) {
519  recipientAccountsList.add(createAccountInstance(moduleAccountsType, recipient));
520  }
521  }
522  // Create a comma separated string of recipients
523  recipientsStr = addressListToString(recipientIdsList);
524  }
525 
526  switch (direction) {
527  case OUTGOING:
528  // if no sender, selfAccount substitutes caller.
529  if (StringUtils.isEmpty(senderId)) {
530  senderAccountInstance = getSelfAccountInstance();
531  }
532  // sender becomes PHONE_FROM
533  if (senderAccountInstance != null) {
534  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, senderAccountInstance.getAccount().getTypeSpecificID(), attributes);
535  }
536  // recipient becomes PHONE_TO
537  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, recipientsStr, attributes);
538  break;
539 
540  case INCOMING:
541  // if no recipeint specified, selfAccount substitutes recipient
542  if (isEffectivelyEmpty(recipientIdsList)) {
543  recipientsStr = getSelfAccountInstance().getAccount().getTypeSpecificID();
544  recipientAccountsList.add(getSelfAccountInstance());
545  }
546  // caller becomes PHONE_FROM
547  if (senderAccountInstance != null) {
548  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, senderAccountInstance.getAccount().getTypeSpecificID(), attributes);
549  }
550  // callee becomes PHONE_TO
551  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, recipientsStr, attributes);
552  break;
553  default: // direction UNKNOWN
554  if (StringUtils.isEmpty(senderId)) {
555  // if no sender, selfAccount substitutes caller.
556  senderAccountInstance = getSelfAccountInstance();
557  }
558  else if (isEffectivelyEmpty(recipientIdsList)) {
559  // else if no recipient specified, selfAccount substitutes recipient
560  recipientsStr = getSelfAccountInstance().getAccount().getTypeSpecificID();
561  recipientAccountsList.add(getSelfAccountInstance());
562  }
563 
564  // save phone numbers in direction agnostic attributes
565  if (senderAccountInstance != null) {
566  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, senderAccountInstance.getAccount().getTypeSpecificID(), attributes);
567  } // callee becomes PHONE_TO
568  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, recipientsStr, attributes);
569  break;
570  }
571 
572  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_SUBJECT, subject, attributes);
573  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_TEXT, messageText, attributes);
574  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_THREAD_ID, threadId, attributes);
575 
576  // add attributes to artifact
577  attributes.addAll(otherAttributesList);
578  msgArtifact.addAttributes(attributes);
579 
580  // create sender/recipient relationships
581  try {
582  getSleuthkitCase().getCommunicationsManager().addRelationships(senderAccountInstance,
583  recipientAccountsList, msgArtifact, Relationship.Type.MESSAGE, dateTime);
584  } catch (TskDataException ex) {
585  throw new TskCoreException(String.format("Failed to create Message relationships between sender account = %s and recipients = %s.",
586  (senderAccountInstance != null) ? senderAccountInstance.getAccount().getTypeSpecificID() : "Unknown", recipientsStr), ex);
587  }
588 
589  // post artifact
590  getSleuthkitCase().getBlackboard().postArtifact(msgArtifact, getModuleName());
591 
592  // return the artifact
593  return msgArtifact;
594  }
595 
619  String callerId, String calleeId,
620  long startDateTime, long endDateTime, CallMediaType mediaType) throws TskCoreException, BlackboardException {
621  return addCalllog(direction, callerId, calleeId,
622  startDateTime, endDateTime, mediaType,
623  Collections.emptyList());
624  }
625 
650  String callerId,
651  String calleeId,
652  long startDateTime, long endDateTime,
653  CallMediaType mediaType,
654  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
655  return addCalllog(direction,
656  callerId,
657  Arrays.asList(calleeId),
658  startDateTime, endDateTime,
659  mediaType,
660  otherAttributesList);
661  }
662 
686  String callerId,
687  Collection<String> calleeIdsList,
688  long startDateTime, long endDateTime,
689  CallMediaType mediaType) throws TskCoreException, BlackboardException {
690 
691  return addCalllog(direction, callerId, calleeIdsList,
692  startDateTime, endDateTime,
693  mediaType,
694  Collections.emptyList());
695  }
696 
721  String callerId,
722  Collection<String> calleeIdsList,
723  long startDateTime, long endDateTime,
724  CallMediaType mediaType,
725  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
726 
727  // Either caller id or a callee id must be provided.
728  if (StringUtils.isEmpty(callerId) && (isEffectivelyEmpty(calleeIdsList))) {
729  throw new IllegalArgumentException("Either a caller id, or at least one callee id must be provided for a call log.");
730  }
731 
732  BlackboardArtifact callLogArtifact;
733  Collection<BlackboardAttribute> attributes = new ArrayList<>();
734 
735  // Create TSK_CALLLOG artifact
736  callLogArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_CALLLOG);
737 
738  // Add basic attributes
739  addAttributeIfNotZero(ATTRIBUTE_TYPE.TSK_DATETIME_START, startDateTime, attributes);
740  addAttributeIfNotZero(ATTRIBUTE_TYPE.TSK_DATETIME_END, endDateTime, attributes);
741  addCommDirectionIfKnown(direction, attributes);
742 
743  AccountFileInstance callerAccountInstance = null;
744  if (!StringUtils.isEmpty(callerId)) {
745  callerAccountInstance = createAccountInstance(moduleAccountsType, callerId);
746  }
747 
748  // Create a comma separated string of callee
749  List<AccountFileInstance> recipientAccountsList = new ArrayList<>();
750  String calleesStr = "";
751  if (!isEffectivelyEmpty(calleeIdsList)) {
752  calleesStr = addressListToString(calleeIdsList);
753  for (String callee : calleeIdsList) {
754  if (!StringUtils.isEmpty(callee)) {
755  recipientAccountsList.add(createAccountInstance(moduleAccountsType, callee));
756  }
757  }
758  }
759 
760  switch (direction) {
761  case OUTGOING:
762  // if no callee throw IllegalArg
763  if (isEffectivelyEmpty(calleeIdsList)) {
764  throw new IllegalArgumentException("Callee not provided for an outgoing call.");
765  }
766  // if no caller, selfAccount substitutes caller.
767  if (StringUtils.isEmpty(callerId)) {
768  callerAccountInstance = getSelfAccountInstance();
769  }
770  // caller becomes PHONE_FROM
771  if (callerAccountInstance != null) {
772  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, callerAccountInstance.getAccount().getTypeSpecificID(), attributes);
773  }
774  // callee becomes PHONE_TO
775  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, calleesStr, attributes);
776  break;
777 
778  case INCOMING:
779  // if no caller throw IllegalArg
780  if (StringUtils.isEmpty(callerId)) {
781  throw new IllegalArgumentException("Caller Id not provided for incoming call.");
782  }
783  // if no callee specified, selfAccount substitutes callee
784  if (isEffectivelyEmpty(calleeIdsList)) {
785  calleesStr = getSelfAccountInstance().getAccount().getTypeSpecificID();
786  recipientAccountsList.add(getSelfAccountInstance());
787  }
788  // caller becomes PHONE_FROM
789  if (callerAccountInstance != null) {
790  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, callerAccountInstance.getAccount().getTypeSpecificID(), attributes);
791  }
792  // callee becomes PHONE_TO
793  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, calleesStr, attributes);
794  break;
795  default: // direction UNKNOWN
796 
797  // save phone numbers in direction agnostic attributes
798  if (callerAccountInstance != null) {
799  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, callerAccountInstance.getAccount().getTypeSpecificID(), attributes);
800  } // callee becomes PHONE_TO
801  addAttributeIfNotNull(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, calleesStr, attributes);
802  break;
803  }
804 
805  // add attributes to artifact
806  attributes.addAll(otherAttributesList);
807  callLogArtifact.addAttributes(attributes);
808 
809  // create relationships between caller/callees
810  try {
811  getSleuthkitCase().getCommunicationsManager().addRelationships(callerAccountInstance,
812  recipientAccountsList, callLogArtifact, Relationship.Type.CALL_LOG, startDateTime);
813  } catch (TskDataException ex) {
814  throw new TskCoreException(String.format("Failed to create Call log relationships between caller account = %s and callees = %s.",
815  callerAccountInstance.getAccount(), calleesStr), ex);
816  }
817 
818  // post artifact
819  getSleuthkitCase().getBlackboard().postArtifact(callLogArtifact, getModuleName());
820 
821  // return the artifact
822  return callLogArtifact;
823  }
824 
833  public void addAttachments(BlackboardArtifact message, MessageAttachments attachments) throws TskCoreException {
834 
835  // Convert the MessageAttachments object to JSON string
836  Gson gson = new Gson();
837  String attachmentsJson = gson.toJson(attachments);
838 
839  // Create attribute
840  message.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ATTACHMENTS, getModuleName(), attachmentsJson));
841 
842  // Associate each attachment file with the message.
843  Collection<FileAttachment> fileAttachments = attachments.getFileAttachments();
844  for (FileAttachment fileAttachment : fileAttachments) {
845  long attachedFileObjId = fileAttachment.getObjectId();
846  if (attachedFileObjId >= 0) {
847  AbstractFile attachedFile = message.getSleuthkitCase().getAbstractFileById(attachedFileObjId);
848  associateAttachmentWithMessage(message, attachedFile);
849  }
850  }
851  }
852 
865  private BlackboardArtifact associateAttachmentWithMessage(BlackboardArtifact message, AbstractFile attachedFile) throws TskCoreException {
866  Collection<BlackboardAttribute> attributes = new ArrayList<>();
867  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, this.getModuleName(), message.getArtifactID()));
868 
870  bba.addAttributes(attributes); //write out to bb
871  return bba;
872  }
873 
877  private String addressListToString(Collection<String> addressList) {
878 
879  String toAddresses = "";
880  if (addressList != null && (!addressList.isEmpty())) {
881  StringBuilder toAddressesSb = new StringBuilder();
882  for (String address : addressList) {
883  if (!StringUtils.isEmpty(address)) {
884  toAddressesSb = toAddressesSb.length() > 0 ? toAddressesSb.append(", ").append(address) : toAddressesSb.append(address);
885  }
886  }
887  toAddresses = toAddressesSb.toString();
888  }
889 
890  return toAddresses;
891  }
892 
902  private boolean isEffectivelyEmpty(Collection<String> idList) {
903 
904  if (idList == null || idList.isEmpty()) {
905  return true;
906  }
907 
908  for (String id : idList) {
909  if (!StringUtils.isEmpty(id)) {
910  return false;
911  }
912  }
913 
914  return true;
915 
916  }
917 
921  private void addCommDirectionIfKnown(CommunicationDirection direction, Collection<BlackboardAttribute> attributes) {
922  if (direction != CommunicationDirection.UNKNOWN) {
923  attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DIRECTION, getModuleName(), direction.getDisplayName()));
924  }
925  }
926 
930  private void addMessageReadStatusIfKnown(MessageReadStatus readStatus, Collection<BlackboardAttribute> attributes) {
931  if (readStatus != MessageReadStatus.UNKNOWN) {
932  attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_READ_STATUS, getModuleName(), (readStatus == MessageReadStatus.READ) ? 1 : 0));
933  }
934  }
935 
942  private synchronized AccountFileInstance getSelfAccountInstance() throws TskCoreException {
943  if (selfAccountInstance == null) {
944  selfAccountInstance = getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(selfAccountType, selfAccountId, this.getModuleName(), getContent());
945  }
946  return selfAccountInstance;
947  }
948 }
BlackboardArtifact addMessage(String messageType, CommunicationDirection direction, String senderId, List< String > recipientIdsList, long dateTime, MessageReadStatus readStatus, String subject, String messageText, String threadId, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addContact(String contactName, String phoneNumber, String homePhoneNumber, String mobilePhoneNumber, String emailAddr)
void addAttributes(Collection< BlackboardAttribute > attributes)
CommunicationArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Account.Type accountsType)
BlackboardArtifact addContact(String contactName, String phoneNumber, String homePhoneNumber, String mobilePhoneNumber, String emailAddr, Collection< BlackboardAttribute > additionalAttributes)
static final Account.Type PHONE
Definition: Account.java:49
BlackboardArtifact addMessage(String messageType, CommunicationDirection direction, String senderId, String recipientId, long dateTime, MessageReadStatus readStatus, String subject, String messageText, String threadId)
BlackboardArtifact newArtifact(int artifactTypeID)
BlackboardArtifact addMessage(String messageType, CommunicationDirection direction, String senderId, String recipientId, long dateTime, MessageReadStatus readStatus, String subject, String messageText, String threadId, Collection< BlackboardAttribute > otherAttributesList)
static final Relationship.Type CALL_LOG
BlackboardArtifact addCalllog(CommunicationDirection direction, String callerId, Collection< String > calleeIdsList, long startDateTime, long endDateTime, CallMediaType mediaType, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addCalllog(CommunicationDirection direction, String callerId, Collection< String > calleeIdsList, long startDateTime, long endDateTime, CallMediaType mediaType)
CommunicationArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Account.Type accountsType, Account.Type selfAccountType, String selfAccountId)
BlackboardArtifact addCalllog(CommunicationDirection direction, String callerId, String calleeId, long startDateTime, long endDateTime, CallMediaType mediaType, Collection< BlackboardAttribute > otherAttributesList)
static final Account.Type DEVICE
Definition: Account.java:48
static final Relationship.Type MESSAGE
BlackboardArtifact addMessage(String messageType, CommunicationDirection direction, String senderId, List< String > recipientIdsList, long dateTime, MessageReadStatus readStatus, String subject, String messageText, String threadId)
static final Relationship.Type CONTACT
BlackboardArtifact addCalllog(CommunicationDirection direction, String callerId, String calleeId, long startDateTime, long endDateTime, CallMediaType mediaType)
void addAttachments(BlackboardArtifact message, MessageAttachments attachments)
static final Account.Type EMAIL
Definition: Account.java:50

Copyright © 2011-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.