19 package org.sleuthkit.datamodel;
21 import java.io.Serializable;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.HashMap;
25 import java.util.List;
27 import java.util.Objects;
28 import java.util.ResourceBundle;
38 private static final ResourceBundle
bundle = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle");
43 public static final class Type implements Serializable {
57 public Type(
int typeID, String typeName, String displayName) {
105 }
else if (!(that instanceof
Type)) {
108 return ((Type) that).sameType(
this);
128 hash = 83 * hash + Objects.hashCode(this.typeID);
129 hash = 83 * hash + Objects.hashCode(this.displayName);
130 hash = 83 * hash + Objects.hashCode(this.typeName);
142 TSK_GEN_INFO(1,
"TSK_GEN_INFO",
143 bundle.getString(
"BlackboardArtifact.tskGenInfo.text")),
144 TSK_WEB_BOOKMARK(2,
"TSK_WEB_BOOKMARK",
145 bundle.getString(
"BlackboardArtifact.tskWebBookmark.text")),
146 TSK_WEB_COOKIE(3,
"TSK_WEB_COOKIE",
147 bundle.getString(
"BlackboardArtifact.tskWebCookie.text")),
148 TSK_WEB_HISTORY(4,
"TSK_WEB_HISTORY",
149 bundle.getString(
"BlackboardArtifact.tskWebHistory.text")),
150 TSK_WEB_DOWNLOAD(5,
"TSK_WEB_DOWNLOAD",
151 bundle.getString(
"BlackboardArtifact.tskWebDownload.text")),
152 TSK_RECENT_OBJECT(6,
"TSK_RECENT_OBJ",
153 bundle.getString(
"BlackboardArtifact.tsk.recentObject.text")),
154 TSK_GPS_TRACKPOINT(7,
"TSK_GPS_TRACKPOINT",
155 bundle.getString(
"BlackboardArtifact.tskGpsTrackpoint.text")),
156 TSK_INSTALLED_PROG(8,
"TSK_INSTALLED_PROG",
157 bundle.getString(
"BlackboardArtifact.tskInstalledProg.text")),
158 TSK_KEYWORD_HIT(9,
"TSK_KEYWORD_HIT",
159 bundle.getString(
"BlackboardArtifact.tskKeywordHits.text")),
160 TSK_HASHSET_HIT(10,
"TSK_HASHSET_HIT",
161 bundle.getString(
"BlackboardArtifact.tskHashsetHit.text")),
162 TSK_DEVICE_ATTACHED(11,
"TSK_DEVICE_ATTACHED",
163 bundle.getString(
"BlackboardArtifact.tskDeviceAttached.text")),
164 TSK_INTERESTING_FILE_HIT(12,
"TSK_INTERESTING_FILE_HIT",
165 bundle.getString(
"BlackboardArtifact.tskInterestingFileHit.text")),
166 TSK_EMAIL_MSG(13,
"TSK_EMAIL_MSG",
167 bundle.getString(
"BlackboardArtifact.tskEmailMsg.text")),
168 TSK_EXTRACTED_TEXT(14,
"TSK_EXTRACTED_TEXT",
169 bundle.getString(
"BlackboardArtifact.tskExtractedText.text")),
170 TSK_WEB_SEARCH_QUERY(15,
"TSK_WEB_SEARCH_QUERY",
171 bundle.getString(
"BlackboardArtifact.tskWebSearchQuery.text")),
172 TSK_METADATA_EXIF(16,
"TSK_METADATA_EXIF",
173 bundle.getString(
"BlackboardArtifact.tskMetadataExif.text")),
176 TSK_TAG_FILE(17,
"TSK_TAG_FILE",
177 bundle.getString(
"BlackboardArtifact.tagFile.text")),
180 TSK_TAG_ARTIFACT(18,
"TSK_TAG_ARTIFACT",
181 bundle.getString(
"BlackboardArtifact.tskTagArtifact.text")),
182 TSK_OS_INFO(19,
"TSK_OS_INFO",
183 bundle.getString(
"BlackboardArtifact.tskOsInfo.text")),
184 TSK_OS_ACCOUNT(20,
"TSK_OS_ACCOUNT",
185 bundle.getString(
"BlackboardArtifact.tskOsAccount.text")),
186 TSK_SERVICE_ACCOUNT(21,
"TSK_SERVICE_ACCOUNT",
187 bundle.getString(
"BlackboardArtifact.tskServiceAccount.text")),
190 TSK_TOOL_OUTPUT(22,
"TSK_TOOL_OUTPUT",
191 bundle.getString(
"BlackboardArtifact.tskToolOutput.text")),
192 TSK_CONTACT(23,
"TSK_CONTACT",
193 bundle.getString(
"BlackboardArtifact.tskContact.text")),
194 TSK_MESSAGE(24,
"TSK_MESSAGE",
195 bundle.getString(
"BlackboardArtifact.tskMessage.text")),
196 TSK_CALLLOG(25,
"TSK_CALLLOG",
197 bundle.getString(
"BlackboardArtifact.tskCalllog.text")),
198 TSK_CALENDAR_ENTRY(26,
"TSK_CALENDAR_ENTRY",
199 bundle.getString(
"BlackboardArtifact.tskCalendarEntry.text")),
200 TSK_SPEED_DIAL_ENTRY(27,
"TSK_SPEED_DIAL_ENTRY",
201 bundle.getString(
"BlackboardArtifact.tskSpeedDialEntry.text")),
202 TSK_BLUETOOTH_PAIRING(28,
"TSK_BLUETOOTH_PAIRING",
203 bundle.getString(
"BlackboardArtifact.tskBluetoothPairing.text")),
204 TSK_GPS_BOOKMARK(29,
"TSK_GPS_BOOKMARK",
205 bundle.getString(
"BlackboardArtifact.tskGpsBookmark.text")),
206 TSK_GPS_LAST_KNOWN_LOCATION(30,
"TSK_GPS_LAST_KNOWN_LOCATION",
207 bundle.getString(
"BlackboardArtifact.tskGpsLastKnownLocation.text")),
208 TSK_GPS_SEARCH(31,
"TSK_GPS_SEARCH",
209 bundle.getString(
"BlackboardArtifact.tskGpsSearch.text")),
210 TSK_PROG_RUN(32,
"TSK_PROG_RUN",
211 bundle.getString(
"BlackboardArtifact.tskProgRun.text")),
212 TSK_ENCRYPTION_DETECTED(33,
"TSK_ENCRYPTION_DETECTED",
213 bundle.getString(
"BlackboardArtifact.tskEncryptionDetected.text")),
214 TSK_EXT_MISMATCH_DETECTED(34,
"TSK_EXT_MISMATCH_DETECTED",
215 bundle.getString(
"BlackboardArtifact.tskExtMismatchDetected.text")),
216 TSK_INTERESTING_ARTIFACT_HIT(35,
"TSK_INTERESTING_ARTIFACT_HIT",
217 bundle.getString(
"BlackboardArtifact.tskInterestingArtifactHit.text")),
218 TSK_GPS_ROUTE(36,
"TSK_GPS_ROUTE",
219 bundle.getString(
"BlackboardArtifact.tskGpsRoute.text")),
220 TSK_REMOTE_DRIVE(37,
"TSK_REMOTE_DRIVE",
221 bundle.getString(
"BlackboardArtifact.tskRemoteDrive.text")),
222 TSK_FACE_DETECTED(38,
"TSK_FACE_DETECTED",
223 bundle.getString(
"BlackboardArtifact.tskFaceDetected.text")),
224 TSK_ACCOUNT(39,
"TSK_ACCOUNT",
225 bundle.getString(
"BlackboardArtifact.tskAccount.text"));
235 this.typeID = typeID;
268 if (v.label.equals(label)) {
272 throw new IllegalArgumentException(
"No ARTIFACT_TYPE matching type: " + label);
284 if (v.typeID == ID) {
288 throw new IllegalArgumentException(
"No ARTIFACT_TYPE matching type: " + ID);
302 return v.
visit(
this);
312 private final List<BlackboardAttribute>
attrsCache =
new ArrayList<BlackboardAttribute>();
350 BlackboardArtifact(
SleuthkitCase sleuthkitCase,
long artifactID,
long objID,
int artifactTypeID, String artifactTypeName, String displayName, ReviewStatus reviewStatus,
boolean isNew) {
354 this.loadedCacheFromDb =
true;
416 attr.setArtifactId(artifactID);
417 attr.setCaseDatabase(sleuthkitCase);
419 attrsCache.add(attr);
432 if (attributes.isEmpty()) {
437 attr.setArtifactId(artifactID);
438 attr.setCaseDatabase(sleuthkitCase);
441 attrsCache.addAll(attributes);
453 if (loadedCacheFromDb ==
false) {
456 attrsCache.addAll(attrs);
457 loadedCacheFromDb =
true;
477 if (loadedCacheFromDb ==
false) {
480 attrsCache.addAll(attrs);
481 loadedCacheFromDb =
true;
483 ArrayList<BlackboardAttribute> filteredAttributes =
new ArrayList<BlackboardAttribute>();
485 if (attr.getAttributeType().getTypeID() == attributeType.getTypeID()) {
486 filteredAttributes.add(attr);
489 return filteredAttributes;
506 if (attribute.getAttributeType().equals(attributeType)) {
524 return v.
visit(
this);
541 if (getClass() != obj.getClass()) {
554 hash = 41 * hash + (int) (this.artifactID ^ (this.artifactID >>> 32));
560 return "BlackboardArtifact{" +
"artifactID=" + artifactID +
", objID=" + objID +
", artifactTypeID=" + artifactTypeID +
", artifactTypeName=" + artifactTypeName +
", displayName=" + displayName +
", Case=" + sleuthkitCase +
'}';
572 private final Integer
id;
576 private final static Map<Integer, ReviewStatus> idToStatus =
new HashMap<Integer, ReviewStatus>();
580 idToStatus.put(status.getID(), status);
587 this.displayName = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle").getString(displayNameKey);
598 return idToStatus.get(
id);
final SleuthkitCase sleuthkitCase
ArrayList< BlackboardAttribute > getBlackboardAttributes(final BlackboardArtifact artifact)
static final ResourceBundle bundle
static ARTIFACT_TYPE fromLabel(String label)
void addBlackboardAttributes(Collection< BlackboardAttribute > attributes, int artifactTypeId)
Type(int typeID, String typeName, String displayName)
String getArtifactTypeName()
void addAttributes(Collection< BlackboardAttribute > attributes)
void addBlackboardAttribute(BlackboardAttribute attr, int artifactTypeId)
public< T > T accept(SleuthkitItemVisitor< T > v)
static ARTIFACT_TYPE fromID(int ID)
List< BlackboardAttribute > getAttributes(final BlackboardAttribute.ATTRIBUTE_TYPE attributeType)
boolean equals(Object obj)
SleuthkitCase getSleuthkitCase()
ReviewStatus getReviewStatus()
boolean sameType(Type that)
void addAttribute(BlackboardAttribute attr)
BlackboardAttribute getAttribute(BlackboardAttribute.Type attributeType)
ReviewStatus(Integer id, String name, String displayNameKey)
BlackboardArtifact(SleuthkitCase sleuthkitCase, long artifactID, long objID, int artifactTypeID, String artifactTypeName, String displayName)
final String artifactTypeName
final List< BlackboardAttribute > attrsCache
List< BlackboardAttribute > getAttributes()
boolean equals(Object that)
boolean loadedCacheFromDb
static final long serialVersionUID
final ReviewStatus reviewStatus
ARTIFACT_TYPE(int typeID, String label, String displayName)
static ReviewStatus withID(int id)