Sleuth Kit Java Bindings (JNI) 4.14.0
Java bindings for using The Sleuth Kit
Loading...
Searching...
No Matches
BlackboardArtifact.java
Go to the documentation of this file.
1/*
2 * Sleuth Kit Data Model
3 *
4 * Copyright 2011-2021 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 */
19package org.sleuthkit.datamodel;
20
21import com.google.common.annotations.Beta;
22import java.io.Serializable;
23import java.io.UnsupportedEncodingException;
24import java.sql.SQLException;
25import java.text.MessageFormat;
26import java.util.ArrayList;
27import java.util.Collection;
28import java.util.Collections;
29import java.util.HashMap;
30import java.util.HashSet;
31import java.util.List;
32import java.util.Map;
33import java.util.Objects;
34import java.util.ResourceBundle;
35import java.util.Set;
36import java.util.stream.Collectors;
37import java.util.stream.Stream;
38import org.sleuthkit.datamodel.Blackboard.BlackboardException;
39import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
40import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
41import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction;
42
54public abstract class BlackboardArtifact implements Content {
55
56 private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle");
57 private final long artifactId;
58 private final long sourceObjId; // refers to objID of parent/source object
59 private final long artifactObjId; // objId of the artifact in tsk_objects. TBD: replace artifactID with this
60 private final Long dataSourceObjId; // objId of the data source in tsk_objects.
61 private final int artifactTypeId;
62 private final String artifactTypeName;
63 private final String displayName;
64 private ReviewStatus reviewStatus;
65 private final SleuthkitCase sleuthkitCase;
66 private final List<BlackboardAttribute> attrsCache = new ArrayList<BlackboardAttribute>();
67 private boolean loadedCacheFromDb = false;
68 private volatile Content parent;
69 private volatile String uniquePath;
70
71 private byte[] contentBytes = null;
72
73 private volatile boolean checkedHasChildren;
74 private volatile boolean hasChildren;
75 private volatile int childrenCount;
76
97 BlackboardArtifact(SleuthkitCase sleuthkitCase, long artifactID, long sourceObjId, long artifactObjId, Long dataSourceObjId, int artifactTypeID, String artifactTypeName, String displayName, ReviewStatus reviewStatus) {
98
99 this.sleuthkitCase = sleuthkitCase;
100 this.artifactId = artifactID;
101 this.sourceObjId = sourceObjId;
102 this.artifactObjId = artifactObjId;
103 this.artifactTypeId = artifactTypeID;
104 this.dataSourceObjId = dataSourceObjId;
105 this.artifactTypeName = artifactTypeName;
106 this.displayName = displayName;
107 this.reviewStatus = reviewStatus;
108
109 this.checkedHasChildren = false;
110 this.hasChildren = false;
111 this.childrenCount = -1;
112
113 }
114
135 BlackboardArtifact(SleuthkitCase sleuthkitCase, long artifactID, long sourceObjId, long artifactObjID, Long dataSourceObjID, int artifactTypeID, String artifactTypeName, String displayName, ReviewStatus reviewStatus, boolean isNew) {
136 this(sleuthkitCase, artifactID, sourceObjId, artifactObjID, dataSourceObjID, artifactTypeID, artifactTypeName, displayName, reviewStatus);
137 if (isNew) {
138 /*
139 * If this object represents a newly created artifact, then its
140 * collection of attributes has already been populated and there is
141 * no need to fetch them form the case database.
142 */
143 this.loadedCacheFromDb = true;
144 }
145 }
146
154 return sleuthkitCase;
155 }
156
162 public long getArtifactID() {
163 return this.artifactId;
164 }
165
172 public long getObjectID() {
173 return this.sourceObjId;
174 }
175
181 @Beta
182 public Long getDataSourceObjectID() {
183 return this.dataSourceObjId;
184 }
185
191 public int getArtifactTypeID() {
192 return this.artifactTypeId;
193 }
194
203 BlackboardArtifact.Type standardTypesValue = BlackboardArtifact.Type.STANDARD_TYPES.get(getArtifactTypeID());
204 if (standardTypesValue != null) {
205 return standardTypesValue;
206 } else {
208 }
209 }
210
216 public String getArtifactTypeName() {
217 return this.artifactTypeName;
218 }
219
225 public String getDisplayName() {
226 return this.displayName;
227 }
228
236 public String getShortDescription() throws TskCoreException {
237 BlackboardAttribute attr = null;
238 StringBuilder shortDescription = new StringBuilder("");
239 if (BlackboardArtifact.Type.STANDARD_TYPES.get(artifactTypeId) != null) {
240 switch (ARTIFACT_TYPE.fromID(artifactTypeId)) {
241 case TSK_WIFI_NETWORK_ADAPTER:
243 break;
244 case TSK_WIFI_NETWORK:
246 break;
247 case TSK_REMOTE_DRIVE:
249 break;
250 case TSK_SERVICE_ACCOUNT:
251 case TSK_SCREEN_SHOTS:
252 case TSK_DELETED_PROG:
253 case TSK_METADATA:
254 case TSK_OS_INFO:
255 case TSK_PROG_NOTIFICATIONS:
256 case TSK_PROG_RUN:
257 case TSK_RECENT_OBJECT:
258 case TSK_USER_DEVICE_EVENT:
259 case TSK_WEB_SEARCH_QUERY:
261 break;
262 case TSK_BLUETOOTH_PAIRING:
264 break;
265 case TSK_ACCOUNT:
267 if (attr == null) {
269 }
270 break;
271 case TSK_WEB_CATEGORIZATION:
272 case TSK_BLUETOOTH_ADAPTER:
273 case TSK_GPS_AREA:
274 case TSK_GPS_BOOKMARK:
275 case TSK_GPS_LAST_KNOWN_LOCATION:
276 case TSK_GPS_ROUTE:
277 case TSK_GPS_SEARCH:
278 case TSK_GPS_TRACK:
279 case TSK_WEB_FORM_AUTOFILL:
281 break;
282 case TSK_WEB_ACCOUNT_TYPE:
284 break;
285 case TSK_HASHSET_HIT:
286 case TSK_INTERESTING_ARTIFACT_HIT:
287 case TSK_INTERESTING_FILE_HIT:
288 case TSK_INTERESTING_ITEM:
289 case TSK_YARA_HIT:
291 break;
292 case TSK_ENCRYPTION_DETECTED:
293 case TSK_ENCRYPTION_SUSPECTED:
294 case TSK_OBJECT_DETECTED:
295 case TSK_USER_CONTENT_SUSPECTED:
296 case TSK_VERIFICATION_FAILED:
298 break;
299 case TSK_DATA_SOURCE_USAGE:
300 case TSK_CALENDAR_ENTRY:
302 break;
303 case TSK_WEB_BOOKMARK: //web_bookmark, web_cookie, web_download, and web_history are the same attribute for now
304 case TSK_WEB_COOKIE:
305 case TSK_WEB_DOWNLOAD:
306 case TSK_WEB_HISTORY:
307 case TSK_WEB_CACHE:
309 break;
310 case TSK_KEYWORD_HIT:
312 break;
313 case TSK_DEVICE_ATTACHED:
315 break;
316 case TSK_CONTACT: //contact, message, and calllog are the same attributes for now
317 case TSK_MESSAGE:
318 case TSK_CALLLOG:
319 case TSK_SPEED_DIAL_ENTRY:
320 case TSK_WEB_FORM_ADDRESS:
321 //get the first of these attributes which exists and is non null
322 final ATTRIBUTE_TYPE[] typesThatCanHaveName = {ATTRIBUTE_TYPE.TSK_NAME,
334 ATTRIBUTE_TYPE.TSK_LOCATION}; //in the order we want to use them
335 for (ATTRIBUTE_TYPE t : typesThatCanHaveName) {
337 if (attr != null && !attr.getDisplayString().isEmpty()) {
338 break;
339 }
340 }
341 break;
342 default:
343 break;
344 }
345 }
346 if (attr != null) {
347 shortDescription.append(attr.getAttributeType().getDisplayName()).append(": ").append(attr.getDisplayString());
348 } else {
349 shortDescription.append(getDisplayName());
350 }
351 //get the first of these date attributes which exists and is non null
352 final ATTRIBUTE_TYPE[] typesThatCanHaveDate = {ATTRIBUTE_TYPE.TSK_DATETIME,
359 ATTRIBUTE_TYPE.TSK_DATETIME_END}; //in the order we want to use them
361 for (ATTRIBUTE_TYPE t : typesThatCanHaveDate) {
363 if (date != null && !date.getDisplayString().isEmpty()) {
364 shortDescription.append(" ");
365 shortDescription.append(MessageFormat.format(bundle.getString("BlackboardArtifact.shortDescriptionDate.text"), date.getDisplayString())); //NON-NLS
366 break;
367 }
368 }
369 return shortDescription.toString();
370 }
371
379 return reviewStatus;
380 }
381
390 public void setReviewStatus(ReviewStatus newStatus) throws TskCoreException {
391 getSleuthkitCase().setReviewStatus(this, newStatus);
392 reviewStatus = newStatus;
393 }
394
406 public void addAttribute(BlackboardAttribute attribute) throws TskCoreException {
407 attribute.setArtifactId(artifactId);
408 attribute.setCaseDatabase(getSleuthkitCase());
409 getSleuthkitCase().addBlackboardAttribute(attribute, this.artifactTypeId);
410 attrsCache.add(attribute);
411 }
412
421 public List<BlackboardAttribute> getAttributes() throws TskCoreException {
422 ArrayList<BlackboardAttribute> attributes;
423 if (false == loadedCacheFromDb) {
425 attrsCache.clear();
426 attrsCache.addAll(attributes);
427 loadedCacheFromDb = true;
428 } else {
429 attributes = new ArrayList<>(attrsCache);
430 }
431 return attributes;
432 }
433
440 void setAttributes(List<BlackboardAttribute> attributes) {
441 attrsCache.clear();
442 attrsCache.addAll(attributes);
443 loadedCacheFromDb = true;
444 }
445
461 List<BlackboardAttribute> attributes = this.getAttributes();
462 for (BlackboardAttribute attribute : attributes) {
463 if (attribute.getAttributeType().equals(attributeType)) {
464 return attribute;
465 }
466 }
467 return null;
468 }
469
479 public void addAttributes(Collection<BlackboardAttribute> attributes) throws TskCoreException {
480 if (attributes.isEmpty()) {
481 return;
482 }
483 for (BlackboardAttribute attribute : attributes) {
484 attribute.setArtifactId(artifactId);
485 attribute.setCaseDatabase(getSleuthkitCase());
486 }
487 getSleuthkitCase().addBlackboardAttributes(attributes, artifactTypeId);
488 attrsCache.addAll(attributes);
489 }
490
506 public void addAttributes(Collection<BlackboardAttribute> attributes, final SleuthkitCase.CaseDbTransaction caseDbTransaction) throws TskCoreException {
507
508 if (Objects.isNull(attributes) || attributes.isEmpty()) {
509 throw new TskCoreException("Illegal argument passed to addAttributes: null or empty attributes passed to addAttributes");
510 }
511 if (Objects.isNull(caseDbTransaction)) {
512 throw new TskCoreException("Illegal argument passed to addAttributes: null caseDbTransaction passed to addAttributes");
513 }
514 try {
515 for (final BlackboardAttribute attribute : attributes) {
516 attribute.setArtifactId(artifactId);
517 attribute.setCaseDatabase(getSleuthkitCase());
518 getSleuthkitCase().addBlackBoardAttribute(attribute, artifactTypeId, caseDbTransaction.getConnection());
519 }
520 attrsCache.addAll(attributes);
521 } catch (SQLException ex) {
522 throw new TskCoreException("Error adding blackboard attributes", ex);
523 }
524 }
525
532 @Override
533 public String getUniquePath() throws TskCoreException {
534 // Return the path of the parent file
535 // It is possible that multiple threads could be doing this calculation
536 // simultaneously, but it's worth the potential extra processing to prevent deadlocks.
537 if (uniquePath == null) {
538 String tempUniquePath = "";
539 Content myParent = getParent();
540 if (myParent != null) {
541 tempUniquePath = myParent.getUniquePath();
542 }
543
544 // Don't update uniquePath until it is complete.
545 uniquePath = tempUniquePath;
546 }
547 return uniquePath;
548 }
549
550 @Override
552 if (parent == null) {
553 parent = getSleuthkitCase().getContentById(sourceObjId);
554 }
555 return parent;
556 }
557
565 @Override
566 public ArrayList<BlackboardArtifact> getAllArtifacts() throws TskCoreException {
567 // Currently we don't have any artifacts derived from an artifact.
568 return new ArrayList<BlackboardArtifact>();
569 }
570
571 @Override
572 public List<AnalysisResult> getAllAnalysisResults() throws TskCoreException {
573 return sleuthkitCase.getBlackboard().getAnalysisResults(artifactObjId);
574 }
575
576 @Override
577 public List<DataArtifact> getAllDataArtifacts() throws TskCoreException {
578 return sleuthkitCase.getBlackboard().getDataArtifactsBySource(artifactObjId);
579 }
580
581 @Override
583 return sleuthkitCase.getScoringManager().getAggregateScore(artifactObjId);
584
585 }
586
587 @Override
588 public List<AnalysisResult> getAnalysisResults(BlackboardArtifact.Type artifactType) throws TskCoreException {
589 return sleuthkitCase.getBlackboard().getAnalysisResults(artifactObjId, artifactType.getTypeID()); //NON-NLS
590 }
591
602 @Override
603 public ArrayList<BlackboardArtifact> getArtifacts(String artifactTypeName) throws TskCoreException {
604 // Currently we don't have any artifacts derived from an artifact.
605 return new ArrayList<BlackboardArtifact>();
606 }
607
618 @Override
619 public ArrayList<BlackboardArtifact> getArtifacts(int artifactTypeID) throws TskCoreException {
620 // Currently we don't have any artifacts derived from an artifact.
621 return new ArrayList<BlackboardArtifact>();
622 }
623
633 @Override
634 public ArrayList<BlackboardArtifact> getArtifacts(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException {
635 // Currently we don't have any artifacts derived from an artifact.
636 return new ArrayList<BlackboardArtifact>();
637 }
638
646 @Override
648 // Currently we don't have any artifacts derived from an artifact.
649 return 0;
650 }
651
662 @Override
663 public long getArtifactsCount(String artifactTypeName) throws TskCoreException {
664 // Currently we don't have any artifacts derived from an artifact.
665 return 0;
666 }
667
678 @Override
679 public long getArtifactsCount(int artifactTypeID) throws TskCoreException {
680 // Currently we don't have any artifacts derived from an artifact.
681 return 0;
682 }
683
694 @Override
695 public long getArtifactsCount(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException {
696 // Currently we don't have any artifacts derived from an artifact.
697 return 0;
698 }
699
708 @Override
709 public BlackboardArtifact getGenInfoArtifact() throws TskCoreException {
710 // Currently we don't have any artifacts derived from an artifact.
711 return null;
712 }
713
727 @Override
728 public BlackboardArtifact getGenInfoArtifact(boolean create) throws TskCoreException {
729 // Currently we don't have any artifacts derived from an artifact.
730 if (create) {
731 throw new TskCoreException("Artifacts of artifacts are not supported.");
732 }
733
734 return null;
735 }
736
747 @Override
748 public ArrayList<BlackboardAttribute> getGenInfoAttributes(BlackboardAttribute.ATTRIBUTE_TYPE attr_type) throws TskCoreException {
749 // Currently we don't have any artifacts derived from an artifact.
750 return new ArrayList<>();
751 }
752
760 @Override
761 public Set<String> getHashSetNames() throws TskCoreException {
762 // Currently we don't have any artifacts derived from an artifact.
763 return new HashSet<String>();
764 }
765
779 @Deprecated
780 @Override
781 public BlackboardArtifact newArtifact(int artifactTypeID) throws TskCoreException {
782 throw new TskCoreException("Cannot create artifact of an artifact. Not supported.");
783 }
784
785 @Override
786 public AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactType, Score score, String conclusion, String configuration, String justification, Collection<BlackboardAttribute> attributesList) throws TskCoreException {
787 // Get the ID before starting the transaction
788 long dataSourceId = this.getDataSource().getId();
789
790 CaseDbTransaction trans = sleuthkitCase.beginTransaction();
791 try {
792 AnalysisResultAdded resultAdded = sleuthkitCase.getBlackboard().newAnalysisResult(artifactType, this.getId(), dataSourceId, score, conclusion, configuration, justification, attributesList, trans);
793
794 trans.commit();
795 return resultAdded;
796 } catch (BlackboardException ex) {
797 trans.rollback();
798 throw new TskCoreException("Error adding analysis result.", ex);
799 }
800 }
801
802 @Override
803 public AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactType, Score score, String conclusion, String configuration, String justification, Collection<BlackboardAttribute> attributesList, long dataSourceId) throws TskCoreException {
804 CaseDbTransaction trans = sleuthkitCase.beginTransaction();
805 try {
806 AnalysisResultAdded resultAdded = sleuthkitCase.getBlackboard().newAnalysisResult(artifactType, this.getId(), dataSourceId, score, conclusion, configuration, justification, attributesList, trans);
807
808 trans.commit();
809 return resultAdded;
810 } catch (BlackboardException ex) {
811 trans.rollback();
812 throw new TskCoreException("Error adding analysis result.", ex);
813 }
814 }
815
816 @Override
817 public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException {
818 throw new TskCoreException("Cannot create data artifact of an artifact. Not supported.");
819 }
820
821 @Override
822 public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId, long dataSourceId) throws TskCoreException {
823 throw new TskCoreException("Cannot create data artifact of an artifact. Not supported.");
824 }
825
826 @Override
827 public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList) throws TskCoreException {
828 return newDataArtifact(artifactType, attributesList, null);
829 }
830
843 @Deprecated
844 @Override
845 public BlackboardArtifact newArtifact(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException {
846 throw new TskCoreException("Cannot create artifact of an artifact. Not supported.");
847 }
848
857 @Override
858 public <T> T accept(ContentVisitor<T> visitor) {
859 return visitor.visit(this);
860 }
861
869 @Override
870 public boolean equals(Object object) {
871 if (object == null) {
872 return false;
873 }
874 if (getClass() != object.getClass()) {
875 return false;
876 }
877 final BlackboardArtifact other = (BlackboardArtifact) object;
878 return artifactId == other.getArtifactID();
879 }
880
886 @Override
887 public int hashCode() {
888 int hash = 7;
889 hash = 41 * hash + (int) (this.artifactId ^ (this.artifactId >>> 32));
890 return hash;
891 }
892
898 @Override
899 public String toString() {
900 return "BlackboardArtifact{" + "artifactID=" + artifactId + ", objID=" + getObjectID() + ", artifactObjID=" + artifactObjId + ", artifactTypeID=" + artifactTypeId + ", artifactTypeName=" + artifactTypeName + ", displayName=" + displayName + ", Case=" + getSleuthkitCase() + '}'; //NON-NLS
901 }
902
913 @Override
914 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
915 return visitor.visit(this);
916 }
917
924 @Override
925 public long getSize() {
926
927 if (contentBytes == null) {
928 try {
929 loadArtifactContent();
930 } catch (TskCoreException ex) {
931 return 0;
932 }
933 }
934
935 return contentBytes.length;
936 }
937
941 @Override
942 public void close() {
943 contentBytes = null;
944 }
945
959 @Override
960 public final int read(byte[] buf, long offset, long len) throws TskCoreException {
961
962 if (contentBytes == null) {
963 loadArtifactContent();
964 }
965
966 if (0 == contentBytes.length) {
967 return 0;
968 }
969
970 // Copy bytes
971 long readLen = Math.min(contentBytes.length - offset, len);
972 System.arraycopy(contentBytes, 0, buf, 0, (int) readLen);
973
974 return (int) readLen;
975 }
976
977 @Override
978 public String getName() {
979 return this.displayName + getArtifactID();
980 }
981
982 @Override
984 return dataSourceObjId != null ? getSleuthkitCase().getContentById(dataSourceObjId) : null;
985 }
986
993 private void loadArtifactContent() throws TskCoreException {
994 StringBuilder artifactContents = new StringBuilder();
995
996 Content dataSource = null;
997 try {
998 dataSource = getDataSource();
999 } catch (TskCoreException ex) {
1000 throw new TskCoreException("Unable to get datasource for artifact: " + this.toString(), ex);
1001 }
1002 if (dataSource == null) {
1003 throw new TskCoreException("Datasource was null for artifact: " + this.toString());
1004 }
1005
1006 try {
1007 for (BlackboardAttribute attribute : getAttributes()) {
1008 artifactContents.append(attribute.getAttributeType().getDisplayName());
1009 artifactContents.append(" : ");
1010 artifactContents.append(attribute.getDisplayString());
1011 artifactContents.append(System.lineSeparator());
1012 }
1013 } catch (TskCoreException ex) {
1014 throw new TskCoreException("Unable to get attributes for artifact: " + this.toString(), ex);
1015 }
1016
1017 try {
1018 contentBytes = artifactContents.toString().getBytes("UTF-8");
1019 } catch (UnsupportedEncodingException ex) {
1020 throw new TskCoreException("Failed to convert artifact string to bytes for artifact: " + this.toString(), ex);
1021 }
1022
1023 }
1024
1028 public static final class Type implements Serializable {
1029
1030 private static final long serialVersionUID = 1L;
1031
1035 public static final Type TSK_GEN_INFO = new BlackboardArtifact.Type(1, "TSK_GEN_INFO", bundle.getString("BlackboardArtifact.tskGenInfo.text"), Category.DATA_ARTIFACT);
1036
1042 public static final Type TSK_WEB_BOOKMARK = new BlackboardArtifact.Type(2, "TSK_WEB_BOOKMARK", bundle.getString("BlackboardArtifact.tskWebBookmark.text"), Category.DATA_ARTIFACT);
1043
1049 public static final Type TSK_WEB_COOKIE = new BlackboardArtifact.Type(3, "TSK_WEB_COOKIE", bundle.getString("BlackboardArtifact.tskWebCookie.text"), Category.DATA_ARTIFACT);
1050
1056 public static final Type TSK_WEB_HISTORY = new BlackboardArtifact.Type(4, "TSK_WEB_HISTORY", bundle.getString("BlackboardArtifact.tskWebHistory.text"), Category.DATA_ARTIFACT);
1057
1063 public static final Type TSK_WEB_DOWNLOAD = new BlackboardArtifact.Type(5, "TSK_WEB_DOWNLOAD", bundle.getString("BlackboardArtifact.tskWebDownload.text"), Category.DATA_ARTIFACT);
1064
1068 public static final Type TSK_RECENT_OBJECT = new BlackboardArtifact.Type(6, "TSK_RECENT_OBJ", bundle.getString("BlackboardArtifact.tsk.recentObject.text"), Category.DATA_ARTIFACT);
1069
1070 // 7 was used for deprecated TSK_GPS_TRACKPOINT.
1074 public static final Type TSK_INSTALLED_PROG = new BlackboardArtifact.Type(8, "TSK_INSTALLED_PROG", bundle.getString("BlackboardArtifact.tskInstalledProg.text"), Category.DATA_ARTIFACT);
1075
1079 public static final Type TSK_KEYWORD_HIT = new BlackboardArtifact.Type(9, "TSK_KEYWORD_HIT", bundle.getString("BlackboardArtifact.tskKeywordHits.text"), Category.ANALYSIS_RESULT);
1080
1084 public static final Type TSK_HASHSET_HIT = new BlackboardArtifact.Type(10, "TSK_HASHSET_HIT", bundle.getString("BlackboardArtifact.tskHashsetHit.text"), Category.ANALYSIS_RESULT);
1085
1089 public static final Type TSK_DEVICE_ATTACHED = new BlackboardArtifact.Type(11, "TSK_DEVICE_ATTACHED", bundle.getString("BlackboardArtifact.tskDeviceAttached.text"), Category.DATA_ARTIFACT);
1090
1097 @Deprecated
1098 public static final Type TSK_INTERESTING_FILE_HIT = new BlackboardArtifact.Type(12, "TSK_INTERESTING_FILE_HIT", bundle.getString("BlackboardArtifact.tskInterestingFileHit.text"), Category.ANALYSIS_RESULT);
1099
1103 public static final Type TSK_EMAIL_MSG = new BlackboardArtifact.Type(13, "TSK_EMAIL_MSG", bundle.getString("BlackboardArtifact.tskEmailMsg.text"), Category.DATA_ARTIFACT);
1104
1108 public static final Type TSK_EXTRACTED_TEXT = new BlackboardArtifact.Type(14, "TSK_EXTRACTED_TEXT", bundle.getString("BlackboardArtifact.tskExtractedText.text"), Category.DATA_ARTIFACT);
1109
1113 public static final Type TSK_WEB_SEARCH_QUERY = new BlackboardArtifact.Type(15, "TSK_WEB_SEARCH_QUERY", bundle.getString("BlackboardArtifact.tskWebSearchQuery.text"), Category.DATA_ARTIFACT);
1114
1118 public static final Type TSK_METADATA_EXIF = new BlackboardArtifact.Type(16, "TSK_METADATA_EXIF", bundle.getString("BlackboardArtifact.tskMetadataExif.text"), Category.ANALYSIS_RESULT);
1119
1120 // 17 was used for deprecated TSK_TAG_FILE.
1121 // 18 was used for deprecated TSK_TAG_ARTIFACT.
1125 public static final Type TSK_OS_INFO = new BlackboardArtifact.Type(19, "TSK_OS_INFO", bundle.getString("BlackboardArtifact.tskOsInfo.text"), Category.DATA_ARTIFACT);
1126
1127 // 20 was used for deprecated TSK_OS_ACCOUNT.
1131 public static final Type TSK_SERVICE_ACCOUNT = new BlackboardArtifact.Type(21, "TSK_SERVICE_ACCOUNT", bundle.getString("BlackboardArtifact.tskServiceAccount.text"), Category.DATA_ARTIFACT);
1132
1133 // 22 was used for deprecated TSK_TOOL_OUTPUT.
1140 public static final Type TSK_CONTACT = new BlackboardArtifact.Type(23, "TSK_CONTACT", bundle.getString("BlackboardArtifact.tskContact.text"), Category.DATA_ARTIFACT);
1141
1148 public static final Type TSK_MESSAGE = new BlackboardArtifact.Type(24, "TSK_MESSAGE", bundle.getString("BlackboardArtifact.tskMessage.text"), Category.DATA_ARTIFACT);
1149
1156 public static final Type TSK_CALLLOG = new BlackboardArtifact.Type(25, "TSK_CALLLOG", bundle.getString("BlackboardArtifact.tskCalllog.text"), Category.DATA_ARTIFACT);
1157
1161 public static final Type TSK_CALENDAR_ENTRY = new BlackboardArtifact.Type(26, "TSK_CALENDAR_ENTRY", bundle.getString("BlackboardArtifact.tskCalendarEntry.text"), Category.DATA_ARTIFACT);
1162
1166 public static final Type TSK_SPEED_DIAL_ENTRY = new BlackboardArtifact.Type(27, "TSK_SPEED_DIAL_ENTRY", bundle.getString("BlackboardArtifact.tskSpeedDialEntry.text"), Category.DATA_ARTIFACT);
1167
1171 public static final Type TSK_BLUETOOTH_PAIRING = new BlackboardArtifact.Type(28, "TSK_BLUETOOTH_PAIRING", bundle.getString("BlackboardArtifact.tskBluetoothPairing.text"), Category.DATA_ARTIFACT);
1172
1176 public static final Type TSK_GPS_BOOKMARK = new BlackboardArtifact.Type(29, "TSK_GPS_BOOKMARK", bundle.getString("BlackboardArtifact.tskGpsBookmark.text"), Category.DATA_ARTIFACT);
1177
1181 public static final Type TSK_GPS_LAST_KNOWN_LOCATION = new BlackboardArtifact.Type(30, "TSK_GPS_LAST_KNOWN_LOCATION", bundle.getString("BlackboardArtifact.tskGpsLastKnownLocation.text"), Category.DATA_ARTIFACT);
1182
1186 public static final Type TSK_GPS_SEARCH = new BlackboardArtifact.Type(31, "TSK_GPS_SEARCH", bundle.getString("BlackboardArtifact.tskGpsSearch.text"), Category.DATA_ARTIFACT);
1187
1191 public static final Type TSK_PROG_RUN = new BlackboardArtifact.Type(32, "TSK_PROG_RUN", bundle.getString("BlackboardArtifact.tskProgRun.text"), Category.DATA_ARTIFACT);
1192
1196 public static final Type TSK_ENCRYPTION_DETECTED = new BlackboardArtifact.Type(33, "TSK_ENCRYPTION_DETECTED", bundle.getString("BlackboardArtifact.tskEncryptionDetected.text"), Category.ANALYSIS_RESULT);
1197
1201 public static final Type TSK_EXT_MISMATCH_DETECTED = new BlackboardArtifact.Type(34, "TSK_EXT_MISMATCH_DETECTED", bundle.getString("BlackboardArtifact.tskExtMismatchDetected.text"), Category.ANALYSIS_RESULT);
1202
1209 @Deprecated
1210 public static final Type TSK_INTERESTING_ARTIFACT_HIT = new BlackboardArtifact.Type(35, "TSK_INTERESTING_ARTIFACT_HIT", bundle.getString("BlackboardArtifact.tskInterestingArtifactHit.text"), Category.ANALYSIS_RESULT);
1211
1217 public static final Type TSK_GPS_ROUTE = new BlackboardArtifact.Type(36, "TSK_GPS_ROUTE", bundle.getString("BlackboardArtifact.tskGpsRoute.text"), Category.DATA_ARTIFACT);
1218
1222 public static final Type TSK_REMOTE_DRIVE = new BlackboardArtifact.Type(37, "TSK_REMOTE_DRIVE", bundle.getString("BlackboardArtifact.tskRemoteDrive.text"), Category.DATA_ARTIFACT);
1223
1227 public static final Type TSK_FACE_DETECTED = new BlackboardArtifact.Type(38, "TSK_FACE_DETECTED", bundle.getString("BlackboardArtifact.tskFaceDetected.text"), Category.ANALYSIS_RESULT);
1228
1232 public static final Type TSK_ACCOUNT = new BlackboardArtifact.Type(39, "TSK_ACCOUNT", bundle.getString("BlackboardArtifact.tskAccount.text"), Category.DATA_ARTIFACT);
1233
1237 public static final Type TSK_ENCRYPTION_SUSPECTED = new BlackboardArtifact.Type(40, "TSK_ENCRYPTION_SUSPECTED", bundle.getString("BlackboardArtifact.tskEncryptionSuspected.text"), Category.ANALYSIS_RESULT);
1238
1239 /*
1240 * A classifier detected an object in a media file.
1241 */
1242 public static final Type TSK_OBJECT_DETECTED = new BlackboardArtifact.Type(41, "TSK_OBJECT_DETECTED", bundle.getString("BlackboardArtifact.tskObjectDetected.text"), Category.ANALYSIS_RESULT);
1243
1247 public static final Type TSK_WIFI_NETWORK = new BlackboardArtifact.Type(42, "TSK_WIFI_NETWORK", bundle.getString("BlackboardArtifact.tskWIFINetwork.text"), Category.DATA_ARTIFACT);
1248
1252 public static final Type TSK_DEVICE_INFO = new BlackboardArtifact.Type(43, "TSK_DEVICE_INFO", bundle.getString("BlackboardArtifact.tskDeviceInfo.text"), Category.DATA_ARTIFACT);
1253
1257 public static final Type TSK_SIM_ATTACHED = new BlackboardArtifact.Type(44, "TSK_SIM_ATTACHED", bundle.getString("BlackboardArtifact.tskSimAttached.text"), Category.DATA_ARTIFACT);
1258
1262 public static final Type TSK_BLUETOOTH_ADAPTER = new BlackboardArtifact.Type(45, "TSK_BLUETOOTH_ADAPTER", bundle.getString("BlackboardArtifact.tskBluetoothAdapter.text"), Category.DATA_ARTIFACT);
1263
1267 public static final Type TSK_WIFI_NETWORK_ADAPTER = new BlackboardArtifact.Type(46, "TSK_WIFI_NETWORK_ADAPTER", bundle.getString("BlackboardArtifact.tskWIFINetworkAdapter.text"), Category.DATA_ARTIFACT);
1268
1272 public static final Type TSK_VERIFICATION_FAILED = new BlackboardArtifact.Type(47, "TSK_VERIFICATION_FAILED", bundle.getString("BlackboardArtifact.tskVerificationFailed.text"), Category.ANALYSIS_RESULT);
1273
1277 public static final Type TSK_DATA_SOURCE_USAGE = new BlackboardArtifact.Type(48, "TSK_DATA_SOURCE_USAGE", bundle.getString("BlackboardArtifact.tskDataSourceUsage.text"), Category.ANALYSIS_RESULT);
1278
1284 public static final Type TSK_WEB_FORM_AUTOFILL = new BlackboardArtifact.Type(49, "TSK_WEB_FORM_AUTOFILL", bundle.getString("BlackboardArtifact.tskWebFormAutofill.text"), Category.DATA_ARTIFACT);
1285
1291 public static final Type TSK_WEB_FORM_ADDRESS = new BlackboardArtifact.Type(50, "TSK_WEB_FORM_ADDRESSES ", bundle.getString("BlackboardArtifact.tskWebFormAddresses.text"), Category.DATA_ARTIFACT);
1292
1293 // 51 was used for deprecated TSK_DOWNLOAD_SOURCE
1297 public static final Type TSK_WEB_CACHE = new BlackboardArtifact.Type(52, "TSK_WEB_CACHE", bundle.getString("BlackboardArtifact.tskWebCache.text"), Category.DATA_ARTIFACT);
1298
1302 public static final Type TSK_TL_EVENT = new BlackboardArtifact.Type(53, "TSK_TL_EVENT", bundle.getString("BlackboardArtifact.tskTLEvent.text"), Category.DATA_ARTIFACT);
1303
1307 public static final Type TSK_CLIPBOARD_CONTENT = new BlackboardArtifact.Type(54, "TSK_CLIPBOARD_CONTENT", bundle.getString("BlackboardArtifact.tskClipboardContent.text"), Category.DATA_ARTIFACT);
1308
1312 public static final Type TSK_ASSOCIATED_OBJECT = new BlackboardArtifact.Type(55, "TSK_ASSOCIATED_OBJECT", bundle.getString("BlackboardArtifact.tskAssociatedObject.text"), Category.DATA_ARTIFACT);
1313
1317 public static final Type TSK_USER_CONTENT_SUSPECTED = new BlackboardArtifact.Type(56, "TSK_USER_CONTENT_SUSPECTED", bundle.getString("BlackboardArtifact.tskUserContentSuspected.text"), Category.ANALYSIS_RESULT);
1318
1322 public static final Type TSK_METADATA = new BlackboardArtifact.Type(57, "TSK_METADATA", bundle.getString("BlackboardArtifact.tskMetadata.text"), Category.DATA_ARTIFACT);
1323
1329 public static final Type TSK_GPS_TRACK = new BlackboardArtifact.Type(58, "TSK_GPS_TRACK", bundle.getString("BlackboardArtifact.tskTrack.text"), Category.DATA_ARTIFACT);
1330
1334 public static final Type TSK_WEB_ACCOUNT_TYPE = new BlackboardArtifact.Type(59, "TSK_WEB_ACCOUNT_TYPE", bundle.getString("BlackboardArtifact.tskWebAccountType.text"), Category.ANALYSIS_RESULT);
1335
1339 public static final Type TSK_SCREEN_SHOTS = new BlackboardArtifact.Type(60, "TSK_SCREEN_SHOTS", bundle.getString("BlackboardArtifact.tskScreenShots.text"), Category.DATA_ARTIFACT);
1340
1344 public static final Type TSK_PROG_NOTIFICATIONS = new BlackboardArtifact.Type(62, "TSK_PROG_NOTIFICATIONS", bundle.getString("BlackboardArtifact.tskProgNotifications.text"), Category.DATA_ARTIFACT);
1345
1349 public static final Type TSK_BACKUP_EVENT = new BlackboardArtifact.Type(63, "TSK_BACKUP_EVENT", bundle.getString("BlackboardArtifact.tskBackupEvent.text"), Category.DATA_ARTIFACT);
1350
1354 public static final Type TSK_DELETED_PROG = new BlackboardArtifact.Type(64, "TSK_DELETED_PROG", bundle.getString("BlackboardArtifact.tskDeletedProg.text"), Category.DATA_ARTIFACT);
1355
1359 public static final Type TSK_USER_DEVICE_EVENT = new BlackboardArtifact.Type(65, "TSK_USER_DEVICE_EVENT", bundle.getString("BlackboardArtifact.tskUserDeviceEvent.text"), Category.DATA_ARTIFACT);
1360
1364 public static final Type TSK_YARA_HIT = new BlackboardArtifact.Type(66, "TSK_YARA_HIT", bundle.getString("BlackboardArtifact.tskYaraHit.text"), Category.ANALYSIS_RESULT);
1365
1369 public static final Type TSK_GPS_AREA = new BlackboardArtifact.Type(67, "TSK_GPS_AREA", bundle.getString("BlackboardArtifact.tskGPSArea.text"), Category.DATA_ARTIFACT);
1370
1374 public static final Type TSK_WEB_CATEGORIZATION = new BlackboardArtifact.Type(68, "TSK_WEB_CATEGORIZATION", bundle.getString("BlackboardArtifact.tskWebCategorization.text"), Category.ANALYSIS_RESULT);
1375
1380 public static final Type TSK_PREVIOUSLY_SEEN = new BlackboardArtifact.Type(69, "TSK_PREVIOUSLY_SEEN", bundle.getString("BlackboardArtifact.tskPreviouslySeen.text"), Category.ANALYSIS_RESULT);
1381
1386 public static final Type TSK_PREVIOUSLY_UNSEEN = new BlackboardArtifact.Type(70, "TSK_PREVIOUSLY_UNSEEN", bundle.getString("BlackboardArtifact.tskPreviouslyUnseen.text"), Category.ANALYSIS_RESULT);
1387
1392 public static final Type TSK_PREVIOUSLY_NOTABLE = new BlackboardArtifact.Type(71, "TSK_PREVIOUSLY_NOTABLE", bundle.getString("BlackboardArtifact.tskPreviouslyNotable.text"), Category.ANALYSIS_RESULT);
1393
1398 public static final Type TSK_INTERESTING_ITEM = new BlackboardArtifact.Type(72, "TSK_INTERESTING_ITEM", bundle.getString("BlackboardArtifact.tskInterestingItem.text"), Category.ANALYSIS_RESULT);
1399
1403 public static final Type TSK_MALWARE = new BlackboardArtifact.Type(73, "TSK_MALWARE", bundle.getString("BlackboardArtifact.tskMalware.text"), Category.ANALYSIS_RESULT);
1404 /*
1405 * IMPORTANT!
1406 *
1407 * Until BlackboardArtifact.ARTIFACT_TYPE is deprecated and/or removed,
1408 * new standard artifact types need to be added to both
1409 * BlackboardArtifact.ARTIFACT_TYPE and
1410 * BlackboardArtifact.Type.STANDARD_TYPES.
1411 *
1412 * Also, ensure that new types have a one line JavaDoc description and
1413 * are added to the standard artifacts catalog (artifact_catalog.dox).
1414 *
1415 */
1416
1420 static final Map<Integer, Type> STANDARD_TYPES = Collections.unmodifiableMap(Stream.of(
1485 ).collect(Collectors.toMap(type -> type.getTypeID(), type -> type)));
1486
1487 private final String typeName;
1488 private final int typeID;
1489 private final String displayName;
1490 private final Category category;
1491
1500 Type(int typeID, String typeName, String displayName, Category category) {
1501 this.typeID = typeID;
1502 this.typeName = typeName;
1503 this.displayName = displayName;
1504 this.category = category;
1505 }
1506
1512 public Type(ARTIFACT_TYPE type) {
1513 this(type.getTypeID(), type.getLabel(), type.getDisplayName(), type.getCategory());
1514 }
1515
1521 public String getTypeName() {
1522 return this.typeName;
1523 }
1524
1530 public int getTypeID() {
1531 return this.typeID;
1532 }
1533
1539 public String getDisplayName() {
1540 return this.displayName;
1541 }
1542
1549 return category;
1550 }
1551
1559 @Override
1560 public boolean equals(Object that) {
1561 if (this == that) {
1562 return true;
1563 } else if (!(that instanceof Type)) {
1564 return false;
1565 } else {
1566 return ((Type) that).sameType(this);
1567 }
1568 }
1569
1577 private boolean sameType(Type that) {
1578 return this.typeName.equals(that.getTypeName())
1579 && this.displayName.equals(that.getDisplayName())
1580 && this.typeID == that.getTypeID();
1581 }
1582
1588 @Override
1589 public int hashCode() {
1590 int hash = 11;
1591 hash = 83 * hash + Objects.hashCode(this.typeID);
1592 hash = 83 * hash + Objects.hashCode(this.displayName);
1593 hash = 83 * hash + Objects.hashCode(this.typeName);
1594 return hash;
1595 }
1596 }
1597
1603 public enum ARTIFACT_TYPE implements SleuthkitVisitableItem {
1604
1608 TSK_GEN_INFO(1, "TSK_GEN_INFO", //NON-NLS
1609 bundle.getString("BlackboardArtifact.tskGenInfo.text"), Category.DATA_ARTIFACT),
1615 TSK_WEB_BOOKMARK(2, "TSK_WEB_BOOKMARK", //NON-NLS
1616 bundle.getString("BlackboardArtifact.tskWebBookmark.text"), Category.DATA_ARTIFACT),
1622 TSK_WEB_COOKIE(3, "TSK_WEB_COOKIE",
1623 bundle.getString("BlackboardArtifact.tskWebCookie.text"), Category.DATA_ARTIFACT), //NON-NLS
1629 TSK_WEB_HISTORY(4, "TSK_WEB_HISTORY", //NON-NLS
1630 bundle.getString("BlackboardArtifact.tskWebHistory.text"), Category.DATA_ARTIFACT),
1636 TSK_WEB_DOWNLOAD(5, "TSK_WEB_DOWNLOAD", //NON-NLS
1637 bundle.getString("BlackboardArtifact.tskWebDownload.text"), Category.DATA_ARTIFACT),
1641 TSK_RECENT_OBJECT(6, "TSK_RECENT_OBJ", //NON-NLS
1642 bundle.getString("BlackboardArtifact.tsk.recentObject.text"), Category.DATA_ARTIFACT),
1648 @Deprecated
1649 TSK_GPS_TRACKPOINT(7, "TSK_GPS_TRACKPOINT", //NON-NLS
1650 bundle.getString("BlackboardArtifact.tskGpsTrackpoint.text"), Category.DATA_ARTIFACT),
1654 TSK_INSTALLED_PROG(8, "TSK_INSTALLED_PROG", //NON-NLS
1655 bundle.getString("BlackboardArtifact.tskInstalledProg.text"), Category.DATA_ARTIFACT),
1659 TSK_KEYWORD_HIT(9, "TSK_KEYWORD_HIT",
1660 bundle.getString("BlackboardArtifact.tskKeywordHits.text"), Category.ANALYSIS_RESULT),
1664 TSK_HASHSET_HIT(10, "TSK_HASHSET_HIT", //NON-NLS
1665 bundle.getString("BlackboardArtifact.tskHashsetHit.text"), Category.ANALYSIS_RESULT),
1669 TSK_DEVICE_ATTACHED(11, "TSK_DEVICE_ATTACHED", //NON-NLS
1670 bundle.getString("BlackboardArtifact.tskDeviceAttached.text"), Category.DATA_ARTIFACT),
1677 @Deprecated
1678 TSK_INTERESTING_FILE_HIT(12, "TSK_INTERESTING_FILE_HIT", //NON-NLS
1679 bundle.getString("BlackboardArtifact.tskInterestingFileHit.text"), Category.ANALYSIS_RESULT),
1683 TSK_EMAIL_MSG(13, "TSK_EMAIL_MSG", //NON-NLS
1684 bundle.getString("BlackboardArtifact.tskEmailMsg.text"), Category.DATA_ARTIFACT),
1688 TSK_EXTRACTED_TEXT(14, "TSK_EXTRACTED_TEXT", //NON-NLS
1689 bundle.getString("BlackboardArtifact.tskExtractedText.text"), Category.DATA_ARTIFACT),
1693 TSK_WEB_SEARCH_QUERY(15, "TSK_WEB_SEARCH_QUERY", //NON-NLS
1694 bundle.getString("BlackboardArtifact.tskWebSearchQuery.text"), Category.DATA_ARTIFACT),
1698 TSK_METADATA_EXIF(16, "TSK_METADATA_EXIF", //NON-NLS
1699 bundle.getString("BlackboardArtifact.tskMetadataExif.text"), Category.ANALYSIS_RESULT),
1705 @Deprecated
1706 TSK_TAG_FILE(17, "TSK_TAG_FILE", //NON-NLS
1707 bundle.getString("BlackboardArtifact.tagFile.text"), Category.ANALYSIS_RESULT),
1713 @Deprecated
1714 TSK_TAG_ARTIFACT(18, "TSK_TAG_ARTIFACT", //NON-NLS
1715 bundle.getString("BlackboardArtifact.tskTagArtifact.text"), Category.ANALYSIS_RESULT),
1719 TSK_OS_INFO(19, "TSK_OS_INFO", //NON-NLS
1720 bundle.getString("BlackboardArtifact.tskOsInfo.text"), Category.DATA_ARTIFACT),
1724 @Deprecated
1725 TSK_OS_ACCOUNT(20, "TSK_OS_ACCOUNT", //NON-NLS
1726 bundle.getString("BlackboardArtifact.tskOsAccount.text"), Category.DATA_ARTIFACT),
1730 TSK_SERVICE_ACCOUNT(21, "TSK_SERVICE_ACCOUNT", //NON-NLS
1731 bundle.getString("BlackboardArtifact.tskServiceAccount.text"), Category.DATA_ARTIFACT),
1737 @Deprecated
1738 TSK_TOOL_OUTPUT(22, "TSK_TOOL_OUTPUT", //NON-NLS
1739 bundle.getString("BlackboardArtifact.tskToolOutput.text"), Category.DATA_ARTIFACT),
1746 TSK_CONTACT(23, "TSK_CONTACT", //NON-NLS
1747 bundle.getString("BlackboardArtifact.tskContact.text"), Category.DATA_ARTIFACT),
1754 TSK_MESSAGE(24, "TSK_MESSAGE", //NON-NLS
1755 bundle.getString("BlackboardArtifact.tskMessage.text"), Category.DATA_ARTIFACT),
1762 TSK_CALLLOG(25, "TSK_CALLLOG", //NON-NLS
1763 bundle.getString("BlackboardArtifact.tskCalllog.text"), Category.DATA_ARTIFACT),
1767 TSK_CALENDAR_ENTRY(26, "TSK_CALENDAR_ENTRY", //NON-NLS
1768 bundle.getString("BlackboardArtifact.tskCalendarEntry.text"), Category.DATA_ARTIFACT),
1772 TSK_SPEED_DIAL_ENTRY(27, "TSK_SPEED_DIAL_ENTRY", //NON-NLS
1773 bundle.getString("BlackboardArtifact.tskSpeedDialEntry.text"), Category.DATA_ARTIFACT),
1777 TSK_BLUETOOTH_PAIRING(28, "TSK_BLUETOOTH_PAIRING", //NON-NLS
1778 bundle.getString("BlackboardArtifact.tskBluetoothPairing.text"), Category.DATA_ARTIFACT),
1782 TSK_GPS_BOOKMARK(29, "TSK_GPS_BOOKMARK", //NON-NLS
1783 bundle.getString("BlackboardArtifact.tskGpsBookmark.text"), Category.DATA_ARTIFACT),
1787 TSK_GPS_LAST_KNOWN_LOCATION(30, "TSK_GPS_LAST_KNOWN_LOCATION", //NON-NLS
1788 bundle.getString("BlackboardArtifact.tskGpsLastKnownLocation.text"), Category.DATA_ARTIFACT),
1792 TSK_GPS_SEARCH(31, "TSK_GPS_SEARCH", //NON-NLS
1793 bundle.getString("BlackboardArtifact.tskGpsSearch.text"), Category.DATA_ARTIFACT),
1797 TSK_PROG_RUN(32, "TSK_PROG_RUN", //NON-NLS
1798 bundle.getString("BlackboardArtifact.tskProgRun.text"), Category.DATA_ARTIFACT),
1802 TSK_ENCRYPTION_DETECTED(33, "TSK_ENCRYPTION_DETECTED", //NON-NLS
1803 bundle.getString("BlackboardArtifact.tskEncryptionDetected.text"), Category.ANALYSIS_RESULT),
1807 TSK_EXT_MISMATCH_DETECTED(34, "TSK_EXT_MISMATCH_DETECTED", //NON-NLS
1808 bundle.getString("BlackboardArtifact.tskExtMismatchDetected.text"), Category.ANALYSIS_RESULT),
1815 @Deprecated
1816 TSK_INTERESTING_ARTIFACT_HIT(35, "TSK_INTERESTING_ARTIFACT_HIT", //NON-NLS
1817 bundle.getString("BlackboardArtifact.tskInterestingArtifactHit.text"), Category.ANALYSIS_RESULT),
1823 TSK_GPS_ROUTE(36, "TSK_GPS_ROUTE", //NON-NLS
1824 bundle.getString("BlackboardArtifact.tskGpsRoute.text"), Category.DATA_ARTIFACT),
1828 TSK_REMOTE_DRIVE(37, "TSK_REMOTE_DRIVE", //NON-NLS
1829 bundle.getString("BlackboardArtifact.tskRemoteDrive.text"), Category.DATA_ARTIFACT),
1833 TSK_FACE_DETECTED(38, "TSK_FACE_DETECTED", //NON-NLS
1834 bundle.getString("BlackboardArtifact.tskFaceDetected.text"), Category.ANALYSIS_RESULT),
1838 TSK_ACCOUNT(39, "TSK_ACCOUNT", //NON-NLS
1839 bundle.getString("BlackboardArtifact.tskAccount.text"), Category.DATA_ARTIFACT),
1843 TSK_ENCRYPTION_SUSPECTED(40, "TSK_ENCRYPTION_SUSPECTED", //NON-NLS
1844 bundle.getString("BlackboardArtifact.tskEncryptionSuspected.text"), Category.ANALYSIS_RESULT),
1845 /*
1846 * A classifier detected an object in a media file.
1847 */
1848 TSK_OBJECT_DETECTED(41, "TSK_OBJECT_DETECTED", //NON-NLS
1849 bundle.getString("BlackboardArtifact.tskObjectDetected.text"), Category.ANALYSIS_RESULT),
1853 TSK_WIFI_NETWORK(42, "TSK_WIFI_NETWORK", //NON-NLS
1854 bundle.getString("BlackboardArtifact.tskWIFINetwork.text"), Category.DATA_ARTIFACT),
1858 TSK_DEVICE_INFO(43, "TSK_DEVICE_INFO", //NON-NLS
1859 bundle.getString("BlackboardArtifact.tskDeviceInfo.text"), Category.DATA_ARTIFACT),
1863 TSK_SIM_ATTACHED(44, "TSK_SIM_ATTACHED", //NON-NLS
1864 bundle.getString("BlackboardArtifact.tskSimAttached.text"), Category.DATA_ARTIFACT),
1868 TSK_BLUETOOTH_ADAPTER(45, "TSK_BLUETOOTH_ADAPTER", //NON-NLS
1869 bundle.getString("BlackboardArtifact.tskBluetoothAdapter.text"), Category.DATA_ARTIFACT),
1873 TSK_WIFI_NETWORK_ADAPTER(46, "TSK_WIFI_NETWORK_ADAPTER", //NON-NLS
1874 bundle.getString("BlackboardArtifact.tskWIFINetworkAdapter.text"), Category.DATA_ARTIFACT),
1878 TSK_VERIFICATION_FAILED(47, "TSK_VERIFICATION_FAILED", //NON-NLS
1879 bundle.getString("BlackboardArtifact.tskVerificationFailed.text"), Category.ANALYSIS_RESULT),
1883 TSK_DATA_SOURCE_USAGE(48, "TSK_DATA_SOURCE_USAGE", //NON-NLS
1884 bundle.getString("BlackboardArtifact.tskDataSourceUsage.text"), Category.ANALYSIS_RESULT),
1890 TSK_WEB_FORM_AUTOFILL(49, "TSK_WEB_FORM_AUTOFILL", //NON-NLS
1891 bundle.getString("BlackboardArtifact.tskWebFormAutofill.text"), Category.DATA_ARTIFACT),
1897 TSK_WEB_FORM_ADDRESS(50, "TSK_WEB_FORM_ADDRESSES ", //NON-NLS
1898 bundle.getString("BlackboardArtifact.tskWebFormAddresses.text"), Category.DATA_ARTIFACT),
1905 @Deprecated
1906 TSK_DOWNLOAD_SOURCE(51, "TSK_DOWNLOAD_SOURCE", //NON-NLS
1907 bundle.getString("BlackboardArtifact.tskDownloadSource.text"), Category.DATA_ARTIFACT),
1911 TSK_WEB_CACHE(52, "TSK_WEB_CACHE", //NON-NLS
1912 bundle.getString("BlackboardArtifact.tskWebCache.text"), Category.DATA_ARTIFACT),
1916 TSK_TL_EVENT(53, "TSK_TL_EVENT", //NON-NLS
1917 bundle.getString("BlackboardArtifact.tskTLEvent.text"), Category.DATA_ARTIFACT),
1921 TSK_CLIPBOARD_CONTENT(54, "TSK_CLIPBOARD_CONTENT", //NON-NLS
1922 bundle.getString("BlackboardArtifact.tskClipboardContent.text"), Category.DATA_ARTIFACT),
1926 TSK_ASSOCIATED_OBJECT(55, "TSK_ASSOCIATED_OBJECT", //NON-NLS
1927 bundle.getString("BlackboardArtifact.tskAssociatedObject.text"), Category.DATA_ARTIFACT),
1931 TSK_USER_CONTENT_SUSPECTED(56, "TSK_USER_CONTENT_SUSPECTED", //NON-NLS
1932 bundle.getString("BlackboardArtifact.tskUserContentSuspected.text"), Category.ANALYSIS_RESULT),
1936 TSK_METADATA(57, "TSK_METADATA", //NON-NLS
1937 bundle.getString("BlackboardArtifact.tskMetadata.text"), Category.DATA_ARTIFACT),
1943 TSK_GPS_TRACK(58, "TSK_GPS_TRACK",
1944 bundle.getString("BlackboardArtifact.tskTrack.text"), Category.DATA_ARTIFACT),
1948 TSK_WEB_ACCOUNT_TYPE(59, "TSK_WEB_ACCOUNT_TYPE",
1949 bundle.getString("BlackboardArtifact.tskWebAccountType.text"), Category.ANALYSIS_RESULT),
1953 TSK_SCREEN_SHOTS(60, "TSK_SCREEN_SHOTS",
1954 bundle.getString("BlackboardArtifact.tskScreenShots.text"), Category.DATA_ARTIFACT),
1958 TSK_PROG_NOTIFICATIONS(62, "TSK_PROG_NOTIFICATIONS",
1959 bundle.getString("BlackboardArtifact.tskProgNotifications.text"), Category.DATA_ARTIFACT),
1963 TSK_BACKUP_EVENT(63, "TSK_BACKUP_EVENT",
1964 bundle.getString("BlackboardArtifact.tskBackupEvent.text"), Category.DATA_ARTIFACT),
1968 TSK_DELETED_PROG(64, "TSK_DELETED_PROG",
1969 bundle.getString("BlackboardArtifact.tskDeletedProg.text"), Category.DATA_ARTIFACT),
1973 TSK_USER_DEVICE_EVENT(65, "TSK_USER_DEVICE_EVENT",
1974 bundle.getString("BlackboardArtifact.tskUserDeviceEvent.text"), Category.DATA_ARTIFACT),
1978 TSK_YARA_HIT(66, "TSK_YARA_HIT",
1979 bundle.getString("BlackboardArtifact.tskYaraHit.text"), Category.ANALYSIS_RESULT),
1983 TSK_GPS_AREA(67, "TSK_GPS_AREA",
1984 bundle.getString("BlackboardArtifact.tskGPSArea.text"), Category.DATA_ARTIFACT),
1985 TSK_WEB_CATEGORIZATION(68, "TSK_WEB_CATEGORIZATION",
1986 bundle.getString("BlackboardArtifact.tskWebCategorization.text"), Category.ANALYSIS_RESULT),
1991 TSK_PREVIOUSLY_SEEN(69, "TSK_PREVIOUSLY_SEEN",
1992 bundle.getString("BlackboardArtifact.tskPreviouslySeen.text"), Category.ANALYSIS_RESULT),
1997 TSK_PREVIOUSLY_UNSEEN(70, "TSK_PREVIOUSLY_UNSEEN",
1998 bundle.getString("BlackboardArtifact.tskPreviouslyUnseen.text"), Category.ANALYSIS_RESULT),
2003 TSK_PREVIOUSLY_NOTABLE(71, "TSK_PREVIOUSLY_NOTABLE",
2004 bundle.getString("BlackboardArtifact.tskPreviouslyNotable.text"), Category.ANALYSIS_RESULT),
2009 TSK_INTERESTING_ITEM(72, "TSK_INTERESTING_ITEM", //NON-NLS
2010 bundle.getString("BlackboardArtifact.tskInterestingItem.text"), Category.ANALYSIS_RESULT),
2014 TSK_MALWARE(73, "TSK_MALWARE", //NON-NLS
2015 bundle.getString("BlackboardArtifact.tskMalware.text"), Category.ANALYSIS_RESULT);
2016 /*
2017 * IMPORTANT!
2018 *
2019 * Until BlackboardArtifact.ARTIFACT_TYPE is deprecated and/or removed,
2020 * new standard artifact types need to be added to both
2021 * BlackboardArtifact.ARTIFACT_TYPE and
2022 * BlackboardArtifact.Type.STANDARD_TYPES.
2023 *
2024 * Also, ensure that new types have a one line JavaDoc description and
2025 * are added to the standard artifacts catalog (artifact_catalog.dox).
2026 */
2027
2028 private final String label;
2029 private final int typeId;
2030 private final String displayName;
2031 private final Category category;
2032
2040 private ARTIFACT_TYPE(int typeId, String label, String displayName) {
2041 this(typeId, label, displayName, Category.DATA_ARTIFACT);
2042 }
2043
2052 private ARTIFACT_TYPE(int typeId, String label, String displayName, Category category) {
2053 this.typeId = typeId;
2054 this.label = label;
2055 this.displayName = displayName;
2056 this.category = category;
2057 }
2058
2064 public int getTypeID() {
2065 return this.typeId;
2066 }
2067
2073 public String getLabel() {
2074 return this.label;
2075 }
2076
2083 return this.category;
2084 }
2085
2094 static public ARTIFACT_TYPE fromLabel(String label) {
2095 for (ARTIFACT_TYPE value : ARTIFACT_TYPE.values()) {
2096 if (value.getLabel().equals(label)) {
2097 return value;
2098 }
2099 }
2100 throw new IllegalArgumentException("No ARTIFACT_TYPE matching type: " + label);
2101 }
2102
2113 static public ARTIFACT_TYPE fromID(int id) {
2114 for (ARTIFACT_TYPE value : ARTIFACT_TYPE.values()) {
2115 if (value.getTypeID() == id) {
2116 return value;
2117 }
2118 }
2119 throw new IllegalArgumentException("No ARTIFACT_TYPE matching type: " + id);
2120 }
2121
2127 public String getDisplayName() {
2128 return displayName;
2129 }
2130
2142 @Override
2143 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
2144 return visitor.visit(this);
2145 }
2146
2147 }
2148
2156 public enum Category {
2157 // NOTE: The schema code defaults to '0', so that code must be updated too if DATA_ARTIFACT changes from being 0
2158 DATA_ARTIFACT(0, "DATA_ARTIFACT", ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle").getString("CategoryType.DataArtifact")), // artifact is data that is directly/indirectly extracted from a data source.
2159 ANALYSIS_RESULT(1, "ANALYSIS_RESULT", ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle").getString("CategoryType.AnalysisResult")); // artifacts represents outcome of analysis of data.
2160
2161 private final Integer id;
2162 private final String name;
2163 private final String displayName;
2164
2165 private final static Map<Integer, Category> idToCategory = new HashMap<Integer, Category>();
2166
2167 static {
2168 for (Category status : values()) {
2169 idToCategory.put(status.getID(), status);
2170 }
2171 }
2172
2180 private Category(Integer id, String name, String displayName) {
2181 this.id = id;
2182 this.name = name;
2183 this.displayName = displayName;
2184 }
2185
2193 public static Category fromID(int id) {
2194 return idToCategory.get(id);
2195 }
2196
2202 public Integer getID() {
2203 return id;
2204 }
2205
2211 String getName() {
2212 return name;
2213 }
2214
2220 public String getDisplayName() {
2221 return displayName;
2222 }
2223 }
2224
2228 public enum ReviewStatus {
2229
2230 APPROVED(1, "APPROVED", "ReviewStatus.Approved"), //approved by human user
2231 REJECTED(2, "REJECTED", "ReviewStatus.Rejected"), //rejected by humna user
2232 UNDECIDED(3, "UNDECIDED", "ReviewStatus.Undecided"); // not yet reviewed by human user
2233
2234 private final Integer id;
2235 private final String name;
2236 private final String displayName;
2237 private final static Map<Integer, ReviewStatus> idToStatus = new HashMap<Integer, ReviewStatus>();
2238
2239 static {
2240 for (ReviewStatus status : values()) {
2241 idToStatus.put(status.getID(), status);
2242 }
2243 }
2244
2253 private ReviewStatus(Integer id, String name, String displayNameKey) {
2254 this.id = id;
2255 this.name = name;
2256 this.displayName = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle").getString(displayNameKey);
2257 }
2258
2266 public static ReviewStatus withID(int id) {
2267 return idToStatus.get(id);
2268 }
2269
2275 public Integer getID() {
2276 return id;
2277 }
2278
2284 String getName() {
2285 return name;
2286 }
2287
2293 public String getDisplayName() {
2294 return displayName;
2295 }
2296 }
2297
2319 @Deprecated
2320 protected BlackboardArtifact(SleuthkitCase sleuthkitCase, long artifactID, long objID, long artifactObjID, long dataSourceObjId, int artifactTypeID, String artifactTypeName, String displayName) {
2321 this(sleuthkitCase, artifactID, objID, artifactObjID, dataSourceObjId, artifactTypeID, artifactTypeName, displayName, ReviewStatus.UNDECIDED);
2322 }
2323
2338 @Deprecated
2339 public List<BlackboardAttribute> getAttributes(final BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException {
2340 if (loadedCacheFromDb == false) {
2341 List<BlackboardAttribute> attrs = getSleuthkitCase().getBlackboardAttributes(this);
2342 attrsCache.clear();
2343 attrsCache.addAll(attrs);
2344 loadedCacheFromDb = true;
2345 }
2346 ArrayList<BlackboardAttribute> filteredAttributes = new ArrayList<BlackboardAttribute>();
2347 for (BlackboardAttribute attr : attrsCache) {
2348 if (attr.getAttributeType().getTypeID() == attributeType.getTypeID()) {
2349 filteredAttributes.add(attr);
2350 }
2351 }
2352 return filteredAttributes;
2353 }
2354
2355 @Override
2356 public long getId() {
2357 return this.artifactObjId;
2358 }
2359
2368 @Override
2369 public List<Long> getChildrenIds() throws TskCoreException {
2370 List<Long> childrenIDs = new ArrayList<Long>();
2371 childrenIDs.addAll(getSleuthkitCase().getAbstractFileChildrenIds(this));
2372 childrenIDs.addAll(getSleuthkitCase().getBlackboardArtifactChildrenIds(this));
2373
2374 return childrenIDs;
2375 }
2376
2377 @Override
2379 if (childrenCount != -1) {
2380 return childrenCount;
2381 }
2382
2383 childrenCount = this.getSleuthkitCase().getContentChildrenCount(this);
2384
2385 hasChildren = childrenCount > 0;
2386 checkedHasChildren = true;
2387
2388 return childrenCount;
2389 }
2390
2391 @Override
2392 public boolean hasChildren() throws TskCoreException {
2393 if (checkedHasChildren == true) {
2394 return hasChildren;
2395 }
2396
2397 childrenCount = this.getSleuthkitCase().getContentChildrenCount(this);
2398
2399 hasChildren = childrenCount > 0;
2400 checkedHasChildren = true;
2401
2402 return hasChildren;
2403 }
2404
2413 @Override
2414 public List<Content> getChildren() throws TskCoreException {
2415 List<Content> children = new ArrayList<>();
2416 children.addAll(getSleuthkitCase().getAbstractFileChildren(this));
2417 children.addAll(getSleuthkitCase().getBlackboardArtifactChildren(this));
2418
2419 return children;
2420 }
2421}
List< BlackboardAttribute > getAttributes(final BlackboardAttribute.ATTRIBUTE_TYPE attributeType)
ArrayList< BlackboardArtifact > getAllArtifacts()
AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactType, Score score, String conclusion, String configuration, String justification, Collection< BlackboardAttribute > attributesList)
ArrayList< BlackboardArtifact > getArtifacts(String artifactTypeName)
ArrayList< BlackboardArtifact > getArtifacts(int artifactTypeID)
void addAttributes(Collection< BlackboardAttribute > attributes)
long getArtifactsCount(BlackboardArtifact.ARTIFACT_TYPE type)
AnalysisResultAdded newAnalysisResult(BlackboardArtifact.Type artifactType, Score score, String conclusion, String configuration, String justification, Collection< BlackboardAttribute > attributesList, long dataSourceId)
DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection< BlackboardAttribute > attributesList)
ArrayList< BlackboardAttribute > getGenInfoAttributes(BlackboardAttribute.ATTRIBUTE_TYPE attr_type)
void addAttributes(Collection< BlackboardAttribute > attributes, final SleuthkitCase.CaseDbTransaction caseDbTransaction)
List< AnalysisResult > getAnalysisResults(BlackboardArtifact.Type artifactType)
final int read(byte[] buf, long offset, long len)
void addAttribute(BlackboardAttribute attribute)
BlackboardArtifact newArtifact(int artifactTypeID)
BlackboardArtifact(SleuthkitCase sleuthkitCase, long artifactID, long objID, long artifactObjID, long dataSourceObjId, int artifactTypeID, String artifactTypeName, String displayName)
BlackboardArtifact newArtifact(BlackboardArtifact.ARTIFACT_TYPE type)
long getArtifactsCount(String artifactTypeName)
BlackboardAttribute getAttribute(BlackboardAttribute.Type attributeType)
DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection< BlackboardAttribute > attributesList, Long osAccountId, long dataSourceId)
DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection< BlackboardAttribute > attributesList, Long osAccountId)
ArrayList< BlackboardArtifact > getArtifacts(BlackboardArtifact.ARTIFACT_TYPE type)
BlackboardArtifact getGenInfoArtifact(boolean create)
BlackboardArtifact.Type getArtifactType(String artTypeName)
ArrayList< BlackboardAttribute > getBlackboardAttributes(final BlackboardArtifact artifact)
ArrayList< BlackboardAttribute > getBlackboardAttributes(final BlackboardArtifact artifact)
void addBlackboardAttribute(BlackboardAttribute attr, int artifactTypeId)
void addBlackboardAttributes(Collection< BlackboardAttribute > attributes, int artifactTypeId)
void setReviewStatus(BlackboardArtifact artifact, BlackboardArtifact.ReviewStatus newStatus)
public< T > T accept(SleuthkitItemVisitor< T > visitor)

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