Autopsy  4.13.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AccountSummary.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 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.autopsy.communications.relationships;
20 
21 import java.util.List;
22 import java.util.Set;
23 import java.util.logging.Level;
26 import org.sleuthkit.datamodel.Account;
27 import org.sleuthkit.datamodel.BlackboardArtifact;
28 import org.sleuthkit.datamodel.BlackboardAttribute;
29 import org.sleuthkit.datamodel.Content;
30 import org.sleuthkit.datamodel.TskCoreException;
31 
36 class AccountSummary {
37 
38  private int attachmentCnt;
39  private int messagesCnt;
40  private int emailCnt;
41  private int callLogCnt;
42  private int contactsCnt;
43  private int mediaCnt;
44  private int referenceCnt;
45 
46  private final Account selectedAccount;
47  private final Set<BlackboardArtifact> artifacts;
48 
49  private static final Logger logger = Logger.getLogger(AccountSummary.class.getName());
50 
57  AccountSummary(Account selectedAccount, Set<BlackboardArtifact> artifacts) {
58  this.selectedAccount = selectedAccount;
59  this.artifacts = artifacts;
60  initCounts();
61  }
62 
66  private void initCounts() {
67  for (BlackboardArtifact artifact : artifacts) {
68  BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
69  if (null != fromID) {
70  switch (fromID) {
71  case TSK_EMAIL_MSG:
72  emailCnt++;
73  break;
74  case TSK_CALLLOG:
75  callLogCnt++;
76  break;
77  case TSK_MESSAGE:
78  messagesCnt++;
79  break;
80  case TSK_CONTACT:
81  if (selectedAccount.getAccountType() != Account.Type.DEVICE) {
82  String typeSpecificID = selectedAccount.getTypeSpecificID();
83 
84  List<BlackboardAttribute> attributes = null;
85 
86  try{
87  attributes = artifact.getAttributes();
88  } catch(TskCoreException ex) {
89  logger.log(Level.WARNING, String.format("Unable to getAttributes for artifact: %d", artifact.getArtifactID()), ex);
90  break;
91  }
92 
93  boolean isReference = false;
94 
95  for (BlackboardAttribute attribute: attributes) {
96  String attributeTypeName = attribute.getAttributeType().getTypeName();
97  String attributeValue = attribute.getValueString();
98 
99  if (attributeTypeName.contains("PHONE")) {
100  attributeValue = RelationshipsNodeUtilities.normalizePhoneNum(attributeValue);
101  } else if (attributeTypeName.contains("EMAIL")) {
102  attributeValue = RelationshipsNodeUtilities.normalizeEmailAddress(attributeValue);
103  }
104 
105  if ( typeSpecificID.equals(attributeValue) ) {
106  isReference = true;
107  break;
108  }
109  }
110  if (isReference) {
111  referenceCnt++;
112  } else {
113  contactsCnt++;
114  }
115  } else {
116  contactsCnt++;
117  }
118  break;
119  default:
120  break;
121  }
122  }
123  try {
124  attachmentCnt += artifact.getChildrenCount();
125  for (Content childContent : artifact.getChildren()) {
126  if (ImageUtils.thumbnailSupported(childContent)) {
127  mediaCnt++;
128  }
129  }
130  } catch (TskCoreException ex) {
131  logger.log(Level.WARNING, String.format("Exception thrown "
132  + "from getChildrenCount artifactID: %d",
133  artifact.getArtifactID()), ex); //NON-NLS
134  }
135  }
136  }
137 
143  public int getAttachmentCnt() {
144  return attachmentCnt;
145  }
146 
152  public int getMessagesCnt() {
153  return messagesCnt;
154  }
155 
161  public int getEmailCnt() {
162  return emailCnt;
163  }
164 
170  public int getCallLogCnt() {
171  return callLogCnt;
172  }
173 
179  public int getContactsCnt() {
180  return contactsCnt;
181  }
182 
188  public int getThumbnailCnt() {
189  return mediaCnt;
190  }
191 
197  public int getReferenceCnt() {
198  return referenceCnt;
199  }
200 }

Copyright © 2012-2019 Basis Technology. Generated on: Tue Jan 7 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.