Sleuth Kit Java Bindings (JNI)  4.2
Java bindings for using The Sleuth Kit
BlackboardAttribute.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2012-2014 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;
20 
21 import java.util.ResourceBundle;
22 
30 public class BlackboardAttribute {
31 
32  private long artifactID;
33  private int attributeTypeID;
34  private String moduleName;
35  private String context;
37  private int valueInt;
38  private long valueLong;
39  private double valueDouble;
40  private String valueString;
41  private byte[] valueBytes;
43  private static ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle");
44 
49 
50  STRING(0, "String"),
51  INTEGER(1, "Integer"),
52  LONG(2, "Long"),
53  DOUBLE(3, "Double"),
54  BYTE(4, "Byte");
55  private long type;
56  private String label;
57 
58  private TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE(long type, String label) {
59  this.type = type;
60  this.label = label;
61  }
62 
66  public long getType() {
67  return type;
68  }
69 
73  public String getLabel() {
74  return this.label;
75  }
76 
84  static public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE fromType(long type) {
86  if (v.type == type) {
87  return v;
88  }
89  }
90  throw new IllegalArgumentException("No TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE matching type: " + type);
91  }
92  }
93 
100  public enum ATTRIBUTE_TYPE {
101  /*
102  * It is very important that this list be kept up to date and in sync
103  * with the C++ code. Do not add anything here unless you also add it
104  * there. See framework/Services/TskBlackboard.*
105  */
106 
107  TSK_URL(1, "TSK_URL", //NON-NLS
108  bundle.getString("BlackboardAttribute.tskUrl.text")),
109  TSK_DATETIME(2, "TSK_DATETIME", //NON-NLS
110  bundle.getString("BlackboardAttribute.tskDatetime.text")),
111  TSK_NAME(3, "TSK_NAME", //NON-NLS
112  bundle.getString("BlackboardAttribute.tskName.text")),
113  TSK_PROG_NAME(4, "TSK_PROG_NAME", //NON-NLS
114  bundle.getString("BlackboardAttribute.tskProgName.text")),
115  TSK_VALUE(6, "TSK_VALUE", //NON-NLS
116  bundle.getString("BlackboardAttribute.tskValue.text")),
117  TSK_FLAG(7, "TSK_FLAG", //NON-NLS
118  bundle.getString("BlackboardAttribute.tskFlag.text")),
119  TSK_PATH(8, "TSK_PATH", //NON-NLS
120  bundle.getString("BlackboardAttribute.tskPath.text")),
121  TSK_KEYWORD(10, "TSK_KEYWORD", //NON-NLS
122  bundle.getString("BlackboardAttribute.tskKeyword.text")),
123  TSK_KEYWORD_REGEXP(11, "TSK_KEYWORD_REGEXP", //NON-NLS
124  bundle.getString("BlackboardAttribute.tskKeywordRegexp.text")),
125  TSK_KEYWORD_PREVIEW(12, "TSK_KEYWORD_PREVIEW", //NON-NLS
126  bundle.getString("BlackboardAttribute.tskKeywordPreview.text")),
127  @Deprecated
128  // use TSK_SET_NAME instead
129  TSK_KEYWORD_SET(13, "TSK_KEYWORD_SET", //NON-NLS
130  bundle.getString("BlackboardAttribute.tskKeywordSet.text")),
131  TSK_USER_NAME(14, "TSK_USER_NAME", //NON-NLS
132  bundle.getString("BlackboardAttribute.tskUserName.text")),
133  TSK_DOMAIN(15, "TSK_DOMAIN", //NON-NLS
134  bundle.getString("BlackboardAttribute.tskDomain.text")),
135  TSK_PASSWORD(16, "TSK_PASSWORD", //NON-NLS
136  bundle.getString("BlackboardAttribute.tskPassword.text")),
137  TSK_NAME_PERSON(17, "TSK_NAME_PERSON", //NON-NLS
138  bundle.getString("BlackboardAttribute.tskNamePerson.text")),
139  TSK_DEVICE_MODEL(18, "TSK_DEVICE_MODEL", //NON-NLS
140  bundle.getString("BlackboardAttribute.tskDeviceModel.text")),
141  TSK_DEVICE_MAKE(19, "TSK_DEVICE_MAKE", //NON-NLS
142  bundle.getString("BlackboardAttribute.tskDeviceMake.text")),
143  TSK_DEVICE_ID(20, "TSK_DEVICE_ID", //NON-NLS
144  bundle.getString("BlackboardAttribute.tskDeviceId.text")),
145  TSK_EMAIL(21, "TSK_EMAIL", //NON-NLS
146  bundle.getString("BlackboardAttribute.tskEmail.text")),
147  TSK_HASH_MD5(22, "TSK_HASH_MD5", //NON-NLS
148  bundle.getString("BlackboardAttribute.tskHashMd5.text")),
149  TSK_HASH_SHA1(23, "TSK_HASH_SHA1", //NON-NLS
150  bundle.getString("BlackboardAttribute.tskHashSha1.text")),
151  TSK_HASH_SHA2_256(24, "TSK_HASH_SHA2_256", //NON-NLS
152  bundle.getString("BlackboardAttribute.tskHashSha225.text")),
153  TSK_HASH_SHA2_512(25, "TSK_HASH_SHA2_512", //NON-NLS
154  bundle.getString("BlackboardAttribute.tskHashSha2512.text")),
155  TSK_TEXT(26, "TSK_TEXT", //NON-NLS
156  bundle.getString("BlackboardAttribute.tskText.text")),
157  TSK_TEXT_FILE(27, "TSK_TEXT_FILE", //NON-NLS
158  bundle.getString("BlackboardAttribute.tskTextFile.text")),
159  TSK_TEXT_LANGUAGE(28, "TSK_TEXT_LANGUAGE", //NON-NLS
160  bundle.getString("BlackboardAttribute.tskTextLanguage.text")),
161  TSK_ENTROPY(29, "TSK_ENTROPY", //NON-NLS
162  bundle.getString("BlackboardAttribute.tskEntropy.text")),
163  @Deprecated
164  // use TSK_SET_NAME instead
165  TSK_HASHSET_NAME(30, "TSK_HASHSET_NAME", //NON-NLS
166  bundle.getString("BlackboardAttribute.tskHashsetName.text")),
167  @Deprecated
168  // use TSK_INTERSTING_FILE_HIT instead
169  TSK_INTERESTING_FILE(31, "TSK_INTERESTING_FILE", //NON-NLS
170  bundle.getString("BlackboardAttribute.tskInterestingFile.text")),
171  TSK_REFERRER(32, "TSK_REFERRER", //NON-NLS
172  bundle.getString("BlackboardAttribute.tskReferrer.text")),
173  TSK_DATETIME_ACCESSED(33, "TSK_DATETIME_ACCESSED", //NON-NLS
174  bundle.getString("BlackboardAttribute.tskDateTimeAccessed.text")),
175  TSK_IP_ADDRESS(34, "TSK_IP_ADDRESS", //NON-NLS
176  bundle.getString("BlackboardAttribute.tskIpAddress.text")),
177  TSK_PHONE_NUMBER(35, "TSK_PHONE_NUMBER", //NON-NLS
178  bundle.getString("BlackboardAttribute.tskPhoneNumber.text")),
179  TSK_PATH_ID(36, "TSK_PATH_ID", //NON-NLS
180  bundle.getString("BlackboardAttribute.tskPathId.text")),
181  TSK_SET_NAME(37, "TSK_SET_NAME", //NON-NLS
182  bundle.getString("BlackboardAttribute.tskSetName.text")),
183  @Deprecated
184  // use artifact instead
185  TSK_ENCRYPTION_DETECTED(38, "TSK_ENCRYPTION_DETECTED", //NON-NLS
186  bundle.getString("BlackboardAttribute.tskEncryptionDetected.text")),
187  TSK_MALWARE_DETECTED(39, "TSK_MALWARE_DETECTED", //NON-NLS
188  bundle.getString("BlackboardAttribute.tskMalwareDetected.text")),
189  TSK_STEG_DETECTED(40, "TSK_STEG_DETECTED", //NON-NLS
190  bundle.getString("BlackboardAttribute.tskStegDetected.text")),
191  TSK_EMAIL_TO(41, "TSK_EMAIL_TO", //NON-NLS
192  bundle.getString("BlackboardAttribute.tskEmailTo.text")),
193  TSK_EMAIL_CC(42, "TSK_EMAIL_CC", //NON-NLS
194  bundle.getString("BlackboardAttribute.tskEmailCc.text")),
195  TSK_EMAIL_BCC(43, "TSK_EMAIL_BCC", //NON-NLS
196  bundle.getString("BlackboardAttribute.tskEmailBcc.text")),
197  TSK_EMAIL_FROM(44, "TSK_EMAIL_FROM", //NON-NLS
198  bundle.getString("BlackboardAttribute.tskEmailFrom.text")),
199  TSK_EMAIL_CONTENT_PLAIN(45, "TSK_EMAIL_CONTENT_PLAIN", //NON-NLS
200  bundle.getString("BlackboardAttribute.tskEmailContentPlain.text")),
201  TSK_EMAIL_CONTENT_HTML(46, "TSK_EMAIL_CONTENT_HTML", //NON-NLS
202  bundle.getString("BlackboardAttribute.tskEmailContentHtml.text")),
203  TSK_EMAIL_CONTENT_RTF(47, "TSK_EMAIL_CONTENT_RTF", //NON-NLS
204  bundle.getString("BlackboardAttribute.tskEmailContentRtf.text")),
205  TSK_MSG_ID(48, "TSK_MSG_ID", //NON-NLS
206  bundle.getString("BlackboardAttribute.tskMsgId.text")),
207  TSK_MSG_REPLY_ID(49, "TSK_MSG_REPLY_ID", //NON-NLS
208  bundle.getString("BlackboardAttribute.tskMsgReplyId.text")),
209  TSK_DATETIME_RCVD(50, "TSK_DATETIME_RCVD", //NON-NLS
210  bundle.getString("BlackboardAttribute.tskDateTimeRcvd.text")),
211  TSK_DATETIME_SENT(51, "TSK_DATETIME_SENT", //NON-NLS
212  bundle.getString("BlackboardAttribute.tskDateTimeSent.text")),
213  TSK_SUBJECT(52, "TSK_SUBJECT", //NON-NLS
214  bundle.getString("BlackboardAttribute.tskSubject.text")),
215  TSK_TITLE(53, "TSK_TITLE", //NON-NLS
216  bundle.getString("BlackboardAttribute.tskTitle.text")),
217  TSK_GEO_LATITUDE(54, "TSK_GEO_LATITUDE", //NON-NLS
218  bundle.getString("BlackboardAttribute.tskGeoLatitude.text")),
219  TSK_GEO_LONGITUDE(55, "TSK_GEO_LONGITUDE", //NON-NLS
220  bundle.getString("BlackboardAttribute.tskGeoLongitude.text")),
221  TSK_GEO_VELOCITY(56, "TSK_GEO_VELOCITY", //NON-NLS
222  bundle.getString("BlackboardAttribute.tskGeoVelocity.text")),
223  TSK_GEO_ALTITUDE(57, "TSK_GEO_ALTITUDE", //NON-NLS
224  bundle.getString("BlackboardAttribute.tskGeoAltitude.text")),
225  TSK_GEO_BEARING(58, "TSK_GEO_BEARING", //NON-NLS
226  bundle.getString("BlackboardAttribute.tskGeoBearing.text")),
227  TSK_GEO_HPRECISION(59, "TSK_GEO_HPRECISION", //NON-NLS
228  bundle.getString("BlackboardAttribute.tskGeoHPrecision.text")),
229  TSK_GEO_VPRECISION(60, "TSK_GEO_VPRECISION", //NON-NLS
230  bundle.getString("BlackboardAttribute.tskGeoVPrecision.text")),
231  TSK_GEO_MAPDATUM(61, "TSK_GEO_MAPDATUM", //NON-NLS
232  bundle.getString("BlackboardAttribute.tskGeoMapDatum.text")),
233  TSK_FILE_TYPE_SIG(62, "TSK_FILE_TYPE_SIG", //NON-NLS
234  bundle.getString("BlackboardAttribute.tskFileTypeSig.text")),
235  TSK_FILE_TYPE_EXT(63, "TSK_FILE_TYPE_EXT", //NON-NLS
236  bundle.getString("BlackboardAttribute.tskFileTypeExt.text")),
237  @Deprecated
238  // tag tables exist not, do not tag with blackboard
239  TSK_TAGGED_ARTIFACT(64, "TSK_TAGGED_ARTIFACT", //NON-NLS
240  bundle.getString("BlackboardAttribute.tskTaggedArtifact.text")),
241  @Deprecated
242  // tag tables exist not, do not tag with blackboard
243  TSK_TAG_NAME(65, "TSK_TAG_NAME", //NON-NLS
244  bundle.getString("BlackboardAttribute.tskTagName.text")),
245  TSK_COMMENT(66, "TSK_COMMENT", //NON-NLS
246  bundle.getString("BlackboardAttribute.tskComment.text")),
247  TSK_URL_DECODED(67, "TSK_URL_DECODED", //NON-NLS
248  bundle.getString("BlackboardAttribute.tskUrlDecoded.text")),
249  TSK_DATETIME_CREATED(68, "TSK_DATETIME_CREATED", //NON-NLS
250  bundle.getString("BlackboardAttribute.tskDateTimeCreated.text")),
251  TSK_DATETIME_MODIFIED(69, "TSK_DATETIME_MODIFIED", //NON-NLS
252  bundle.getString("BlackboardAttribute.tskDateTimeModified.text")),
253  TSK_PROCESSOR_ARCHITECTURE(70, "TSK_PROCESSOR_ARCHITECTURE", //NON-NLS
254  bundle.getString("BlackboardAttribute.tskProcessorArchitecture.text")),
255  TSK_VERSION(71, "TSK_VERSION", //NON-NLS
256  bundle.getString("BlackboardAttribute.tskVersion.text")),
257  TSK_USER_ID(72, "TSK_USER_ID", //NON-NLS
258  bundle.getString("BlackboardAttribute.tskUserId.text")),
259  TSK_DESCRIPTION(73, "TSK_DESCRIPTION", //NON-NLS
260  bundle.getString("BlackboardAttribute.tskDescription.text")),
261  TSK_MESSAGE_TYPE(74, "TSK_MESSAGE_TYPE", //NON-NLS
262  bundle.getString("BlackboardAttribute.tskMessageType.text")), // SMS or MMS or IM ...
263  TSK_PHONE_NUMBER_HOME(75, "TSK_PHONE_NUMBER_HOME", //NON-NLS
264  bundle.getString("BlackboardAttribute.tskPhoneNumberHome.text")),
265  TSK_PHONE_NUMBER_OFFICE(76, "TSK_PHONE_NUMBER_OFFICE", //NON-NLS
266  bundle.getString("BlackboardAttribute.tskPhoneNumberOffice.text")),
267  TSK_PHONE_NUMBER_MOBILE(77, "TSK_PHONE_NUMBER_MOBILE", //NON-NLS
268  bundle.getString("BlackboardAttribute.tskPhoneNumberMobile.text")),
269  TSK_PHONE_NUMBER_FROM(78, "TSK_PHONE_NUMBER_FROM", //NON-NLS
270  bundle.getString("BlackboardAttribute.tskPhoneNumberFrom.text")),
271  TSK_PHONE_NUMBER_TO(79, "TSK_PHONE_NUMBER_TO", //NON-NLS
272  bundle.getString("BlackboardAttribute.tskPhoneNumberTo.text")),
273  TSK_DIRECTION(80, "TSK_DIRECTION", //NON-NLS
274  bundle.getString("BlackboardAttribute.tskDirection.text")), // Msg/Call direction: incoming, outgoing
275  TSK_EMAIL_HOME(81, "TSK_EMAIL_HOME", //NON-NLS
276  bundle.getString("BlackboardAttribute.tskEmailHome.text")),
277  TSK_EMAIL_OFFICE(82, "TSK_EMAIL_OFFICE", //NON-NLS
278  bundle.getString("BlackboardAttribute.tskEmailOffice.text")),
279  TSK_DATETIME_START(83, "TSK_DATETIME_START", //NON-NLS
280  bundle.getString("BlackboardAttribute.tskDateTimeStart.text")), // start time of an event - call log, Calendar entry
281  TSK_DATETIME_END(84, "TSK_DATETIME_END", //NON-NLS
282  bundle.getString("BlackboardAttribute.tskDateTimeEnd.text")), // end time of an event - call log, Calendar entry
283  TSK_CALENDAR_ENTRY_TYPE(85, "TSK_CALENDAR_ENTRY_TYPE", //NON-NLS
284  bundle.getString("BlackboardAttribute.tskCalendarEntryType.text")), // meeting, task,
285  TSK_LOCATION(86, "TSK_LOCATION", //NON-NLS
286  bundle.getString("BlackboardAttribute.tskLocation.text")), // Location string associated with an event - Conf Room Name, Address ....
287  TSK_SHORTCUT(87, "TSK_SHORTCUT", //NON-NLS
288  bundle.getString("BlackboardAttribute.tskShortcut.text")), // Short Cut string - short code or dial string for Speed dial, a URL short cut - e.g. bitly string, Windows Desktop Short cut name etc.
289  TSK_DEVICE_NAME(88, "TSK_DEVICE_NAME", //NON-NLS
290  bundle.getString("BlackboardAttribute.tskDeviceName.text")), // device name - a user assigned (usually) device name - such as "Joe's computer", "bob_win8", "BT Headset"
291  TSK_CATEGORY(89, "TSK_CATEGORY", //NON-NLS
292  bundle.getString("BlackboardAttribute.tskCategory.text")), // category/type, possible value set varies by the artifact
293  TSK_EMAIL_REPLYTO(90, "TSK_EMAIL_REPLYTO", //NON-NLS
294  bundle.getString("BlackboardAttribute.tskEmailReplyTo.text")), // ReplyTo address
295  TSK_SERVER_NAME(91, "TSK_SERVER_NAME", //NON-NLS
296  bundle.getString("BlackboardAttribute.tskServerName.text")), // server name, e.g. a mail server name - "smtp.google.com", a DNS server name...
297  TSK_COUNT(92, "TSK_COUNT", //NON-NLS
298  bundle.getString("BlackboardAttribute.tskCount.text")), // Count related to the artifact
299  TSK_MIN_COUNT(93, "TSK_MIN_COUNT", //NON-NLS
300  bundle.getString("BlackboardAttribute.tskMinCount.text")), // Minimum number/count
301  TSK_PATH_SOURCE(94, "TSK_PATH_SOURCE", //NON-NLS
302  bundle.getString("BlackboardAttribute.tskPathSource.text")), // Path to a source file related to the artifact
303  TSK_PERMISSIONS(95, "TSK_PERMISSIONS", //NON-NLS
304  bundle.getString("BlackboardAttribute.tskPermissions.text")), // Permissions
305  TSK_ASSOCIATED_ARTIFACT(96, "TSK_ASSOCIATED_ARTIFACT", //NON-NLS
306  bundle.getString("BlackboardAttribute.tskAssociatedArtifact.text")), // Artifact ID of a related artifact
307  TSK_ISDELETED(97, "TSK_ISDELETED", //NON-NLS
308  bundle.getString("BlackboardAttribute.tskIsDeleted.text")), // boolean to indicate that the artifact is recovered fom deleted content
309  TSK_GEO_LATITUDE_START(98, "TSK_GEO_LATITUDE_START", //NON-NLS
310  bundle.getString("BlackboardAttribute.tskGeoLatitudeStart.text")), // Starting location lattitude
311  TSK_GEO_LATITUDE_END(99, "TSK_GEO_LATITUDE_END", //NON-NLS
312  bundle.getString("BlackboardAttribute.tskGeoLatitudeEnd.text")), // Ending location lattitude
313  TSK_GEO_LONGITUDE_START(100, "TSK_GEO_LONGITUDE_START", //NON-NLS
314  bundle.getString("BlackboardAttribute.tskGeoLongitudeStart.text")), // Starting location longitude
315  TSK_GEO_LONGITUDE_END(101, "TSK_GEO_LONGITUDE_END", //NON-NLS
316  bundle.getString("BlackboardAttribute.tskGeoLongitudeEnd.text")), //Ending Location longitude
317  TSK_READ_STATUS(102, "TSK_READ_STATUS", //NON-NLS
318  bundle.getString("BlackboardAttribute.tskReadStatus.text")), // Message read status: 1 if read, 0 if unread
319  TSK_LOCAL_PATH(103, "TSK_LOCAL_PATH", //NON-NLS
320  bundle.getString("BlackboardAttribute.tskLocalPath.text")), // Local path to a network drive
321  TSK_REMOTE_PATH(104, "TSK_REMOTE_PATH", //NON-NLS
322  bundle.getString("BlackboardAttribute.tskRemotePath.text")), // Remote path of a network drive
323  TSK_TEMP_DIR(105, "TSK_TEMP_DIR", //NON-NLS
324  bundle.getString("BlackboardAttribute.tskTempDir.text")), // Default temporary files directory
325  TSK_PRODUCT_ID(106, "TSK_PRODUCT_ID", //NON-NLS
326  bundle.getString("BlackboardAttribute.tskProductId.text")), // Product ID
327  TSK_OWNER(107, "TSK_OWNER", //NON-NLS
328  bundle.getString("BlackboardAttribute.tskOwner.text")), // Registered owner of a piece of software
329  TSK_ORGANIZATION(108, "TSK_ORGANIZATION", //NON-NLS
330  bundle.getString("BlackboardAttribute.tskOrganization.text")), // Registered Organization for a piece of software
331  ;
332  /*
333  * SEE ABOVE -- ALSO ADD TO C++ CODE
334  */
335  private String label;
336  private int typeID;
337  private String displayName;
338 
339  private ATTRIBUTE_TYPE(int typeID, String label, String displayName) {
340  this.typeID = typeID;
341  this.label = label;
342  this.displayName = displayName;
343  }
344 
350  public String getLabel() {
351  return this.label;
352  }
353 
359  public int getTypeID() {
360  return this.typeID;
361  }
362 
370  static public ATTRIBUTE_TYPE fromLabel(String label) {
371  for (ATTRIBUTE_TYPE v : ATTRIBUTE_TYPE.values()) {
372  if (v.label.equals(label)) {
373  return v;
374  }
375  }
376  throw new IllegalArgumentException("No ATTRIBUTE_TYPE matching type: " + label);
377  }
378 
379  public String getDisplayName() {
380  return this.displayName;
381  }
382  }
383 
402  BlackboardAttribute(long artifactID, int attributeTypeID, String moduleName, String context,
403  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, int valueInt, long valueLong, double valueDouble,
404  String valueString, byte[] valueBytes, SleuthkitCase sleuthkitCase) {
405 
406  this.artifactID = artifactID;
407  this.attributeTypeID = attributeTypeID;
408  this.moduleName = moduleName;
409  this.context = context;
410  this.valueType = valueType;
411  this.valueInt = valueInt;
412  this.valueLong = valueLong;
413  this.valueDouble = valueDouble;
414  if (valueString == null) {
415  this.valueString = "";
416  } else {
417  this.valueString = valueString;
418  }
419  if (valueBytes == null) {
420  this.valueBytes = new byte[0];
421  } else {
422  this.valueBytes = valueBytes;
423  }
424  this.sleuthkitCase = sleuthkitCase;
425  }
426 
435  public BlackboardAttribute(int attributeTypeID, String moduleName, int valueInt) {
436  this.artifactID = 0;
437  this.attributeTypeID = attributeTypeID;
438  this.moduleName = moduleName;
440  this.valueInt = valueInt;
441  this.valueLong = 0;
442  this.valueDouble = 0;
443  this.valueString = "";
444  this.valueBytes = new byte[0];
445  this.context = "";
446  }
447 
460  @Deprecated
461  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
462  int valueInt) {
464  this.context = context;
465  }
466 
475  public BlackboardAttribute(int attributeTypeID, String moduleName,
476  long valueLong) {
477  this.artifactID = 0;
478  this.attributeTypeID = attributeTypeID;
479  this.moduleName = moduleName;
480  this.valueType = TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.LONG;
481  this.valueInt = 0;
482  this.valueLong = valueLong;
483  this.valueDouble = 0;
484  this.valueString = "";
485  this.valueBytes = new byte[0];
486  this.context = "";
487 
488  }
489 
502  @Deprecated
503  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
504  long valueLong) {
506  this.context = context;
507  }
508 
517  public BlackboardAttribute(int attributeTypeID, String moduleName,
518  double valueDouble) {
519  this.artifactID = 0;
520  this.attributeTypeID = attributeTypeID;
521  this.moduleName = moduleName;
523  this.valueInt = 0;
524  this.valueLong = 0;
525  this.valueDouble = valueDouble;
526  this.valueString = "";
527  this.valueBytes = new byte[0];
528  this.context = "";
529  }
530 
543  @Deprecated
544  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
545  double valueDouble) {
547  this.context = context;
548  }
549 
558  public BlackboardAttribute(int attributeTypeID, String moduleName, String valueString) {
559  this.artifactID = 0;
560  this.attributeTypeID = attributeTypeID;
561  this.moduleName = moduleName;
563  this.valueInt = 0;
564  this.valueLong = 0;
565  this.valueDouble = 0;
566  if (valueString == null) {
567  this.valueString = "";
568  } else {
569  this.valueString = valueString;
570  }
571  this.valueBytes = new byte[0];
572  this.context = "";
573  }
574 
587  @Deprecated
588  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
589  String valueString) {
591  this.context = context;
592  }
593 
602  public BlackboardAttribute(int attributeTypeID, String moduleName, byte[] valueBytes) {
603  this.artifactID = 0;
604  this.attributeTypeID = attributeTypeID;
605  this.moduleName = moduleName;
606  this.context = "";
607  this.valueType = TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE;
608  this.valueInt = 0;
609  this.valueLong = 0;
610  this.valueDouble = 0;
611  this.valueString = "";
612  if (valueBytes == null) {
613  this.valueBytes = new byte[0];
614  } else {
615  this.valueBytes = valueBytes;
616  }
617  }
618 
628  @Deprecated
629  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
630  byte[] valueBytes) {
632  this.context = context;
633  }
634 
635  @Override
636  public int hashCode() {
637  int hash = 5;
638  hash = 97 * hash + (int) (this.artifactID ^ (this.artifactID >>> 32));
639  return hash;
640  }
641 
642  @Override
643  public boolean equals(Object obj) {
644  if (obj == null) {
645  return false;
646  }
647  if (getClass() != obj.getClass()) {
648  return false;
649  }
650  final BlackboardAttribute other = (BlackboardAttribute) obj;
651  if (this.artifactID != other.artifactID) {
652  return false;
653  }
654  return true;
655  }
656 
657  @Override
658  public String toString() {
659  return "BlackboardAttribute{" + "artifactID=" + artifactID + ", attributeTypeID=" + attributeTypeID + ", moduleName=" + moduleName + ", context=" + context + ", valueType=" + valueType + ", valueInt=" + valueInt + ", valueLong=" + valueLong + ", valueDouble=" + valueDouble + ", valueString=" + valueString + ", valueBytes=" + valueBytes + ", Case=" + sleuthkitCase + '}'; //NON-NLS
660  }
661 
667  public long getArtifactID() {
668  return artifactID;
669  }
670 
676  public int getAttributeTypeID() {
677  return attributeTypeID;
678  }
679 
685  public String getAttributeTypeName() throws TskCoreException {
686  return sleuthkitCase.getAttrTypeString(attributeTypeID);
687  }
688 
695  return sleuthkitCase.getAttrTypeDisplayName(attributeTypeID);
696  }
697 
707  return valueType;
708  }
709 
715  public int getValueInt() {
716  return valueInt;
717  }
718 
724  public long getValueLong() {
725  return valueLong;
726  }
727 
733  public double getValueDouble() {
734  return valueDouble;
735  }
736 
742  public String getValueString() {
743  return valueString;
744  }
745 
751  public byte[] getValueBytes() {
752  return valueBytes;
753  }
754 
760  public String getModuleName() {
761  return moduleName;
762  }
763 
769  public String getContext() {
770  return context;
771  }
772 
785  return sleuthkitCase.getBlackboardArtifact(artifactID);
786  }
787 
793  protected void setArtifactID(long artifactID) {
794  this.artifactID = artifactID;
795  }
796 
803  protected void setCase(SleuthkitCase sleuthkitCase) {
804  this.sleuthkitCase = sleuthkitCase;
805  }
806 
807  // from http://stackoverflow.com/questions/9655181/convert-from-byte-array-to-hex-string-in-java
808  final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
809 
810  private static String bytesToHexString(byte[] bytes) {
811  char[] hexChars = new char[bytes.length * 2];
812  for (int j = 0; j < bytes.length; j++) {
813  int v = bytes[j] & 0xFF;
814  hexChars[j * 2] = hexArray[v >>> 4];
815  hexChars[j * 2 + 1] = hexArray[v & 0x0F];
816  }
817  return new String(hexChars);
818  }
819 
826  public String getDisplayString() {
827  switch (valueType) {
828  case STRING:
829  return getValueString();
830  case INTEGER:
831  if (attributeTypeID == ATTRIBUTE_TYPE.TSK_READ_STATUS.getTypeID()) {
832  if (getValueInt() == 0) {
833  return "Unread";
834  } else {
835  return "Read";
836  }
837  }
838  return Integer.toString(getValueInt());
839  case LONG:
840  // SHOULD at some point figure out how to convert times in here based on preferred formats
841  // and such. Perhaps pass in a time formatter.
842  return Long.toString(getValueLong());
843  case DOUBLE:
844  return Double.toString(getValueDouble());
845  case BYTE:
847  }
848  return "";
849  }
850 }
BlackboardAttribute(int attributeTypeID, String moduleName, String context, byte[] valueBytes)
void setCase(SleuthkitCase sleuthkitCase)
TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE getValueType()
ATTRIBUTE_TYPE(int typeID, String label, String displayName)
BlackboardAttribute(int attributeTypeID, String moduleName, String context, int valueInt)
BlackboardArtifact getBlackboardArtifact(long artifactID)
BlackboardAttribute(int attributeTypeID, String moduleName, int valueInt)
BlackboardAttribute(int attributeTypeID, String moduleName, String valueString)
BlackboardAttribute(int attributeTypeID, String moduleName, double valueDouble)
String getAttrTypeDisplayName(int attrTypeID)
TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType
BlackboardAttribute(int attributeTypeID, String moduleName, String context, double valueDouble)
String getAttrTypeString(int attrTypeID)
BlackboardAttribute(int attributeTypeID, String moduleName, String context, long valueLong)
BlackboardAttribute(int attributeTypeID, String moduleName, String context, String valueString)
BlackboardAttribute(int attributeTypeID, String moduleName, long valueLong)
BlackboardAttribute(int attributeTypeID, String moduleName, byte[] valueBytes)

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