Sleuth Kit Java Bindings (JNI)  4.4.1
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 2011-2017 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.io.Serializable;
22 import java.util.Arrays;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.Objects;
26 import java.util.ResourceBundle;
27 import java.util.TimeZone;
28 import java.util.logging.Level;
29 import java.util.logging.Logger;
30 
45 public class BlackboardAttribute {
46 
47  private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
48  private static final Logger LOGGER = Logger.getLogger(BlackboardAttribute.class.getName());
49 
50  private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle");
52  private final int valueInt;
53  private final long valueLong;
54  private final double valueDouble;
55  private final String valueString;
56  private final byte[] valueBytes;
57  private String context;
58  private long artifactID;
60  private String sources;
61 
74  public BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, int valueInt) throws IllegalArgumentException {
76  throw new IllegalArgumentException("Value types do not match");
77  }
78  this.artifactID = 0;
80  this.sources = replaceNulls(source);
81  this.valueInt = valueInt;
82  this.valueLong = 0;
83  this.valueDouble = 0;
84  this.valueString = "";
85  this.valueBytes = new byte[0];
86  this.context = "";
87  }
88 
101  public BlackboardAttribute(Type attributeType, String source, int valueInt) throws IllegalArgumentException {
103  throw new IllegalArgumentException("Type mismatched with value type");
104  }
105  this.artifactID = 0;
107  this.sources = replaceNulls(source);
108  this.valueInt = valueInt;
109  this.valueLong = 0;
110  this.valueDouble = 0;
111  this.valueString = "";
112  this.valueBytes = new byte[0];
113  this.context = "";
114  }
115 
131  public BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, long valueLong) throws IllegalArgumentException {
134  throw new IllegalArgumentException("Value types do not match");
135  }
136  this.artifactID = 0;
138  this.sources = replaceNulls(source);
139  this.valueInt = 0;
140  this.valueLong = valueLong;
141  this.valueDouble = 0;
142  this.valueString = "";
143  this.valueBytes = new byte[0];
144  this.context = "";
145  }
146 
161  public BlackboardAttribute(Type attributeType, String source, long valueLong) throws IllegalArgumentException {
164  throw new IllegalArgumentException("Type mismatched with value type");
165  }
166  this.artifactID = 0;
168  this.sources = replaceNulls(source);
169  this.valueInt = 0;
170  this.valueLong = valueLong;
171  this.valueDouble = 0;
172  this.valueString = "";
173  this.valueBytes = new byte[0];
174  this.context = "";
175  }
176 
189  public BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, double valueDouble) throws IllegalArgumentException {
191  throw new IllegalArgumentException("Value types do not match");
192  }
193  this.artifactID = 0;
195  this.sources = replaceNulls(source);
196  this.valueInt = 0;
197  this.valueLong = 0;
198  this.valueDouble = valueDouble;
199  this.valueString = "";
200  this.valueBytes = new byte[0];
201  this.context = "";
202 
203  }
204 
217  public BlackboardAttribute(Type attributeType, String source, double valueDouble) throws IllegalArgumentException {
219  throw new IllegalArgumentException("Type mismatched with value type");
220  }
221  this.artifactID = 0;
223  this.sources = replaceNulls(source);
224  this.valueInt = 0;
225  this.valueLong = 0;
226  this.valueDouble = valueDouble;
227  this.valueString = "";
228  this.valueBytes = new byte[0];
229  this.context = "";
230  }
231 
244  public BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, String valueString) throws IllegalArgumentException {
246  throw new IllegalArgumentException("Value types do not match");
247  }
248  this.artifactID = 0;
250  this.sources = replaceNulls(source);
251  this.valueInt = 0;
252  this.valueLong = 0;
253  this.valueDouble = 0;
254  if (valueString == null) {
255  this.valueString = "";
256  } else {
257  this.valueString = replaceNulls(valueString);
258  }
259  this.valueBytes = new byte[0];
260  this.context = "";
261  }
262 
275  public BlackboardAttribute(Type attributeType, String source, String valueString) throws IllegalArgumentException {
277  throw new IllegalArgumentException("Type mismatched with value type");
278  }
279  this.artifactID = 0;
281  this.sources = replaceNulls(source);
282  this.valueInt = 0;
283  this.valueLong = 0;
284  this.valueDouble = 0;
285  if (valueString == null) {
286  this.valueString = "";
287  } else {
288  this.valueString = replaceNulls(valueString);
289  }
290  this.valueBytes = new byte[0];
291  this.context = "";
292  }
293 
306  public BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, byte[] valueBytes) throws IllegalArgumentException {
308  throw new IllegalArgumentException("Value types do not match");
309  }
310  this.artifactID = 0;
312  this.sources = replaceNulls(source);
313  this.context = "";
314  this.valueInt = 0;
315  this.valueLong = 0;
316  this.valueDouble = 0;
317  this.valueString = "";
318  if (valueBytes == null) {
319  this.valueBytes = new byte[0];
320  } else {
321  this.valueBytes = valueBytes;
322  }
323  }
324 
337  public BlackboardAttribute(Type attributeType, String source, byte[] valueBytes) throws IllegalArgumentException {
339  throw new IllegalArgumentException("Type mismatched with value type");
340  }
341  this.artifactID = 0;
343  this.sources = replaceNulls(source);
344  this.context = "";
345  this.valueInt = 0;
346  this.valueLong = 0;
347  this.valueDouble = 0;
348  this.valueString = "";
349  if (valueBytes == null) {
350  this.valueBytes = new byte[0];
351  } else {
352  this.valueBytes = valueBytes;
353  }
354  }
355 
363  public long getArtifactID() {
364  return artifactID;
365  }
366 
373  return this.attributeType;
374  }
375 
382  return attributeType.getValueType();
383  }
384 
391  public int getValueInt() {
392  return valueInt;
393  }
394 
401  public long getValueLong() {
402  return valueLong;
403  }
404 
411  public double getValueDouble() {
412  return valueDouble;
413  }
414 
421  public String getValueString() {
422  return valueString;
423  }
424 
431  public byte[] getValueBytes() {
432  return Arrays.copyOf(valueBytes, valueBytes.length);
433  }
434 
440  public List<String> getSources() {
441  if (null != sources && !this.sources.isEmpty()) {
442  List<String> modules = Arrays.asList(sources.split(","));
443  return modules;
444  } else {
445  return Collections.emptyList();
446  }
447  }
448 
456  public void addSource(String source) throws TskCoreException {
457  this.sources = sleuthkitCase.addSourceToArtifactAttribute(this, source);
458  }
459 
472  return sleuthkitCase.getBlackboardArtifact(artifactID);
473  }
474 
475  @Override
476  public int hashCode() {
477  int hash = 5;
478  hash = 97 * hash + (int) (this.artifactID ^ (this.artifactID >>> 32));
479  return hash;
480  }
481 
482  @Override
483  public boolean equals(Object obj) {
484  if (obj == null) {
485  return false;
486  }
487  if (getClass() != obj.getClass()) {
488  return false;
489  }
490  final BlackboardAttribute other = (BlackboardAttribute) obj;
491  return this.artifactID == other.getArtifactID();
492  }
493 
494  @Override
495  public String toString() {
496  return "BlackboardAttribute{" + "artifactID=" + artifactID + ", attributeType=" + attributeType.toString() + ", moduleName=" + sources + ", context=" + context + ", valueInt=" + valueInt + ", valueLong=" + valueLong + ", valueDouble=" + valueDouble + ", valueString=" + valueString + ", valueBytes=" + Arrays.toString(valueBytes) + ", Case=" + sleuthkitCase + '}'; //NON-NLS
497  }
498 
504  public String getDisplayString() {
505  switch (attributeType.getValueType()) {
506  case STRING:
507  return getValueString();
508  case INTEGER:
509  if (attributeType.getTypeID() == ATTRIBUTE_TYPE.TSK_READ_STATUS.getTypeID()) {
510  if (getValueInt() == 0) {
511  return "Unread";
512  } else {
513  return "Read";
514  }
515  }
516  return Integer.toString(getValueInt());
517  case LONG:
518  // SHOULD at some point figure out how to convert times in here
519  // based on preferred formats and such. Perhaps provide another
520  // method that takes a formatter argument.
521  return Long.toString(getValueLong());
522  case DOUBLE:
523  return Double.toString(getValueDouble());
524  case BYTE:
525  return bytesToHexString(getValueBytes());
526 
527  case DATETIME: {
528  try {
529  final Content dataSource = getParentArtifact().getDataSource();
530  if ((dataSource != null) && (dataSource instanceof Image )) {
531  // return the date/time string in the timezone associated with the datasource,
532  Image image = (Image) dataSource;
533  TimeZone tzone = TimeZone.getTimeZone(image.getTimeZone());
534  return TimeUtilities.epochToTime(getValueLong(), tzone);
535  }
536  } catch (TskException ex) {
537  LOGGER.log(Level.WARNING, "Could not get timezone for image", ex); //NON-NLS
538  // return time string in default timezone
540  }
541  }
542  }
543  return "";
544  }
545 
564  BlackboardAttribute(long artifactID, BlackboardAttribute.Type attributeType, String source, String context,
565  int valueInt, long valueLong, double valueDouble, String valueString, byte[] valueBytes,
566  SleuthkitCase sleuthkitCase) {
567 
568  this.artifactID = artifactID;
570  this.sources = replaceNulls(source);
571  this.context = replaceNulls(context);
572  this.valueInt = valueInt;
573  this.valueLong = valueLong;
574  this.valueDouble = valueDouble;
575  if (valueString == null) {
576  this.valueString = "";
577  } else {
578  this.valueString = replaceNulls(valueString);
579  }
580  if (valueBytes == null) {
581  this.valueBytes = new byte[0];
582  } else {
583  this.valueBytes = valueBytes;
584  }
585  this.sleuthkitCase = sleuthkitCase;
586  }
587 
594  void setCaseDatabase(SleuthkitCase sleuthkitCase) {
595  this.sleuthkitCase = sleuthkitCase;
596  }
597 
603  void setArtifactId(long artifactID) {
604  this.artifactID = artifactID;
605  }
606 
615  String getSourcesCSV() {
616  return sources;
617  }
618 
626  static String bytesToHexString(byte[] bytes) {
627  // from http://stackoverflow.com/questions/9655181/convert-from-byte-array-to-hex-string-in-java
628  char[] hexChars = new char[bytes.length * 2];
629  for (int j = 0; j < bytes.length; j++) {
630  int v = bytes[j] & 0xFF;
631  hexChars[j * 2] = HEX_ARRAY[v >>> 4];
632  hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
633  }
634  return new String(hexChars);
635  }
636 
644  private String replaceNulls(String text) {
645  return text.replace((char) 0x00, (char) 0x1A);
646  }
647 
651  public static final class Type implements Serializable {
652 
653  private static final long serialVersionUID = 1L;
654  private final String typeName;
655  private final int typeID;
656  private final String displayName;
658 
667  public Type(int typeID, String typeName, String displayName, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType) {
668  this.typeID = typeID;
669  this.typeName = typeName;
670  this.displayName = displayName;
671  this.valueType = valueType;
672  }
673 
681  this.typeID = type.getTypeID();
682  this.typeName = type.getLabel();
683  this.displayName = type.getDisplayName();
684  this.valueType = type.getValueType();
685  }
686 
693  return this.valueType;
694  }
695 
701  public String getTypeName() {
702  return this.typeName;
703  }
704 
710  public int getTypeID() {
711  return this.typeID;
712  }
713 
719  public String getDisplayName() {
720  return this.displayName;
721  }
722 
723  @Override
724  public boolean equals(Object that) {
725  if (this == that) {
726  return true;
727  } else if (!(that instanceof BlackboardAttribute.Type)) {
728  return false;
729  } else {
730  return ((BlackboardAttribute.Type) that).sameType(this);
731  }
732  }
733 
742  private boolean sameType(BlackboardAttribute.Type that) {
743  return this.typeName.equals(that.getTypeName())
744  && this.displayName.equals(that.getDisplayName())
745  && this.typeID == that.getTypeID()
746  && this.valueType == that.getValueType();
747  }
748 
749  @Override
750  public int hashCode() {
751  int hash = 7;
752  hash = 63 * hash + Objects.hashCode(this.typeID);
753  hash = 63 * hash + Objects.hashCode(this.displayName);
754  hash = 63 * hash + Objects.hashCode(this.typeName);
755  hash = 63 * hash + Objects.hashCode(this.valueType);
756  return hash;
757  }
758 
759  @Override
760  public String toString() {
761  return "(typeID= " + this.typeID
762  + ", displayName=" + this.displayName
763  + ", typeName=" + this.typeName
764  + ", valueType=" + this.valueType + ")";
765  }
766  }
767 
773 
777  STRING(0, "String"), //NON-NLS
781  INTEGER(1, "Integer"), //NON-NLS
785  LONG(2, "Long"), //NON-NLS
789  DOUBLE(3, "Double"), //NON-NLS
793  BYTE(4, "Byte"), //NON-NLS
798  DATETIME(5, "DateTime");
799 
800  private final long typeId;
801  private final String typeName;
802 
803  /*
804  * TODO (AUT-2070): Add a localized displayName field and a
805  * getDisplayName method for API consistency.
806  */
813  private TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE(long type, String typeName) {
814  this.typeId = type;
815  this.typeName = typeName;
816  }
817 
826  public long getType() {
827  return typeId;
828  }
829 
838  public String getLabel() {
839  return this.typeName;
840  }
841 
856  static public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE fromType(long typeId) {
858  if (valueType.getType() == typeId) {
859  return valueType;
860  }
861  }
862  throw new IllegalArgumentException("No TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE matching type: " + typeId);
863  }
864 
879  static public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE fromLabel(String typeName) {
881  if (valueType.getLabel().equals(typeName)) {
882  return valueType;
883  }
884  }
885  throw new IllegalArgumentException("No TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE matching type: " + typeName);
886  }
887 
888  }
889 
896  public enum ATTRIBUTE_TYPE {
897 
898  TSK_URL(1, "TSK_URL", //NON-NLS
899  bundle.getString("BlackboardAttribute.tskUrl.text"),
901  TSK_DATETIME(2, "TSK_DATETIME", //NON-NLS
902  bundle.getString("BlackboardAttribute.tskDatetime.text"),
904  TSK_NAME(3, "TSK_NAME", //NON-NLS
905  bundle.getString("BlackboardAttribute.tskName.text"),
907  TSK_PROG_NAME(4, "TSK_PROG_NAME", //NON-NLS
908  bundle.getString("BlackboardAttribute.tskProgName.text"),
910  TSK_VALUE(6, "TSK_VALUE", //NON-NLS
911  bundle.getString("BlackboardAttribute.tskValue.text"),
913  TSK_FLAG(7, "TSK_FLAG", //NON-NLS
914  bundle.getString("BlackboardAttribute.tskFlag.text"),
916  TSK_PATH(8, "TSK_PATH", //NON-NLS
917  bundle.getString("BlackboardAttribute.tskPath.text"),
919  TSK_KEYWORD(10, "TSK_KEYWORD", //NON-NLS
920  bundle.getString("BlackboardAttribute.tskKeyword.text"),
922  TSK_KEYWORD_REGEXP(11, "TSK_KEYWORD_REGEXP", //NON-NLS
923  bundle.getString("BlackboardAttribute.tskKeywordRegexp.text"),
925  TSK_KEYWORD_PREVIEW(12, "TSK_KEYWORD_PREVIEW", //NON-NLS
926  bundle.getString("BlackboardAttribute.tskKeywordPreview.text"),
931  @Deprecated
932  TSK_KEYWORD_SET(13, "TSK_KEYWORD_SET", //NON-NLS
933  bundle.getString("BlackboardAttribute.tskKeywordSet.text"),
935  TSK_USER_NAME(14, "TSK_USER_NAME", //NON-NLS
936  bundle.getString("BlackboardAttribute.tskUserName.text"),
938  TSK_DOMAIN(15, "TSK_DOMAIN", //NON-NLS
939  bundle.getString("BlackboardAttribute.tskDomain.text"),
941  TSK_PASSWORD(16, "TSK_PASSWORD", //NON-NLS
942  bundle.getString("BlackboardAttribute.tskPassword.text"),
944  TSK_NAME_PERSON(17, "TSK_NAME_PERSON", //NON-NLS
945  bundle.getString("BlackboardAttribute.tskNamePerson.text"),
947  TSK_DEVICE_MODEL(18, "TSK_DEVICE_MODEL", //NON-NLS
948  bundle.getString("BlackboardAttribute.tskDeviceModel.text"),
950  TSK_DEVICE_MAKE(19, "TSK_DEVICE_MAKE", //NON-NLS
951  bundle.getString("BlackboardAttribute.tskDeviceMake.text"),
953  TSK_DEVICE_ID(20, "TSK_DEVICE_ID", //NON-NLS
954  bundle.getString("BlackboardAttribute.tskDeviceId.text"),
956  TSK_EMAIL(21, "TSK_EMAIL", //NON-NLS
957  bundle.getString("BlackboardAttribute.tskEmail.text"),
959  TSK_HASH_MD5(22, "TSK_HASH_MD5", //NON-NLS
960  bundle.getString("BlackboardAttribute.tskHashMd5.text"),
962  TSK_HASH_SHA1(23, "TSK_HASH_SHA1", //NON-NLS
963  bundle.getString("BlackboardAttribute.tskHashSha1.text"),
965  TSK_HASH_SHA2_256(24, "TSK_HASH_SHA2_256", //NON-NLS
966  bundle.getString("BlackboardAttribute.tskHashSha225.text"),
968  TSK_HASH_SHA2_512(25, "TSK_HASH_SHA2_512", //NON-NLS
969  bundle.getString("BlackboardAttribute.tskHashSha2512.text"),
971  TSK_TEXT(26, "TSK_TEXT", //NON-NLS
972  bundle.getString("BlackboardAttribute.tskText.text"),
974  TSK_TEXT_FILE(27, "TSK_TEXT_FILE", //NON-NLS
975  bundle.getString("BlackboardAttribute.tskTextFile.text"),
977  TSK_TEXT_LANGUAGE(28, "TSK_TEXT_LANGUAGE", //NON-NLS
978  bundle.getString("BlackboardAttribute.tskTextLanguage.text"),
980  TSK_ENTROPY(29, "TSK_ENTROPY", //NON-NLS
981  bundle.getString("BlackboardAttribute.tskEntropy.text"),
986  @Deprecated
987  TSK_HASHSET_NAME(30, "TSK_HASHSET_NAME", //NON-NLS
988  bundle.getString("BlackboardAttribute.tskHashsetName.text"),
993  @Deprecated
994  TSK_INTERESTING_FILE(31, "TSK_INTERESTING_FILE", //NON-NLS
995  bundle.getString("BlackboardAttribute.tskInterestingFile.text"),
997  TSK_REFERRER(32, "TSK_REFERRER", //NON-NLS
998  bundle.getString("BlackboardAttribute.tskReferrer.text"),
1000  TSK_DATETIME_ACCESSED(33, "TSK_DATETIME_ACCESSED", //NON-NLS
1001  bundle.getString("BlackboardAttribute.tskDateTimeAccessed.text"),
1003  TSK_IP_ADDRESS(34, "TSK_IP_ADDRESS", //NON-NLS
1004  bundle.getString("BlackboardAttribute.tskIpAddress.text"),
1006  TSK_PHONE_NUMBER(35, "TSK_PHONE_NUMBER", //NON-NLS
1007  bundle.getString("BlackboardAttribute.tskPhoneNumber.text"),
1009  TSK_PATH_ID(36, "TSK_PATH_ID", //NON-NLS
1010  bundle.getString("BlackboardAttribute.tskPathId.text"),
1012  TSK_SET_NAME(37, "TSK_SET_NAME", //NON-NLS
1013  bundle.getString("BlackboardAttribute.tskSetName.text"),
1018  @Deprecated
1019  TSK_ENCRYPTION_DETECTED(38, "TSK_ENCRYPTION_DETECTED", //NON-NLS
1020  bundle.getString("BlackboardAttribute.tskEncryptionDetected.text"),
1022  TSK_MALWARE_DETECTED(39, "TSK_MALWARE_DETECTED", //NON-NLS
1023  bundle.getString("BlackboardAttribute.tskMalwareDetected.text"),
1025  TSK_STEG_DETECTED(40, "TSK_STEG_DETECTED", //NON-NLS
1026  bundle.getString("BlackboardAttribute.tskStegDetected.text"),
1028  TSK_EMAIL_TO(41, "TSK_EMAIL_TO", //NON-NLS
1029  bundle.getString("BlackboardAttribute.tskEmailTo.text"),
1031  TSK_EMAIL_CC(42, "TSK_EMAIL_CC", //NON-NLS
1032  bundle.getString("BlackboardAttribute.tskEmailCc.text"),
1034  TSK_EMAIL_BCC(43, "TSK_EMAIL_BCC", //NON-NLS
1035  bundle.getString("BlackboardAttribute.tskEmailBcc.text"),
1037  TSK_EMAIL_FROM(44, "TSK_EMAIL_FROM", //NON-NLS
1038  bundle.getString("BlackboardAttribute.tskEmailFrom.text"),
1040  TSK_EMAIL_CONTENT_PLAIN(45, "TSK_EMAIL_CONTENT_PLAIN", //NON-NLS
1041  bundle.getString("BlackboardAttribute.tskEmailContentPlain.text"),
1043  TSK_EMAIL_CONTENT_HTML(46, "TSK_EMAIL_CONTENT_HTML", //NON-NLS
1044  bundle.getString("BlackboardAttribute.tskEmailContentHtml.text"),
1046  TSK_EMAIL_CONTENT_RTF(47, "TSK_EMAIL_CONTENT_RTF", //NON-NLS
1047  bundle.getString("BlackboardAttribute.tskEmailContentRtf.text"),
1049  TSK_MSG_ID(48, "TSK_MSG_ID", //NON-NLS
1050  bundle.getString("BlackboardAttribute.tskMsgId.text"),
1052  TSK_MSG_REPLY_ID(49, "TSK_MSG_REPLY_ID", //NON-NLS
1053  bundle.getString("BlackboardAttribute.tskMsgReplyId.text"),
1055  TSK_DATETIME_RCVD(50, "TSK_DATETIME_RCVD", //NON-NLS
1056  bundle.getString("BlackboardAttribute.tskDateTimeRcvd.text"),
1058  TSK_DATETIME_SENT(51, "TSK_DATETIME_SENT", //NON-NLS
1059  bundle.getString("BlackboardAttribute.tskDateTimeSent.text"),
1061  TSK_SUBJECT(52, "TSK_SUBJECT", //NON-NLS
1062  bundle.getString("BlackboardAttribute.tskSubject.text"),
1064  TSK_TITLE(53, "TSK_TITLE", //NON-NLS
1065  bundle.getString("BlackboardAttribute.tskTitle.text"),
1067  TSK_GEO_LATITUDE(54, "TSK_GEO_LATITUDE", //NON-NLS
1068  bundle.getString("BlackboardAttribute.tskGeoLatitude.text"),
1070  TSK_GEO_LONGITUDE(55, "TSK_GEO_LONGITUDE", //NON-NLS
1071  bundle.getString("BlackboardAttribute.tskGeoLongitude.text"),
1073  TSK_GEO_VELOCITY(56, "TSK_GEO_VELOCITY", //NON-NLS
1074  bundle.getString("BlackboardAttribute.tskGeoVelocity.text"),
1076  TSK_GEO_ALTITUDE(57, "TSK_GEO_ALTITUDE", //NON-NLS
1077  bundle.getString("BlackboardAttribute.tskGeoAltitude.text"),
1079  TSK_GEO_BEARING(58, "TSK_GEO_BEARING", //NON-NLS
1080  bundle.getString("BlackboardAttribute.tskGeoBearing.text"),
1082  TSK_GEO_HPRECISION(59, "TSK_GEO_HPRECISION", //NON-NLS
1083  bundle.getString("BlackboardAttribute.tskGeoHPrecision.text"),
1085  TSK_GEO_VPRECISION(60, "TSK_GEO_VPRECISION", //NON-NLS
1086  bundle.getString("BlackboardAttribute.tskGeoVPrecision.text"),
1088  TSK_GEO_MAPDATUM(61, "TSK_GEO_MAPDATUM", //NON-NLS
1089  bundle.getString("BlackboardAttribute.tskGeoMapDatum.text"),
1095  @Deprecated
1096  TSK_FILE_TYPE_SIG(62, "TSK_FILE_TYPE_SIG", //NON-NLS
1097  bundle.getString("BlackboardAttribute.tskFileTypeSig.text"),
1099  TSK_FILE_TYPE_EXT(63, "TSK_FILE_TYPE_EXT", //NON-NLS
1100  bundle.getString("BlackboardAttribute.tskFileTypeExt.text"),
1106  @Deprecated
1107  TSK_TAGGED_ARTIFACT(64, "TSK_TAGGED_ARTIFACT", //NON-NLS
1108  bundle.getString("BlackboardAttribute.tskTaggedArtifact.text"),
1114  @Deprecated
1115  TSK_TAG_NAME(65, "TSK_TAG_NAME", //NON-NLS
1116  bundle.getString("BlackboardAttribute.tskTagName.text"),
1118  TSK_COMMENT(66, "TSK_COMMENT", //NON-NLS
1119  bundle.getString("BlackboardAttribute.tskComment.text"),
1121  TSK_URL_DECODED(67, "TSK_URL_DECODED", //NON-NLS
1122  bundle.getString("BlackboardAttribute.tskUrlDecoded.text"),
1124  TSK_DATETIME_CREATED(68, "TSK_DATETIME_CREATED", //NON-NLS
1125  bundle.getString("BlackboardAttribute.tskDateTimeCreated.text"),
1127  TSK_DATETIME_MODIFIED(69, "TSK_DATETIME_MODIFIED", //NON-NLS
1128  bundle.getString("BlackboardAttribute.tskDateTimeModified.text"),
1130  TSK_PROCESSOR_ARCHITECTURE(70, "TSK_PROCESSOR_ARCHITECTURE", //NON-NLS
1131  bundle.getString("BlackboardAttribute.tskProcessorArchitecture.text"),
1133  TSK_VERSION(71, "TSK_VERSION", //NON-NLS
1134  bundle.getString("BlackboardAttribute.tskVersion.text"),
1136  TSK_USER_ID(72, "TSK_USER_ID", //NON-NLS
1137  bundle.getString("BlackboardAttribute.tskUserId.text"),
1139  TSK_DESCRIPTION(73, "TSK_DESCRIPTION", //NON-NLS
1140  bundle.getString("BlackboardAttribute.tskDescription.text"),
1142  TSK_MESSAGE_TYPE(74, "TSK_MESSAGE_TYPE", //NON-NLS
1143  bundle.getString("BlackboardAttribute.tskMessageType.text"),
1144  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // SMS or MMS or IM ...
1145  TSK_PHONE_NUMBER_HOME(75, "TSK_PHONE_NUMBER_HOME", //NON-NLS
1146  bundle.getString("BlackboardAttribute.tskPhoneNumberHome.text"),
1148  TSK_PHONE_NUMBER_OFFICE(76, "TSK_PHONE_NUMBER_OFFICE", //NON-NLS
1149  bundle.getString("BlackboardAttribute.tskPhoneNumberOffice.text"),
1151  TSK_PHONE_NUMBER_MOBILE(77, "TSK_PHONE_NUMBER_MOBILE", //NON-NLS
1152  bundle.getString("BlackboardAttribute.tskPhoneNumberMobile.text"),
1154  TSK_PHONE_NUMBER_FROM(78, "TSK_PHONE_NUMBER_FROM", //NON-NLS
1155  bundle.getString("BlackboardAttribute.tskPhoneNumberFrom.text"),
1157  TSK_PHONE_NUMBER_TO(79, "TSK_PHONE_NUMBER_TO", //NON-NLS
1158  bundle.getString("BlackboardAttribute.tskPhoneNumberTo.text"),
1160  TSK_DIRECTION(80, "TSK_DIRECTION", //NON-NLS
1161  bundle.getString("BlackboardAttribute.tskDirection.text"),
1162  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Msg/Call direction: incoming, outgoing
1163  TSK_EMAIL_HOME(81, "TSK_EMAIL_HOME", //NON-NLS
1164  bundle.getString("BlackboardAttribute.tskEmailHome.text"),
1166  TSK_EMAIL_OFFICE(82, "TSK_EMAIL_OFFICE", //NON-NLS
1167  bundle.getString("BlackboardAttribute.tskEmailOffice.text"),
1169  TSK_DATETIME_START(83, "TSK_DATETIME_START", //NON-NLS
1170  bundle.getString("BlackboardAttribute.tskDateTimeStart.text"),
1171  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME), // start time of an event - call log, Calendar entry
1172  TSK_DATETIME_END(84, "TSK_DATETIME_END", //NON-NLS
1173  bundle.getString("BlackboardAttribute.tskDateTimeEnd.text"),
1174  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME), // end time of an event - call log, Calendar entry
1175  TSK_CALENDAR_ENTRY_TYPE(85, "TSK_CALENDAR_ENTRY_TYPE", //NON-NLS
1176  bundle.getString("BlackboardAttribute.tskCalendarEntryType.text"),
1177  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // meeting, task,
1178  TSK_LOCATION(86, "TSK_LOCATION", //NON-NLS
1179  bundle.getString("BlackboardAttribute.tskLocation.text"),
1180  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Location string associated with an event - Conf Room Name, Address ....
1181  TSK_SHORTCUT(87, "TSK_SHORTCUT", //NON-NLS
1182  bundle.getString("BlackboardAttribute.tskShortcut.text"),
1183  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // 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.
1184  TSK_DEVICE_NAME(88, "TSK_DEVICE_NAME", //NON-NLS
1185  bundle.getString("BlackboardAttribute.tskDeviceName.text"),
1186  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // device name - a user assigned (usually) device name - such as "Joe's computer", "bob_win8", "BT Headset"
1187  TSK_CATEGORY(89, "TSK_CATEGORY", //NON-NLS
1188  bundle.getString("BlackboardAttribute.tskCategory.text"),
1189  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // category/type, possible value set varies by the artifact
1190  TSK_EMAIL_REPLYTO(90, "TSK_EMAIL_REPLYTO", //NON-NLS
1191  bundle.getString("BlackboardAttribute.tskEmailReplyTo.text"),
1192  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // ReplyTo address
1193  TSK_SERVER_NAME(91, "TSK_SERVER_NAME", //NON-NLS
1194  bundle.getString("BlackboardAttribute.tskServerName.text"),
1195  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // server name, e.g. a mail server name - "smtp.google.com", a DNS server name...
1196  TSK_COUNT(92, "TSK_COUNT", //NON-NLS
1197  bundle.getString("BlackboardAttribute.tskCount.text"),
1198  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER), // Count related to the artifact
1199  TSK_MIN_COUNT(93, "TSK_MIN_COUNT", //NON-NLS
1200  bundle.getString("BlackboardAttribute.tskMinCount.text"),
1201  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER), // Minimum number/count
1202  TSK_PATH_SOURCE(94, "TSK_PATH_SOURCE", //NON-NLS
1203  bundle.getString("BlackboardAttribute.tskPathSource.text"),
1204  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Path to a source file related to the artifact
1205  TSK_PERMISSIONS(95, "TSK_PERMISSIONS", //NON-NLS
1206  bundle.getString("BlackboardAttribute.tskPermissions.text"),
1208  TSK_ASSOCIATED_ARTIFACT(96, "TSK_ASSOCIATED_ARTIFACT", //NON-NLS
1209  bundle.getString("BlackboardAttribute.tskAssociatedArtifact.text"),
1210  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.LONG), // Artifact ID of a related artifact
1211  TSK_ISDELETED(97, "TSK_ISDELETED", //NON-NLS
1212  bundle.getString("BlackboardAttribute.tskIsDeleted.text"),
1213  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // boolean to indicate that the artifact is recovered fom deleted content
1214  TSK_GEO_LATITUDE_START(98, "TSK_GEO_LATITUDE_START", //NON-NLS
1215  bundle.getString("BlackboardAttribute.tskGeoLatitudeStart.text"),
1216  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE), // Starting location lattitude
1217  TSK_GEO_LATITUDE_END(99, "TSK_GEO_LATITUDE_END", //NON-NLS
1218  bundle.getString("BlackboardAttribute.tskGeoLatitudeEnd.text"),
1219  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE), // Ending location lattitude
1220  TSK_GEO_LONGITUDE_START(100, "TSK_GEO_LONGITUDE_START", //NON-NLS
1221  bundle.getString("BlackboardAttribute.tskGeoLongitudeStart.text"),
1222  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE), // Starting location longitude
1223  TSK_GEO_LONGITUDE_END(101, "TSK_GEO_LONGITUDE_END", //NON-NLS
1224  bundle.getString("BlackboardAttribute.tskGeoLongitudeEnd.text"),
1225  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE), //Ending Location longitude
1226  TSK_READ_STATUS(102, "TSK_READ_STATUS", //NON-NLS
1227  bundle.getString("BlackboardAttribute.tskReadStatus.text"),
1228  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER), // Message read status: 1 if read, 0 if unread
1229  TSK_LOCAL_PATH(103, "TSK_LOCAL_PATH", //NON-NLS
1230  bundle.getString("BlackboardAttribute.tskLocalPath.text"),
1231  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Local path to a network drive
1232  TSK_REMOTE_PATH(104, "TSK_REMOTE_PATH", //NON-NLS
1233  bundle.getString("BlackboardAttribute.tskRemotePath.text"),
1234  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Remote path of a network drive
1235  TSK_TEMP_DIR(105, "TSK_TEMP_DIR", //NON-NLS
1236  bundle.getString("BlackboardAttribute.tskTempDir.text"),
1237  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Default temporary files directory
1238  TSK_PRODUCT_ID(106, "TSK_PRODUCT_ID", //NON-NLS
1239  bundle.getString("BlackboardAttribute.tskProductId.text"),
1241  TSK_OWNER(107, "TSK_OWNER", //NON-NLS
1242  bundle.getString("BlackboardAttribute.tskOwner.text"),
1243  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Registered owner of a piece of software
1244  TSK_ORGANIZATION(108, "TSK_ORGANIZATION", //NON-NLS
1245  bundle.getString("BlackboardAttribute.tskOrganization.text"),
1246  TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING), // Registered Organization for a piece of software
1247  TSK_CARD_NUMBER(109, "TSK_CARD_NUMBER", //NON-NLS
1248  bundle.getString("BlackboardAttribute.tskCardNumber.text"),
1250  TSK_CARD_EXPIRATION(110, "TSK_CARD_EXPIRATION", //for card as 4 digits MMYY //NON-NLS
1251  bundle.getString("BlackboardAttribute.tskCardExpiration.text"),
1253  TSK_CARD_SERVICE_CODE(111, "TSK_CARD_SERVICE_CODE", // 3 digits //NON-NLS
1254  bundle.getString("BlackboardAttribute.tskCardServiceCode.text"),
1256  TSK_CARD_DISCRETIONARY(112, "TSK_CARD_DISCRETIONARY", //data used at the discretion of the issuer //NON-NLS
1257  bundle.getString("BlackboardAttribute.tskCardDiscretionary.text"),
1259  TSK_CARD_LRC(113, "TSK_CARD_LRC", //NON-NLS //Longitudunal Redundancy Check character //NON-NLS
1260  bundle.getString("BlackboardAttribute.tskCardLRC.text"),
1262  TSK_KEYWORD_SEARCH_DOCUMENT_ID(114, "TSK_KEYWORD_SEARCH_DOCUMENT_ID", //NON-NLS
1263  bundle.getString("BlackboardAttribute.tskKeywordSearchDocumentID.text"),
1265  TSK_CARD_SCHEME(115, "TSK_CARD_SCHEME", //amex, visa, mastercard, discover, etc //NON-NLS
1266  bundle.getString("BlackboardAttribute.tskCardScheme.text"),
1268  TSK_CARD_TYPE(116, "TSK_CARD_TYPE", // debit vs credit //NON-NLS
1269  bundle.getString("BlackboardAttribute.tskCardType.text"),
1271  TSK_BRAND_NAME(117, "TSK_BRAND_NAME",
1272  bundle.getString("BlackboardAttribute.tskBrandName.text"),
1274  TSK_BANK_NAME(118, "TSK_BANK_NAME",
1275  bundle.getString("BlackboardAttribute.tskBankName.text"),
1277  TSK_COUNTRY(119, "TSK_COUNTRY",
1278  bundle.getString("BlackboardAttribute.tskCountry.text"),
1280  TSK_CITY(120, "TSK_CITY",
1281  bundle.getString("BlackboardAttribute.tskCity.text"),
1283  TSK_ACCOUNT_TYPE(121, "TSK_ACCOUNT_TYPE",
1284  bundle.getString("BlackboardAttribute.tskAccountType.text"),
1289  TSK_KEYWORD_SEARCH_TYPE(122, "TSK_KEYWORD_SEARCH_TYPE", //NON-NLS
1290  bundle.getString("BlackboardAttribute.tskKeywordSearchType.text"),
1292  TSK_HEADERS(123, "TSK_HEADERS", //NON-NLS
1293  bundle.getString("BlackboardAttribute.tskHeaders.text"),
1295 
1296  private final int typeID;
1297  private final String typeName;
1298  private final String displayName;
1300 
1309  private ATTRIBUTE_TYPE(int typeID, String typeName, String displayName, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType) {
1310  this.typeID = typeID;
1311  this.typeName = typeName;
1312  this.displayName = displayName;
1313  this.valueType = valueType;
1314  }
1315 
1321  public int getTypeID() {
1322  return this.typeID;
1323  }
1324 
1333  public String getLabel() {
1334  return this.typeName;
1335  }
1336 
1342  public String getDisplayName() {
1343  return this.displayName;
1344  }
1345 
1352  return this.valueType;
1353  }
1354 
1368  static public ATTRIBUTE_TYPE fromID(int typeID) {
1369  for (ATTRIBUTE_TYPE attrType : ATTRIBUTE_TYPE.values()) {
1370  if (attrType.getTypeID() == typeID) {
1371  return attrType;
1372  }
1373  }
1374  throw new IllegalArgumentException("No ATTRIBUTE_TYPE matching type: " + typeID);
1375  }
1376 
1390  static public ATTRIBUTE_TYPE fromLabel(String typeName) {
1391  for (ATTRIBUTE_TYPE attrType : ATTRIBUTE_TYPE.values()) {
1392  if (attrType.getLabel().equals(typeName)) {
1393  return attrType;
1394  }
1395  }
1396  throw new IllegalArgumentException("No ATTRIBUTE_TYPE matching type: " + typeName);
1397  }
1398 
1399  }
1400 
1417  @Deprecated
1418  public BlackboardAttribute(int attributeTypeID, String moduleName, int valueInt) throws IllegalArgumentException {
1419  this(ATTRIBUTE_TYPE.fromID(attributeTypeID), moduleName, valueInt);
1420  }
1421 
1439  @Deprecated
1440  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
1441  int valueInt) {
1442  this(attributeTypeID, moduleName, valueInt);
1443  this.context = replaceNulls(context);
1444  }
1445 
1464  @Deprecated
1465  public BlackboardAttribute(int attributeTypeID, String moduleName,
1466  long valueLong) throws IllegalArgumentException {
1467  this(ATTRIBUTE_TYPE.fromID(attributeTypeID), moduleName, valueLong);
1468  }
1469 
1489  @Deprecated
1490  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
1491  long valueLong) {
1492  this(attributeTypeID, moduleName, valueLong);
1493  this.context = replaceNulls(context);
1494  }
1495 
1512  @Deprecated
1513  public BlackboardAttribute(int attributeTypeID, String moduleName,
1514  double valueDouble) throws IllegalArgumentException {
1515  this(ATTRIBUTE_TYPE.fromID(attributeTypeID), moduleName, valueDouble);
1516  }
1517 
1535  @Deprecated
1536  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
1537  double valueDouble) {
1538  this(attributeTypeID, moduleName, valueDouble);
1539  this.context = replaceNulls(context);
1540  }
1541 
1558  @Deprecated
1559  public BlackboardAttribute(int attributeTypeID, String moduleName, String valueString) throws IllegalArgumentException {
1560  this(ATTRIBUTE_TYPE.fromID(attributeTypeID), moduleName, valueString);
1561  }
1562 
1580  @Deprecated
1581  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
1582  String valueString) {
1583  this(attributeTypeID, moduleName, valueString);
1584  this.context = replaceNulls(context);
1585  }
1586 
1603  @Deprecated
1604  public BlackboardAttribute(int attributeTypeID, String moduleName, byte[] valueBytes) throws IllegalArgumentException {
1605  this(ATTRIBUTE_TYPE.fromID(attributeTypeID), moduleName, valueBytes);
1606  }
1607 
1625  @Deprecated
1626  public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
1627  byte[] valueBytes) {
1628  this(attributeTypeID, moduleName, valueBytes);
1629  this.context = replaceNulls(context);
1630  }
1631 
1642  @Deprecated
1643  protected void setArtifactID(long artifactID) {
1644  setArtifactId(artifactID);
1645  }
1646 
1658  @Deprecated
1659  protected void setCase(SleuthkitCase sleuthkitCase) {
1660  setCaseDatabase(sleuthkitCase);
1661  }
1662 
1670  @Deprecated
1671  public String getContext() {
1672  return context;
1673  }
1674 
1682  @Deprecated
1683  String getContextString() {
1684  return context;
1685  }
1686 
1694  @Deprecated
1695  public int getAttributeTypeID() {
1696  return attributeType.getTypeID();
1697  }
1698 
1708  @Deprecated
1709  public String getAttributeTypeName() throws TskCoreException {
1710  return attributeType.getTypeName();
1711  }
1712 
1723  @Deprecated
1725  return attributeType.getDisplayName();
1726  }
1727 
1736  @Deprecated
1737  public String getModuleName() {
1738  return sources;
1739  }
1740 
1741 }
BlackboardAttribute(int attributeTypeID, String moduleName, String context, byte[] valueBytes)
Type(int typeID, String typeName, String displayName, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType)
static String epochToTime(long epoch)
TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE getValueType()
BlackboardAttribute(Type attributeType, String source, long valueLong)
BlackboardAttribute(Type attributeType, String source, int valueInt)
BlackboardAttribute(int attributeTypeID, String moduleName, String context, int valueInt)
ATTRIBUTE_TYPE(int typeID, String typeName, String displayName, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType)
BlackboardArtifact getBlackboardArtifact(long artifactID)
static TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE fromLabel(String typeName)
TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE getValueType()
BlackboardAttribute(int attributeTypeID, String moduleName, int valueInt)
BlackboardAttribute(int attributeTypeID, String moduleName, String valueString)
BlackboardAttribute(int attributeTypeID, String moduleName, double valueDouble)
BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, String valueString)
BlackboardAttribute(Type attributeType, String source, byte[] valueBytes)
BlackboardAttribute(int attributeTypeID, String moduleName, String context, double valueDouble)
final TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType
BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, long valueLong)
BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, int valueInt)
BlackboardAttribute(Type attributeType, String source, double valueDouble)
BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, double valueDouble)
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)
Type(BlackboardAttribute.ATTRIBUTE_TYPE type)
BlackboardAttribute(int attributeTypeID, String moduleName, byte[] valueBytes)
BlackboardAttribute(ATTRIBUTE_TYPE attributeType, String source, byte[] valueBytes)
boolean sameType(BlackboardAttribute.Type that)
BlackboardAttribute(Type attributeType, String source, String valueString)

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.