19package org.sleuthkit.autopsy.datamodel;
21import org.sleuthkit.autopsy.actions.ViewArtifactAction;
22import org.sleuthkit.autopsy.actions.ViewOsAccountAction;
23import com.google.common.annotations.Beta;
24import com.google.common.cache.Cache;
25import com.google.common.cache.CacheBuilder;
26import java.beans.PropertyChangeEvent;
27import java.beans.PropertyChangeListener;
28import java.lang.ref.WeakReference;
29import java.text.MessageFormat;
30import java.util.ArrayList;
31import java.util.Arrays;
32import java.util.Collections;
33import java.util.EnumSet;
34import java.util.LinkedHashMap;
37import java.util.MissingResourceException;
38import java.util.Optional;
40import java.util.concurrent.ExecutionException;
41import java.util.concurrent.TimeUnit;
42import java.util.logging.Level;
43import java.util.stream.Collectors;
44import java.util.stream.Stream;
45import javax.swing.Action;
46import javax.swing.SwingUtilities;
47import org.apache.commons.lang3.StringUtils;
48import org.apache.commons.lang3.tuple.Pair;
49import org.openide.nodes.Node;
50import org.openide.nodes.Sheet;
51import org.openide.util.Lookup;
52import org.openide.util.NbBundle;
53import org.openide.util.NbBundle.Messages;
54import org.openide.util.Utilities;
55import org.openide.util.WeakListeners;
56import org.openide.util.lookup.Lookups;
57import org.sleuthkit.autopsy.actions.AddBlackboardArtifactTagAction;
58import org.sleuthkit.autopsy.actions.AddContentTagAction;
59import org.sleuthkit.autopsy.actions.DeleteFileBlackboardArtifactTagAction;
60import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction;
61import org.sleuthkit.autopsy.casemodule.Case;
62import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
63import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagAddedEvent;
64import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent;
65import org.sleuthkit.autopsy.casemodule.events.CommentChangedEvent;
66import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
67import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
68import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil;
69import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
70import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException;
71import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
72import org.sleuthkit.autopsy.core.UserPreferences;
73import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
74import org.sleuthkit.autopsy.coreutils.Logger;
75import static org.sleuthkit.autopsy.datamodel.DisplayableItemNode.findLinked;
76import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.HasCommentStatus;
77import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.backgroundTasksPool;
78import org.sleuthkit.autopsy.timeline.actions.ViewArtifactInTimelineAction;
79import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction;
80import org.sleuthkit.datamodel.AbstractFile;
81import org.sleuthkit.datamodel.BlackboardArtifact;
82import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
83import org.sleuthkit.datamodel.BlackboardAttribute;
84import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
85import org.sleuthkit.datamodel.Content;
86import org.sleuthkit.datamodel.Tag;
87import org.sleuthkit.datamodel.TskCoreException;
88import org.sleuthkit.autopsy.datamodel.utils.IconsUtil;
89import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
90import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
91import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
92import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.NO_DESCR;
93import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
94import org.sleuthkit.autopsy.datamodel.utils.FileNameTransTask;
95import org.sleuthkit.autopsy.directorytree.ExportCSVAction;
96import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
97import org.sleuthkit.autopsy.directorytree.ExternalViewerShortcutAction;
98import org.sleuthkit.autopsy.directorytree.ExtractAction;
99import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
100import org.sleuthkit.autopsy.directorytree.ViewContextAction;
101import org.sleuthkit.autopsy.modules.embeddedfileextractor.ExtractArchiveWithPasswordAction;
102import org.sleuthkit.datamodel.AnalysisResult;
103import org.sleuthkit.datamodel.BlackboardArtifact.Category;
104import org.sleuthkit.datamodel.HostAddress;
105import org.sleuthkit.datamodel.Pool;
106import org.sleuthkit.datamodel.DataArtifact;
107import org.sleuthkit.datamodel.DerivedFile;
108import org.sleuthkit.datamodel.Directory;
109import org.sleuthkit.datamodel.File;
110import org.sleuthkit.datamodel.LayoutFile;
111import org.sleuthkit.datamodel.LocalDirectory;
112import org.sleuthkit.datamodel.LocalFile;
113import org.sleuthkit.datamodel.OsAccount;
114import org.sleuthkit.datamodel.Report;
115import org.sleuthkit.datamodel.Score;
116import org.sleuthkit.datamodel.SlackFile;
117import org.sleuthkit.datamodel.VirtualDirectory;
118import org.sleuthkit.datamodel.TskData;
119import org.sleuthkit.datamodel.Volume;
120import org.sleuthkit.datamodel.VolumeSystem;
121import org.sleuthkit.datamodel.Image;
136 private static final Cache<Long, Content>
contentCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build();
157 @SuppressWarnings(
"deprecation")
159 BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID(),
160 BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ITEM.getTypeID()
179 private final PropertyChangeListener
listener =
new PropertyChangeListener() {
181 public void propertyChange(PropertyChangeEvent evt) {
182 String eventType = evt.getPropertyName();
185 if (event.getAddedTag().getArtifact().equals(
artifact)) {
190 if (event.getDeletedTagInfo().getArtifactID() ==
artifact.getArtifactID()) {
195 if (event.getAddedTag().getContent().equals(
srcContent)) {
200 if (event.getDeletedTagInfo().getContentID() ==
srcContent.getId()) {
205 if (event.getContentID() ==
srcContent.getId()) {
209 if (evt.getNewValue() ==
null) {
225 String originalName = evt.getOldValue().toString();
228 setShortDescription(originalName);
230 Bundle.BlackboardArtifactNode_createSheet_srcFile_origName(),
231 Bundle.BlackboardArtifactNode_createSheet_srcFile_origDisplayName(),
265 throw new IllegalArgumentException(MessageFormat.format(
"Artifact missing source content (artifact objID={0})",
artifact));
276 }
catch (TskCoreException ex) {
277 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the unique path of the source content (artifact objID={0})",
artifact.getId()), ex);
282 setIconBaseWithExtension(iconPath !=
null && iconPath.charAt(0) ==
'/' ? iconPath.substring(1) : iconPath);
305 }
catch (TskCoreException ex) {
306 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the parent of the artifact for (artifact objID={0})",
artifact.getId()), ex);
318 }
catch (TskCoreException ex) {
319 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the unique path of the source content (artifact objID={0})",
artifact.getId()), ex);
322 throw new IllegalArgumentException(MessageFormat.format(
"Artifact missing source content (artifact objID={0})",
artifact));
328 setIconBaseWithExtension(iconPath !=
null && iconPath.charAt(0) ==
'/' ? iconPath.substring(1) : iconPath);
354 }
catch (TskCoreException ex) {
355 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the artifact type for artifact (artifact objID={0})",
artifact.getId()), ex);
377 if (useAssociatedFile) {
380 long srcObjectID =
artifact.getObjectID();
383 }
catch (ExecutionException ex) {
384 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source/associated content (artifact object ID={0})",
artifact.getId()), ex);
396 if (
artifact instanceof AnalysisResult) {
410 return Lookups.fixed(
artifact, artifactItem);
425 for (Content lookupContent : this.getLookup().lookupAll(Content.class)) {
435 if ((lookupContent !=
null) && (lookupContent.getId() !=
artifact.getId())) {
436 return lookupContent;
457 BlackboardAttribute attribute =
artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
458 if (attribute !=
null) {
459 return contentCache.get(attribute.getValueLong(), () ->
artifact.getSleuthkitCase().getContentById(attribute.getValueLong()));
461 }
catch (TskCoreException ex) {
462 logger.log(Level.WARNING, MessageFormat.format(
"Error getting content for path id attrbiute for artifact: ",
artifact.getId()), ex);
495 return this.artifact;
506 return Stream.of(items)
507 .filter(i -> i !=
null)
508 .collect(Collectors.toList());
514 List<List<Action>> actionsLists =
new ArrayList<>();
536 if (this.srcContent instanceof Report) {
541 int selectedFileCount = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class).size();
542 int selectedArtifactCount = Utilities.actionsGlobalContext().lookupAll(
BlackboardArtifactItem.class).size();
548 if (parentFileNode !=
null) {
553 actionsLists.add(
getTagActions(parentFileNode !=
null, this.artifact, selectedFileCount, selectedArtifactCount));
559 actionsLists.add(Arrays.asList(super.getActions(context)));
561 return actionsLists.stream()
563 .filter((lst) -> lst !=
null && !lst.isEmpty())
565 .flatMap(lst -> Stream.concat(Stream.of((Action)
null), lst.stream()))
568 .toArray(sz ->
new Action[sz]);
580 "BlackboardArtifactNode_getAssociatedTypeStr_webCache=Cached File",
581 "BlackboardArtifactNode_getAssociatedTypeStr_webDownload=Downloaded File",
582 "BlackboardArtifactNode_getAssociatedTypeStr_associated=Associated File",})
584 if (BlackboardArtifact.Type.TSK_WEB_CACHE.equals(
artifactType)) {
585 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_webCache();
586 }
else if (BlackboardArtifact.Type.TSK_WEB_DOWNLOAD.equals(
artifactType)) {
587 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_webDownload();
589 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_associated();
602 "BlackboardArtifactNode_getViewSrcContentAction_type_File=File",
603 "BlackboardArtifactNode_getViewSrcContentAction_type_DataArtifact=Data Artifact",
604 "BlackboardArtifactNode_getViewSrcContentAction_type_OSAccount=OS Account",
605 "BlackboardArtifactNode_getViewSrcContentAction_type_unknown=Item"
608 if (
content instanceof AbstractFile) {
609 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_File();
610 }
else if (
content instanceof DataArtifact) {
611 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_DataArtifact();
612 }
else if (
content instanceof OsAccount) {
613 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_OSAccount();
615 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_unknown();
631 "BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileAction=View {0} in Directory",
633 "BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileInTimelineAction=View {0} in Timeline..."
637 AbstractFile associatedFile = findLinked(
artifact);
638 if (associatedFile !=
null) {
639 return Arrays.asList(
641 Bundle.BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileAction(
645 Bundle.BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileInTimelineAction(
650 }
catch (TskCoreException ex) {
651 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting linked file of artifact (artifact objID={0})",
artifact.getId()), ex);
653 return Collections.emptyList();
665 "# {0} - contentType",
666 "BlackboardArtifactNode_getSrcContentAction_actionDisplayName=View Source {0} in Directory"
669 if (
content instanceof DataArtifact) {
672 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
674 }
else if (
content instanceof OsAccount) {
677 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
679 }
else if (
content instanceof AbstractFile ||
artifact instanceof DataArtifact) {
681 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
700 }
else if (
content instanceof Directory) {
702 }
else if (
content instanceof VirtualDirectory) {
704 }
else if (
content instanceof LocalDirectory) {
706 }
else if (
content instanceof LayoutFile) {
708 }
else if (
content instanceof LocalFile ||
content instanceof DerivedFile) {
710 }
else if (
content instanceof SlackFile) {
727 .contains(
"." + ((AbstractFile)
srcContent).getNameExtension().toLowerCase())) {
729 if (
srcContent.getArtifacts(BlackboardArtifact.Type.TSK_ENCRYPTION_DETECTED.getTypeID()).size() > 0) {
732 }
catch (TskCoreException ex) {
733 logger.log(Level.WARNING,
"Unable to add unzip with password action to context menus", ex);
751 private List<Action>
getTagActions(
boolean hasSrcFile, BlackboardArtifact
artifact,
int selectedFileCount,
int selectedArtifactCount) {
752 List<Action> actionsList =
new ArrayList<>();
755 if (hasSrcFile && !(
artifact instanceof DataArtifact)) {
762 if (hasSrcFile && (!(
artifact instanceof DataArtifact)) && (selectedFileCount == 1)) {
766 if (selectedArtifactCount == 1) {
782 "BlackboardArtifactNode_getSrcContentViewerActions_viewInNewWin=View Item in New Window",
783 "BlackboardArtifactNode_getSrcContentViewerActions_openInExtViewer=Open in External Viewer Ctrl+E"
786 List<Action> actionsList =
new ArrayList<>();
787 if (srcFileNode !=
null) {
788 actionsList.add(
new NewWindowViewAction(Bundle.BlackboardArtifactNode_getSrcContentViewerActions_viewInNewWin(), srcFileNode));
789 if (selectedFileCount == 1) {
790 actionsList.add(
new ExternalViewerAction(Bundle.BlackboardArtifactNode_getSrcContentViewerActions_openInExtViewer(), srcFileNode));
807 "# {0} - contentType",
808 "BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName=View Source {0} in Timeline... "
813 Bundle.BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName(
815 }
else if (
srcContent instanceof DataArtifact) {
819 Bundle.BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName(
822 }
catch (TskCoreException ex) {
823 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source data artifact timestamp (artifact objID={0})",
srcContent.getId()), ex);
839 "BlackboardArtifactNode_getTimelineArtifactAction_displayName=View Selected Item in Timeline... "
847 }
catch (TskCoreException ex) {
848 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting artifact timestamp (artifact objID={0})", art.getId()), ex);
865 "BlackboardArtifactNode.createSheet.srcFile.name=Source Name",
866 "BlackboardArtifactNode.createSheet.srcFile.displayName=Source Name",
867 "BlackboardArtifactNode.createSheet.srcFile.origName=Original Name",
868 "BlackboardArtifactNode.createSheet.srcFile.origDisplayName=Original Name",
869 "BlackboardArtifactNode.createSheet.artifactType.displayName=Result Type",
870 "BlackboardArtifactNode.createSheet.artifactType.name=Result Type",
871 "BlackboardArtifactNode.createSheet.artifactDetails.displayName=Result Details",
872 "BlackboardArtifactNode.createSheet.artifactDetails.name=Result Details",
873 "BlackboardArtifactNode.createSheet.artifactMD5.displayName=MD5 Hash",
874 "BlackboardArtifactNode.createSheet.artifactMD5.name=MD5 Hash",
875 "BlackboardArtifactNode.createSheet.fileSize.name=Size",
876 "BlackboardArtifactNode.createSheet.fileSize.displayName=Size",
877 "BlackboardArtifactNode.createSheet.path.displayName=Path",
878 "BlackboardArtifactNode.createSheet.path.name=Path"
884 @SuppressWarnings(
"deprecation")
890 Sheet sheet = super.createSheet();
891 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
892 if (sheetSet ==
null) {
893 sheetSet = Sheet.createPropertiesSet();
904 Bundle.BlackboardArtifactNode_createSheet_srcFile_name(),
905 Bundle.BlackboardArtifactNode_createSheet_srcFile_displayName(),
910 if (
artifact instanceof AnalysisResult
911 && !(
artifactType.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()
912 ||
artifactType.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID())) {
925 Bundle.BlackboardArtifactNode_createSheet_srcFile_origName(),
926 Bundle.BlackboardArtifactNode_createSheet_srcFile_origDisplayName(),
942 if (
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() ||
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_ITEM.getTypeID()) {
944 BlackboardAttribute attribute =
artifact.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
945 if (attribute !=
null) {
949 "BlackboardArtifactNode.createSheet.artifactType.name"),
951 "BlackboardArtifactNode.createSheet.artifactType.displayName"),
953 associatedArtifact.getDisplayName()));
956 "BlackboardArtifactNode.createSheet.artifactDetails.name"),
958 "BlackboardArtifactNode.createSheet.artifactDetails.displayName"),
960 associatedArtifact.getShortDescription()));
963 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting associated artifact with type " +
artifact.getArtifactTypeName() +
" artifact (objID={0}))",
artifact.getId()), ex);
971 Map<String, Object> map =
new LinkedHashMap<>();
973 for (Map.Entry<String, Object> entry : map.entrySet()) {
994 final int artifactTypeId =
artifact.getArtifactTypeID();
995 if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
997 String actualMimeType =
"";
999 AbstractFile file = (AbstractFile)
srcContent;
1000 ext = file.getNameExtension();
1001 actualMimeType = file.getMIMEType();
1002 if (actualMimeType ==
null) {
1003 actualMimeType =
"";
1009 "BlackboardArtifactNode.createSheet.ext.name"),
1011 "BlackboardArtifactNode.createSheet.ext.displayName"),
1016 "BlackboardArtifactNode.createSheet.mimeType.name"),
1018 "BlackboardArtifactNode.createSheet.mimeType.displayName"),
1028 String sourcePath =
"";
1031 }
catch (TskCoreException ex) {
1032 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting unique path of source content (artifact objID={0})",
artifact.getId()), ex);
1036 if (sourcePath.isEmpty() ==
false) {
1039 "BlackboardArtifactNode.createSheet.filePath.name"),
1041 "BlackboardArtifactNode.createSheet.filePath.displayName"),
1055 "ContentTagNode.createSheet.fileModifiedTime.name"),
1057 "ContentTagNode.createSheet.fileModifiedTime.displayName"),
1062 "ContentTagNode.createSheet.fileChangedTime.name"),
1064 "ContentTagNode.createSheet.fileChangedTime.displayName"),
1069 "ContentTagNode.createSheet.fileAccessedTime.name"),
1071 "ContentTagNode.createSheet.fileAccessedTime.displayName"),
1076 "ContentTagNode.createSheet.fileCreatedTime.name"),
1078 "ContentTagNode.createSheet.fileCreatedTime.displayName"),
1083 "ContentTagNode.createSheet.fileSize.name"),
1085 "ContentTagNode.createSheet.fileSize.displayName"),
1087 file ==
null ?
"" : file.getSize()));
1089 Bundle.BlackboardArtifactNode_createSheet_artifactMD5_name(),
1090 Bundle.BlackboardArtifactNode_createSheet_artifactMD5_displayName(),
1092 file ==
null ?
"" : StringUtils.defaultString(file.getMd5Hash())));
1095 String dataSourceStr =
"";
1097 Content dataSource =
srcContent.getDataSource();
1098 if (dataSource !=
null) {
1099 dataSourceStr = dataSource.getName();
1103 }
catch (TskCoreException ex) {
1104 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source data source name (artifact objID={0})",
artifact.getId()), ex);
1108 if (dataSourceStr.isEmpty() ==
false) {
1111 "BlackboardArtifactNode.createSheet.dataSrc.name"),
1113 "BlackboardArtifactNode.createSheet.dataSrc.displayName"),
1123 if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
1128 size = af.getSize();
1130 path = af.getUniquePath();
1131 }
catch (TskCoreException ex) {
1132 path = af.getParentPath();
1138 "BlackboardArtifactNode.createSheet.fileSize.name"),
1140 "BlackboardArtifactNode.createSheet.fileSize.displayName"),
1146 "BlackboardArtifactNode.createSheet.path.name"),
1148 "BlackboardArtifactNode.createSheet.path.displayName"),
1153 if (scoTask !=
null) {
1154 backgroundTasksPool.submit(scoTask);
1159 Optional<Sheet.Set> enrichmentSet = enricher.getEnrichment(
artifact);
1160 enrichmentSet.ifPresent(s -> {
1161 if (sheet.get(s.getName()) !=
null) {
1162 logger.log(Level.WARNING, String.format(
"Enricher %s returned a Sheet.Set with duplicate name '%s' for artifact %d; skipping to avoid overwriting existing properties",
1163 enricher.getClass().getName(), s.getName(),
artifact.getArtifactID()));
1168 }
catch (Exception ex) {
1169 logger.log(Level.WARNING, String.format(
"Error getting property enrichment from %s for artifact %d",
1170 enricher.getClass().getName(),
artifact.getArtifactID()), ex);
1185 List<Tag>
tags =
new ArrayList<>();
1190 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting tags for artifact and its source content (artifact objID={0})",
artifact.getId()), ex);
1218 for (Tag tag :
tags) {
1219 if (!StringUtils.isBlank(tag.getComment())) {
1237 logger.log(Level.SEVERE,
"Attempted to Query CR for presence of comments in a Blackboard Artifact node and was unable to perform query, comment column will only reflect caseDB", ex);
1245 String description = defaultDescription;
1250 }
else if (attribute !=
null) {
1251 description = Bundle.BlackboardArtifactNode_createSheet_count_noCorrelationValues_description();
1254 logger.log(Level.SEVERE, MessageFormat.format(
"Error querying central repository for other occurences count (artifact objID={0}, corrAttrType={1}, corrAttrValue={2})",
artifact.getId(), attribute.
getCorrelationType(), attribute.
getCorrelationValue()), ex);
1256 logger.log(Level.WARNING, MessageFormat.format(
"Error normalizing correlation attribute for central repository query (artifact objID={0}, corrAttrType={2}, corrAttrValue={3})",
artifact.getId(), attribute.
getCorrelationType(), attribute.
getCorrelationValue()), ex);
1258 return Pair.of(count, description);
1265 SwingUtilities.invokeLater(() -> {
1280 while ((parent = parent.getParent()) !=
null) {
1281 parentName = parent.getName();
1283 }
catch (TskCoreException ex) {
1284 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting root ancestor name for source content (artifact objID={0})",
artifact.getId()), ex);
1311 @SuppressWarnings(
"deprecation")
1314 for (BlackboardAttribute attribute :
artifact.getAttributes()) {
1315 final int attributeTypeID = attribute.getAttributeType().getTypeID();
1316 if (attributeTypeID == ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()
1317 || attributeTypeID == ATTRIBUTE_TYPE.TSK_TAGGED_ARTIFACT.getTypeID()
1318 || attributeTypeID == ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()
1319 || attributeTypeID == ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()
1320 || attributeTypeID == ATTRIBUTE_TYPE.TSK_KEYWORD_SEARCH_TYPE.getTypeID()
1321 || attribute.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON) {
1327 if (attribute.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON
1329 attribute.getAttributeType().getTypeName())) {
1332 }
else if (
artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
1334 }
else if (attribute.getAttributeType().getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
1336 }
else if (
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getTypeID()
1337 && attributeTypeID == ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) {
1346 String value = attribute.getDisplayString();
1347 if (value.length() > 512) {
1348 value = value.substring(0, 512);
1350 map.put(attribute.getAttributeType().getDisplayName(), value);
1352 switch (attribute.getAttributeType().getValueType()) {
1354 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueInt());
1357 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueDouble());
1360 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueLong());
1363 map.put(attribute.getAttributeType().getDisplayName(), attribute.getDisplayString());
1369 }
catch (TskCoreException ex) {
1370 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting artifact attributes (artifact objID={0})",
artifact.getId()), ex);
1384 final int attributeTypeID = attribute.getAttributeType().getTypeID();
1385 if (attributeTypeID == ATTRIBUTE_TYPE.TSK_DATETIME_SENT.getTypeID()
1386 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML.getTypeID()
1387 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF.getTypeID()
1388 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_BCC.getTypeID()
1389 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CC.getTypeID()
1390 || attributeTypeID == ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID()) {
1394 }
else if (attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN.getTypeID()) {
1395 String value = attribute.getDisplayString();
1396 if (value.length() > 160) {
1397 value = value.substring(0, 160) +
"...";
1399 map.put(attribute.getAttributeType().getDisplayName(), value);
1400 }
else if (attribute.getAttributeType().getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
1403 map.put(attribute.getAttributeType().getDisplayName(), attribute.getDisplayString());
1409 return visitor.
visit(
this);
1419 return getClass().getName();
1424 return visitor.
visit(
this);
1428 "BlackboardArtifactNode_analysisSheet_sourceType_name=Source Type",
1429 "BlackboardArtifactNode_analysisSheet_soureName_name=Source Name",
1430 "BlackboardArtifactNode_analysisSheet_score_name=Score",
1431 "BlackboardArtifactNode_analysisSheet_conclusion_name=Conclusion",
1432 "BlackboardArtifactNode_analysisSheet_configuration_name=Configuration",
1433 "BlackboardArtifactNode_analysisSheet_justifaction_name=Justification"
1444 Bundle.BlackboardArtifactNode_analysisSheet_soureName_name(),
1445 Bundle.BlackboardArtifactNode_analysisSheet_soureName_name(),
1452 Bundle.BlackboardArtifactNode_analysisSheet_sourceType_name(),
1453 Bundle.BlackboardArtifactNode_analysisSheet_sourceType_name(),
1458 Bundle.BlackboardArtifactNode_analysisSheet_score_name(),
1459 Bundle.BlackboardArtifactNode_analysisSheet_score_name(),
1461 result.getScore().getSignificance().getDisplayName()));
1464 Bundle.BlackboardArtifactNode_analysisSheet_conclusion_name(),
1465 Bundle.BlackboardArtifactNode_analysisSheet_conclusion_name(),
1467 result.getConclusion()));
1470 Bundle.BlackboardArtifactNode_analysisSheet_configuration_name(),
1471 Bundle.BlackboardArtifactNode_analysisSheet_configuration_name(),
1473 result.getConfiguration()));
1476 Bundle.BlackboardArtifactNode_analysisSheet_justifaction_name(),
1477 Bundle.BlackboardArtifactNode_analysisSheet_justifaction_name(),
1479 result.getJustification()));
1494 Bundle.BlackboardArtifactNode_createSheet_score_name(),
1495 Bundle.BlackboardArtifactNode_createSheet_score_displayName(),
1499 Bundle.BlackboardArtifactNode_createSheet_comment_name(),
1500 Bundle.BlackboardArtifactNode_createSheet_comment_displayName(),
1505 Bundle.BlackboardArtifactNode_createSheet_count_name(),
1506 Bundle.BlackboardArtifactNode_createSheet_count_displayName(),
1510 return new GetSCOTask(
new WeakReference<>(
this),
weakListener);
1526 if (source instanceof BlackboardArtifact) {
1527 BlackboardArtifact srcArtifact = (BlackboardArtifact) source;
1529 return srcArtifact.getType().getDisplayName();
1530 }
catch (TskCoreException ex) {
1531 logger.log(Level.SEVERE,
"Failed to get custom artifact type id=" + source.getId(), ex);
1534 return TskData.ObjectType.VOL.toString();
1535 }
else if (
srcContent instanceof AbstractFile) {
1536 return TskData.ObjectType.ABSTRACTFILE.toString();
1538 return TskData.ObjectType.IMG.toString();
1539 }
else if (
srcContent instanceof VolumeSystem) {
1540 return TskData.ObjectType.VS.toString();
1541 }
else if (
srcContent instanceof OsAccount) {
1542 return TskData.ObjectType.OS_ACCOUNT.toString();
1543 }
else if (
srcContent instanceof HostAddress) {
1544 return TskData.ObjectType.HOST_ADDRESS.toString();
1546 return TskData.ObjectType.POOL.toString();
1558 SwingUtilities.invokeLater(
new Runnable() {
1561 if (scoData.getScoreAndDescription() !=
null) {
1563 Bundle.BlackboardArtifactNode_createSheet_score_name(),
1564 Bundle.BlackboardArtifactNode_createSheet_score_displayName(),
1565 scoData.getScoreAndDescription().getRight(),
1566 scoData.getScoreAndDescription().getLeft()));
1568 if (scoData.getComment() !=
null) {
1570 Bundle.BlackboardArtifactNode_createSheet_comment_name(),
1571 Bundle.BlackboardArtifactNode_createSheet_comment_displayName(),
1574 if (scoData.getCountAndDescription() !=
null) {
1576 Bundle.BlackboardArtifactNode_createSheet_count_name(),
1577 Bundle.BlackboardArtifactNode_createSheet_count_displayName(),
1578 scoData.getCountAndDescription().getRight(),
1579 scoData.getCountAndDescription().getLeft()));
1589 if (
srcContent instanceof BlackboardArtifact) {
1591 setDisplayName(((BlackboardArtifact)
srcContent).getShortDescription());
1592 }
catch (TskCoreException ex) {
1595 logger.log(Level.WARNING,
"Failed to get short description for artifact id = " +
srcContent.getId(), ex);
1598 }
else if (
srcContent instanceof OsAccount) {
1604 setShortDescription(getDisplayName());
1619 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.score.name=S",
1620 "BlackboardArtifactNode.createSheet.score.displayName=S",
1621 "BlackboardArtifactNode.createSheet.notableFile.description=Associated file recognized as notable.",
1622 "BlackboardArtifactNode.createSheet.interestingResult.description=Result has an interesting result associated with it.",
1623 "BlackboardArtifactNode.createSheet.taggedItem.description=Result or associated file has been tagged.",
1624 "BlackboardArtifactNode.createSheet.notableTaggedItem.description=Result or associated file tagged with notable tag.",
1625 "BlackboardArtifactNode.createSheet.noScore.description=No score"})
1629 sheetSet.put(
new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_score_name(), Bundle.BlackboardArtifactNode_createSheet_score_displayName(), scoreAndDescription.getRight(), scoreAndDescription.getLeft()));
1641 @NbBundle.Messages({
1642 "BlackboardArtifactNode.createSheet.tags.displayName=Tags"}
1646 List<Tag>
tags =
new ArrayList<>();
1651 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting tags for artifact and source content (artifact objID={0})",
artifact.getId()), ex);
1653 sheetSet.put(
new NodeProperty<>(
"Tags", Bundle.BlackboardArtifactNode_createSheet_tags_displayName(),
NO_DESCR,
tags.stream().map(t -> t.getName().getDisplayName()).collect(Collectors.joining(
", "))));
1669 sheetSet.put(
new NodeProperty<>(
"Tags", Bundle.BlackboardArtifactNode_createSheet_tags_displayName(),
NO_DESCR,
tags.stream().map(t -> t.getName().getDisplayName()).collect(Collectors.joining(
", "))));
1684 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.count.name=O",
1685 "BlackboardArtifactNode.createSheet.count.displayName=O",
1686 "BlackboardArtifactNode.createSheet.count.noCorrelationAttributes.description=No correlation properties found",
1687 "BlackboardArtifactNode.createSheet.count.noCorrelationValues.description=Unable to find other occurrences because no value exists for the available correlation property",
1688 "# {0} - occurrenceCount",
1689 "# {1} - attributeType",
1690 "BlackboardArtifactNode.createSheet.count.description=There were {0} datasource(s) found with occurrences of the correlation value of type {1}"})
1693 Pair<Long, String> countAndDescription =
getCountPropertyAndDescription(attribute, Bundle.BlackboardArtifactNode_createSheet_count_noCorrelationAttributes_description());
1694 sheetSet.put(
new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_count_name(), Bundle.BlackboardArtifactNode_createSheet_count_displayName(), countAndDescription.getRight(), countAndDescription.getLeft()));
1711 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.comment.name=C",
1712 "BlackboardArtifactNode.createSheet.comment.displayName=C"})
1715 List<CorrelationAttributeInstance> attributes =
new ArrayList<>();
1716 attributes.add(attribute);
1718 sheetSet.put(
new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_comment_name(), Bundle.BlackboardArtifactNode_createSheet_comment_displayName(),
NO_DESCR, status));
static synchronized AddBlackboardArtifactTagAction getInstance()
static synchronized AddContentTagAction getInstance()
static synchronized DeleteFileBlackboardArtifactTagAction getInstance()
static synchronized DeleteFileContentTagAction getInstance()
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
SleuthkitCase getSleuthkitCase()
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
TagsManager getTagsManager()
static boolean commentExistsOnAttributes(List< CorrelationAttributeInstance > attributes)
String getCorrelationValue()
Type getCorrelationType()
static boolean displayTranslatedFileNames()
static boolean getHideSCOColumns()
synchronized static Logger getLogger(String name)
static String getFormattedTime(long epochTime)
static final String NO_DESCR
static final String VALUE_LOADING
Pair< Score, String > getScorePropertyAndDescription()
void setName(String name)
void addEmailMsgProperty(Map< String, Object > map, BlackboardAttribute attribute)
volatile String translatedSourceName
void updateSCOColumns(final SCOData scoData)
final void addCountProperty(Sheet.Set sheetSet, CorrelationAttributeInstance attribute)
static final Integer[] SHOW_FILE_METADATA
static final Set< Case.Events > CASE_EVENTS_OF_INTEREST
static final Logger logger
final void addCommentProperty(Sheet.Set sheetSet, List< Tag > tags, CorrelationAttributeInstance attribute)
BlackboardArtifact getArtifact()
String getSourceObjType(Content source)
void fillPropertyMap(Map< String, Object > map, BlackboardArtifact artifact)
final PropertyChangeListener listener
void unregisterListener()
void setDisplayNameBySourceContent()
BlackboardArtifactNode(BlackboardArtifact artifact, boolean useAssociatedFileInLookup)
static final Cache< Long, Content > contentCache
String getRootAncestorName()
final String sourceObjTypeName
DataResultViewerTable.HasCommentStatus getCommentProperty(List< Tag > tags, List< CorrelationAttributeInstance > attributes)
static Content getPathIdFile(BlackboardArtifact artifact)
BlackboardArtifactNode(BlackboardArtifact artifact, String iconPath)
String getAssociatedTypeStr(BlackboardArtifact.Type artifactType)
Pair< Long, String > getCountPropertyAndDescription(CorrelationAttributeInstance attribute, String defaultDescription)
final PropertyChangeListener weakListener
void addTagProperty(Sheet.Set sheetSet)
BlackboardArtifactNode(BlackboardArtifact artifact)
static final java.util.Collection<? extends ArtifactPropertyEnricher > ENRICHERS
String getContentTypeStr(Content content)
Content getSourceContentFromLookup(BlackboardArtifact artifact)
GetSCOTask addSCOColumns(Sheet.Set sheetSet)
List< Action > getSrcContentViewerActions(Node srcFileNode, int selectedFileCount)
Action getViewSrcContentAction(BlackboardArtifact artifact, Content content)
GetSCOTask updateSheetForAnalysisResult(AnalysisResult result, Sheet.Set sheetSet)
List< NodeProperty<? extends Object > > customProperties
Action getTimelineArtifactAction(BlackboardArtifact art)
final void addScorePropertyAndDescription(Sheet.Set sheetSet, List< Tag > tags)
final List< Tag > getAllTagsFromDatabase()
final BlackboardArtifact.Type artifactType
Action getTimelineSrcContentAction(Content srcContent)
static Lookup createLookup(BlackboardArtifact artifact, boolean useAssociatedFile)
final void addTagProperty(Sheet.Set sheetSet, List< Tag > tags)
List< Action > getAssociatedFileActions(BlackboardArtifact artifact, BlackboardArtifact.Type artifactType)
Action[] getActions(boolean context)
Node getParentFileNode(Content content)
Action getExtractWithPasswordAction(Content srcContent)
static BlackboardArtifact.Type getType(BlackboardArtifact artifact)
final BlackboardArtifact artifact
void addNodeProperty(NodeProperty<?> property)
List< Action > getNonNull(Action... items)
List< Action > getTagActions(boolean hasSrcFile, BlackboardArtifact artifact, int selectedFileCount, int selectedArtifactCount)
static void addCtJsonProperties(Map< String, Object > map, String json)
static final String CT_JSON_ATTRIBUTE_TYPE_NAME
static List< Action > getActions(File file, boolean isArtifactSource)
static List< String > getArchiveExtensions()
static String getPropertyName()
static String getIconFilePath(int typeID)
static synchronized ExportCSVAction getInstance()
static synchronized ExternalViewerShortcutAction getInstance()
synchronized boolean hasProvider()
static TextTranslationService getInstance()
static boolean hasSupportedTimeStamp(BlackboardArtifact artifact)
BLACKBOARD_ARTIFACT_TAG_DELETED
BLACKBOARD_ARTIFACT_TAG_ADDED
Long getCountCasesWithOtherInstances(CorrelationAttributeInstance instance)
static CentralRepository getInstance()
static boolean isEnabled()
T visit(DataSourceFilesNode in)