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;
39import java.util.concurrent.ExecutionException;
40import java.util.concurrent.TimeUnit;
41import java.util.logging.Level;
42import java.util.stream.Collectors;
43import java.util.stream.Stream;
44import javax.swing.Action;
45import javax.swing.SwingUtilities;
46import org.apache.commons.lang3.StringUtils;
47import org.apache.commons.lang3.tuple.Pair;
48import org.openide.nodes.Node;
49import org.openide.nodes.Sheet;
50import org.openide.util.Lookup;
51import org.openide.util.NbBundle;
52import org.openide.util.NbBundle.Messages;
53import org.openide.util.Utilities;
54import org.openide.util.WeakListeners;
55import org.openide.util.lookup.Lookups;
56import org.sleuthkit.autopsy.actions.AddBlackboardArtifactTagAction;
57import org.sleuthkit.autopsy.actions.AddContentTagAction;
58import org.sleuthkit.autopsy.actions.DeleteFileBlackboardArtifactTagAction;
59import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction;
60import org.sleuthkit.autopsy.casemodule.Case;
61import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
62import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagAddedEvent;
63import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent;
64import org.sleuthkit.autopsy.casemodule.events.CommentChangedEvent;
65import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
66import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
67import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil;
68import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
69import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException;
70import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
71import org.sleuthkit.autopsy.core.UserPreferences;
72import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
73import org.sleuthkit.autopsy.coreutils.Logger;
74import static org.sleuthkit.autopsy.datamodel.DisplayableItemNode.findLinked;
75import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.HasCommentStatus;
76import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.backgroundTasksPool;
77import org.sleuthkit.autopsy.timeline.actions.ViewArtifactInTimelineAction;
78import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction;
79import org.sleuthkit.datamodel.AbstractFile;
80import org.sleuthkit.datamodel.BlackboardArtifact;
81import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
82import org.sleuthkit.datamodel.BlackboardAttribute;
83import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
84import org.sleuthkit.datamodel.Content;
85import org.sleuthkit.datamodel.Tag;
86import org.sleuthkit.datamodel.TskCoreException;
87import org.sleuthkit.autopsy.datamodel.utils.IconsUtil;
88import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
89import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
90import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
91import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.NO_DESCR;
92import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
93import org.sleuthkit.autopsy.datamodel.utils.FileNameTransTask;
94import org.sleuthkit.autopsy.directorytree.ExportCSVAction;
95import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
96import org.sleuthkit.autopsy.directorytree.ExternalViewerShortcutAction;
97import org.sleuthkit.autopsy.directorytree.ExtractAction;
98import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
99import org.sleuthkit.autopsy.directorytree.ViewContextAction;
100import org.sleuthkit.autopsy.modules.embeddedfileextractor.ExtractArchiveWithPasswordAction;
101import org.sleuthkit.datamodel.AnalysisResult;
102import org.sleuthkit.datamodel.BlackboardArtifact.Category;
103import org.sleuthkit.datamodel.HostAddress;
104import org.sleuthkit.datamodel.Pool;
105import org.sleuthkit.datamodel.DataArtifact;
106import org.sleuthkit.datamodel.DerivedFile;
107import org.sleuthkit.datamodel.Directory;
108import org.sleuthkit.datamodel.File;
109import org.sleuthkit.datamodel.LayoutFile;
110import org.sleuthkit.datamodel.LocalDirectory;
111import org.sleuthkit.datamodel.LocalFile;
112import org.sleuthkit.datamodel.OsAccount;
113import org.sleuthkit.datamodel.Report;
114import org.sleuthkit.datamodel.Score;
115import org.sleuthkit.datamodel.SlackFile;
116import org.sleuthkit.datamodel.VirtualDirectory;
117import org.sleuthkit.datamodel.TskData;
118import org.sleuthkit.datamodel.Volume;
119import org.sleuthkit.datamodel.VolumeSystem;
120import org.sleuthkit.datamodel.Image;
135 private static final Cache<Long, Content>
contentCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build();
156 @SuppressWarnings(
"deprecation")
158 BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID(),
159 BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ITEM.getTypeID()
175 private final PropertyChangeListener
listener =
new PropertyChangeListener() {
177 public void propertyChange(PropertyChangeEvent evt) {
178 String eventType = evt.getPropertyName();
181 if (event.getAddedTag().getArtifact().equals(
artifact)) {
186 if (event.getDeletedTagInfo().getArtifactID() ==
artifact.getArtifactID()) {
191 if (event.getAddedTag().getContent().equals(
srcContent)) {
196 if (event.getDeletedTagInfo().getContentID() ==
srcContent.getId()) {
201 if (event.getContentID() ==
srcContent.getId()) {
205 if (evt.getNewValue() ==
null) {
221 String originalName = evt.getOldValue().toString();
224 setShortDescription(originalName);
226 Bundle.BlackboardArtifactNode_createSheet_srcFile_origName(),
227 Bundle.BlackboardArtifactNode_createSheet_srcFile_origDisplayName(),
261 throw new IllegalArgumentException(MessageFormat.format(
"Artifact missing source content (artifact objID={0})",
artifact));
272 }
catch (TskCoreException ex) {
273 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the unique path of the source content (artifact objID={0})",
artifact.getId()), ex);
278 setIconBaseWithExtension(iconPath !=
null && iconPath.charAt(0) ==
'/' ? iconPath.substring(1) : iconPath);
301 }
catch (TskCoreException ex) {
302 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the parent of the artifact for (artifact objID={0})",
artifact.getId()), ex);
314 }
catch (TskCoreException ex) {
315 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the unique path of the source content (artifact objID={0})",
artifact.getId()), ex);
318 throw new IllegalArgumentException(MessageFormat.format(
"Artifact missing source content (artifact objID={0})",
artifact));
324 setIconBaseWithExtension(iconPath !=
null && iconPath.charAt(0) ==
'/' ? iconPath.substring(1) : iconPath);
350 }
catch (TskCoreException ex) {
351 logger.log(Level.WARNING, MessageFormat.format(
"Error getting the artifact type for artifact (artifact objID={0})",
artifact.getId()), ex);
373 if (useAssociatedFile) {
376 long srcObjectID =
artifact.getObjectID();
379 }
catch (ExecutionException ex) {
380 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source/associated content (artifact object ID={0})",
artifact.getId()), ex);
392 if (
artifact instanceof AnalysisResult) {
406 return Lookups.fixed(
artifact, artifactItem);
421 for (Content lookupContent : this.getLookup().lookupAll(Content.class)) {
431 if ((lookupContent !=
null) && (lookupContent.getId() !=
artifact.getId())) {
432 return lookupContent;
453 BlackboardAttribute attribute =
artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
454 if (attribute !=
null) {
455 return contentCache.get(attribute.getValueLong(), () ->
artifact.getSleuthkitCase().getContentById(attribute.getValueLong()));
457 }
catch (TskCoreException ex) {
458 logger.log(Level.WARNING, MessageFormat.format(
"Error getting content for path id attrbiute for artifact: ",
artifact.getId()), ex);
491 return this.artifact;
502 return Stream.of(items)
503 .filter(i -> i !=
null)
504 .collect(Collectors.toList());
510 List<List<Action>> actionsLists =
new ArrayList<>();
532 if (this.srcContent instanceof Report) {
537 int selectedFileCount = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class).size();
538 int selectedArtifactCount = Utilities.actionsGlobalContext().lookupAll(
BlackboardArtifactItem.class).size();
544 if (parentFileNode !=
null) {
549 actionsLists.add(
getTagActions(parentFileNode !=
null, this.artifact, selectedFileCount, selectedArtifactCount));
555 actionsLists.add(Arrays.asList(super.getActions(context)));
557 return actionsLists.stream()
559 .filter((lst) -> lst !=
null && !lst.isEmpty())
561 .flatMap(lst -> Stream.concat(Stream.of((Action)
null), lst.stream()))
564 .toArray(sz ->
new Action[sz]);
576 "BlackboardArtifactNode_getAssociatedTypeStr_webCache=Cached File",
577 "BlackboardArtifactNode_getAssociatedTypeStr_webDownload=Downloaded File",
578 "BlackboardArtifactNode_getAssociatedTypeStr_associated=Associated File",})
580 if (BlackboardArtifact.Type.TSK_WEB_CACHE.equals(
artifactType)) {
581 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_webCache();
582 }
else if (BlackboardArtifact.Type.TSK_WEB_DOWNLOAD.equals(
artifactType)) {
583 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_webDownload();
585 return Bundle.BlackboardArtifactNode_getAssociatedTypeStr_associated();
598 "BlackboardArtifactNode_getViewSrcContentAction_type_File=File",
599 "BlackboardArtifactNode_getViewSrcContentAction_type_DataArtifact=Data Artifact",
600 "BlackboardArtifactNode_getViewSrcContentAction_type_OSAccount=OS Account",
601 "BlackboardArtifactNode_getViewSrcContentAction_type_unknown=Item"
604 if (
content instanceof AbstractFile) {
605 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_File();
606 }
else if (
content instanceof DataArtifact) {
607 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_DataArtifact();
608 }
else if (
content instanceof OsAccount) {
609 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_OSAccount();
611 return Bundle.BlackboardArtifactNode_getViewSrcContentAction_type_unknown();
627 "BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileAction=View {0} in Directory",
629 "BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileInTimelineAction=View {0} in Timeline..."
633 AbstractFile associatedFile = findLinked(
artifact);
634 if (associatedFile !=
null) {
635 return Arrays.asList(
637 Bundle.BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileAction(
641 Bundle.BlackboardArtifactNode_getAssociatedFileActions_viewAssociatedFileInTimelineAction(
646 }
catch (TskCoreException ex) {
647 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting linked file of artifact (artifact objID={0})",
artifact.getId()), ex);
649 return Collections.emptyList();
661 "# {0} - contentType",
662 "BlackboardArtifactNode_getSrcContentAction_actionDisplayName=View Source {0} in Directory"
665 if (
content instanceof DataArtifact) {
668 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
670 }
else if (
content instanceof OsAccount) {
673 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
675 }
else if (
content instanceof AbstractFile ||
artifact instanceof DataArtifact) {
677 Bundle.BlackboardArtifactNode_getSrcContentAction_actionDisplayName(
696 }
else if (
content instanceof Directory) {
698 }
else if (
content instanceof VirtualDirectory) {
700 }
else if (
content instanceof LocalDirectory) {
702 }
else if (
content instanceof LayoutFile) {
704 }
else if (
content instanceof LocalFile ||
content instanceof DerivedFile) {
706 }
else if (
content instanceof SlackFile) {
723 .contains(
"." + ((AbstractFile)
srcContent).getNameExtension().toLowerCase())) {
725 if (
srcContent.getArtifacts(BlackboardArtifact.Type.TSK_ENCRYPTION_DETECTED.getTypeID()).size() > 0) {
728 }
catch (TskCoreException ex) {
729 logger.log(Level.WARNING,
"Unable to add unzip with password action to context menus", ex);
747 private List<Action>
getTagActions(
boolean hasSrcFile, BlackboardArtifact
artifact,
int selectedFileCount,
int selectedArtifactCount) {
748 List<Action> actionsList =
new ArrayList<>();
751 if (hasSrcFile && !(
artifact instanceof DataArtifact)) {
758 if (hasSrcFile && (!(
artifact instanceof DataArtifact)) && (selectedFileCount == 1)) {
762 if (selectedArtifactCount == 1) {
778 "BlackboardArtifactNode_getSrcContentViewerActions_viewInNewWin=View Item in New Window",
779 "BlackboardArtifactNode_getSrcContentViewerActions_openInExtViewer=Open in External Viewer Ctrl+E"
782 List<Action> actionsList =
new ArrayList<>();
783 if (srcFileNode !=
null) {
784 actionsList.add(
new NewWindowViewAction(Bundle.BlackboardArtifactNode_getSrcContentViewerActions_viewInNewWin(), srcFileNode));
785 if (selectedFileCount == 1) {
786 actionsList.add(
new ExternalViewerAction(Bundle.BlackboardArtifactNode_getSrcContentViewerActions_openInExtViewer(), srcFileNode));
803 "# {0} - contentType",
804 "BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName=View Source {0} in Timeline... "
809 Bundle.BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName(
811 }
else if (
srcContent instanceof DataArtifact) {
815 Bundle.BlackboardArtifactNode_getTimelineSrcContentAction_actionDisplayName(
818 }
catch (TskCoreException ex) {
819 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source data artifact timestamp (artifact objID={0})",
srcContent.getId()), ex);
835 "BlackboardArtifactNode_getTimelineArtifactAction_displayName=View Selected Item in Timeline... "
843 }
catch (TskCoreException ex) {
844 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting artifact timestamp (artifact objID={0})", art.getId()), ex);
861 "BlackboardArtifactNode.createSheet.srcFile.name=Source Name",
862 "BlackboardArtifactNode.createSheet.srcFile.displayName=Source Name",
863 "BlackboardArtifactNode.createSheet.srcFile.origName=Original Name",
864 "BlackboardArtifactNode.createSheet.srcFile.origDisplayName=Original Name",
865 "BlackboardArtifactNode.createSheet.artifactType.displayName=Result Type",
866 "BlackboardArtifactNode.createSheet.artifactType.name=Result Type",
867 "BlackboardArtifactNode.createSheet.artifactDetails.displayName=Result Details",
868 "BlackboardArtifactNode.createSheet.artifactDetails.name=Result Details",
869 "BlackboardArtifactNode.createSheet.artifactMD5.displayName=MD5 Hash",
870 "BlackboardArtifactNode.createSheet.artifactMD5.name=MD5 Hash",
871 "BlackboardArtifactNode.createSheet.fileSize.name=Size",
872 "BlackboardArtifactNode.createSheet.fileSize.displayName=Size",
873 "BlackboardArtifactNode.createSheet.path.displayName=Path",
874 "BlackboardArtifactNode.createSheet.path.name=Path"
880 @SuppressWarnings(
"deprecation")
886 Sheet sheet = super.createSheet();
887 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
888 if (sheetSet ==
null) {
889 sheetSet = Sheet.createPropertiesSet();
900 Bundle.BlackboardArtifactNode_createSheet_srcFile_name(),
901 Bundle.BlackboardArtifactNode_createSheet_srcFile_displayName(),
906 if (
artifact instanceof AnalysisResult
907 && !(
artifactType.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()
908 ||
artifactType.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID())) {
921 Bundle.BlackboardArtifactNode_createSheet_srcFile_origName(),
922 Bundle.BlackboardArtifactNode_createSheet_srcFile_origDisplayName(),
938 if (
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() ||
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_ITEM.getTypeID()) {
940 BlackboardAttribute attribute =
artifact.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
941 if (attribute !=
null) {
945 "BlackboardArtifactNode.createSheet.artifactType.name"),
947 "BlackboardArtifactNode.createSheet.artifactType.displayName"),
949 associatedArtifact.getDisplayName()));
952 "BlackboardArtifactNode.createSheet.artifactDetails.name"),
954 "BlackboardArtifactNode.createSheet.artifactDetails.displayName"),
956 associatedArtifact.getShortDescription()));
959 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting associated artifact with type " +
artifact.getArtifactTypeName() +
" artifact (objID={0}))",
artifact.getId()), ex);
967 Map<String, Object> map =
new LinkedHashMap<>();
969 for (Map.Entry<String, Object> entry : map.entrySet()) {
990 final int artifactTypeId =
artifact.getArtifactTypeID();
991 if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
993 String actualMimeType =
"";
995 AbstractFile file = (AbstractFile)
srcContent;
996 ext = file.getNameExtension();
997 actualMimeType = file.getMIMEType();
998 if (actualMimeType ==
null) {
1005 "BlackboardArtifactNode.createSheet.ext.name"),
1007 "BlackboardArtifactNode.createSheet.ext.displayName"),
1012 "BlackboardArtifactNode.createSheet.mimeType.name"),
1014 "BlackboardArtifactNode.createSheet.mimeType.displayName"),
1024 String sourcePath =
"";
1027 }
catch (TskCoreException ex) {
1028 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting unique path of source content (artifact objID={0})",
artifact.getId()), ex);
1032 if (sourcePath.isEmpty() ==
false) {
1035 "BlackboardArtifactNode.createSheet.filePath.name"),
1037 "BlackboardArtifactNode.createSheet.filePath.displayName"),
1051 "ContentTagNode.createSheet.fileModifiedTime.name"),
1053 "ContentTagNode.createSheet.fileModifiedTime.displayName"),
1058 "ContentTagNode.createSheet.fileChangedTime.name"),
1060 "ContentTagNode.createSheet.fileChangedTime.displayName"),
1065 "ContentTagNode.createSheet.fileAccessedTime.name"),
1067 "ContentTagNode.createSheet.fileAccessedTime.displayName"),
1072 "ContentTagNode.createSheet.fileCreatedTime.name"),
1074 "ContentTagNode.createSheet.fileCreatedTime.displayName"),
1079 "ContentTagNode.createSheet.fileSize.name"),
1081 "ContentTagNode.createSheet.fileSize.displayName"),
1083 file ==
null ?
"" : file.getSize()));
1085 Bundle.BlackboardArtifactNode_createSheet_artifactMD5_name(),
1086 Bundle.BlackboardArtifactNode_createSheet_artifactMD5_displayName(),
1088 file ==
null ?
"" : StringUtils.defaultString(file.getMd5Hash())));
1091 String dataSourceStr =
"";
1093 Content dataSource =
srcContent.getDataSource();
1094 if (dataSource !=
null) {
1095 dataSourceStr = dataSource.getName();
1099 }
catch (TskCoreException ex) {
1100 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting source data source name (artifact objID={0})",
artifact.getId()), ex);
1104 if (dataSourceStr.isEmpty() ==
false) {
1107 "BlackboardArtifactNode.createSheet.dataSrc.name"),
1109 "BlackboardArtifactNode.createSheet.dataSrc.displayName"),
1119 if (artifactTypeId == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
1124 size = af.getSize();
1126 path = af.getUniquePath();
1127 }
catch (TskCoreException ex) {
1128 path = af.getParentPath();
1134 "BlackboardArtifactNode.createSheet.fileSize.name"),
1136 "BlackboardArtifactNode.createSheet.fileSize.displayName"),
1142 "BlackboardArtifactNode.createSheet.path.name"),
1144 "BlackboardArtifactNode.createSheet.path.displayName"),
1149 if (scoTask !=
null) {
1150 backgroundTasksPool.submit(scoTask);
1155 Sheet.Set enrichmentSet = enricher.getEnrichment(
artifact);
1156 if (enrichmentSet !=
null) {
1157 if (sheet.get(enrichmentSet.getName()) !=
null) {
1158 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",
1159 enricher.getClass().getName(), enrichmentSet.getName(),
artifact.getArtifactID()));
1161 sheet.put(enrichmentSet);
1164 }
catch (Exception ex) {
1165 logger.log(Level.WARNING, String.format(
"Error getting property enrichment from %s for artifact %d",
1166 enricher.getClass().getName(),
artifact.getArtifactID()), ex);
1181 List<Tag>
tags =
new ArrayList<>();
1186 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting tags for artifact and its source content (artifact objID={0})",
artifact.getId()), ex);
1214 for (Tag tag :
tags) {
1215 if (!StringUtils.isBlank(tag.getComment())) {
1233 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);
1241 String description = defaultDescription;
1246 }
else if (attribute !=
null) {
1247 description = Bundle.BlackboardArtifactNode_createSheet_count_noCorrelationValues_description();
1250 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);
1252 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);
1254 return Pair.of(count, description);
1261 SwingUtilities.invokeLater(() -> {
1276 while ((parent = parent.getParent()) !=
null) {
1277 parentName = parent.getName();
1279 }
catch (TskCoreException ex) {
1280 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting root ancestor name for source content (artifact objID={0})",
artifact.getId()), ex);
1307 @SuppressWarnings(
"deprecation")
1310 for (BlackboardAttribute attribute :
artifact.getAttributes()) {
1311 final int attributeTypeID = attribute.getAttributeType().getTypeID();
1312 if (attributeTypeID == ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()
1313 || attributeTypeID == ATTRIBUTE_TYPE.TSK_TAGGED_ARTIFACT.getTypeID()
1314 || attributeTypeID == ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()
1315 || attributeTypeID == ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()
1316 || attributeTypeID == ATTRIBUTE_TYPE.TSK_KEYWORD_SEARCH_TYPE.getTypeID()
1317 || attribute.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON) {
1323 if (attribute.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON
1325 attribute.getAttributeType().getTypeName())) {
1328 }
else if (
artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
1330 }
else if (attribute.getAttributeType().getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
1332 }
else if (
artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_TOOL_OUTPUT.getTypeID()
1333 && attributeTypeID == ATTRIBUTE_TYPE.TSK_TEXT.getTypeID()) {
1342 String value = attribute.getDisplayString();
1343 if (value.length() > 512) {
1344 value = value.substring(0, 512);
1346 map.put(attribute.getAttributeType().getDisplayName(), value);
1348 switch (attribute.getAttributeType().getValueType()) {
1350 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueInt());
1353 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueDouble());
1356 map.put(attribute.getAttributeType().getDisplayName(), attribute.getValueLong());
1359 map.put(attribute.getAttributeType().getDisplayName(), attribute.getDisplayString());
1365 }
catch (TskCoreException ex) {
1366 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting artifact attributes (artifact objID={0})",
artifact.getId()), ex);
1380 final int attributeTypeID = attribute.getAttributeType().getTypeID();
1381 if (attributeTypeID == ATTRIBUTE_TYPE.TSK_DATETIME_SENT.getTypeID()
1382 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML.getTypeID()
1383 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF.getTypeID()
1384 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_BCC.getTypeID()
1385 || attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CC.getTypeID()
1386 || attributeTypeID == ATTRIBUTE_TYPE.TSK_HEADERS.getTypeID()) {
1390 }
else if (attributeTypeID == ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN.getTypeID()) {
1391 String value = attribute.getDisplayString();
1392 if (value.length() > 160) {
1393 value = value.substring(0, 160) +
"...";
1395 map.put(attribute.getAttributeType().getDisplayName(), value);
1396 }
else if (attribute.getAttributeType().getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
1399 map.put(attribute.getAttributeType().getDisplayName(), attribute.getDisplayString());
1405 return visitor.
visit(
this);
1415 return getClass().getName();
1420 return visitor.
visit(
this);
1424 "BlackboardArtifactNode_analysisSheet_sourceType_name=Source Type",
1425 "BlackboardArtifactNode_analysisSheet_soureName_name=Source Name",
1426 "BlackboardArtifactNode_analysisSheet_score_name=Score",
1427 "BlackboardArtifactNode_analysisSheet_conclusion_name=Conclusion",
1428 "BlackboardArtifactNode_analysisSheet_configuration_name=Configuration",
1429 "BlackboardArtifactNode_analysisSheet_justifaction_name=Justification"
1440 Bundle.BlackboardArtifactNode_analysisSheet_soureName_name(),
1441 Bundle.BlackboardArtifactNode_analysisSheet_soureName_name(),
1448 Bundle.BlackboardArtifactNode_analysisSheet_sourceType_name(),
1449 Bundle.BlackboardArtifactNode_analysisSheet_sourceType_name(),
1454 Bundle.BlackboardArtifactNode_analysisSheet_score_name(),
1455 Bundle.BlackboardArtifactNode_analysisSheet_score_name(),
1457 result.getScore().getSignificance().getDisplayName()));
1460 Bundle.BlackboardArtifactNode_analysisSheet_conclusion_name(),
1461 Bundle.BlackboardArtifactNode_analysisSheet_conclusion_name(),
1463 result.getConclusion()));
1466 Bundle.BlackboardArtifactNode_analysisSheet_configuration_name(),
1467 Bundle.BlackboardArtifactNode_analysisSheet_configuration_name(),
1469 result.getConfiguration()));
1472 Bundle.BlackboardArtifactNode_analysisSheet_justifaction_name(),
1473 Bundle.BlackboardArtifactNode_analysisSheet_justifaction_name(),
1475 result.getJustification()));
1490 Bundle.BlackboardArtifactNode_createSheet_score_name(),
1491 Bundle.BlackboardArtifactNode_createSheet_score_displayName(),
1495 Bundle.BlackboardArtifactNode_createSheet_comment_name(),
1496 Bundle.BlackboardArtifactNode_createSheet_comment_displayName(),
1501 Bundle.BlackboardArtifactNode_createSheet_count_name(),
1502 Bundle.BlackboardArtifactNode_createSheet_count_displayName(),
1506 return new GetSCOTask(
new WeakReference<>(
this),
weakListener);
1522 if (source instanceof BlackboardArtifact) {
1523 BlackboardArtifact srcArtifact = (BlackboardArtifact) source;
1525 return srcArtifact.getType().getDisplayName();
1526 }
catch (TskCoreException ex) {
1527 logger.log(Level.SEVERE,
"Failed to get custom artifact type id=" + source.getId(), ex);
1530 return TskData.ObjectType.VOL.toString();
1531 }
else if (
srcContent instanceof AbstractFile) {
1532 return TskData.ObjectType.ABSTRACTFILE.toString();
1534 return TskData.ObjectType.IMG.toString();
1535 }
else if (
srcContent instanceof VolumeSystem) {
1536 return TskData.ObjectType.VS.toString();
1537 }
else if (
srcContent instanceof OsAccount) {
1538 return TskData.ObjectType.OS_ACCOUNT.toString();
1539 }
else if (
srcContent instanceof HostAddress) {
1540 return TskData.ObjectType.HOST_ADDRESS.toString();
1542 return TskData.ObjectType.POOL.toString();
1554 SwingUtilities.invokeLater(
new Runnable() {
1557 if (scoData.getScoreAndDescription() !=
null) {
1559 Bundle.BlackboardArtifactNode_createSheet_score_name(),
1560 Bundle.BlackboardArtifactNode_createSheet_score_displayName(),
1561 scoData.getScoreAndDescription().getRight(),
1562 scoData.getScoreAndDescription().getLeft()));
1564 if (scoData.getComment() !=
null) {
1566 Bundle.BlackboardArtifactNode_createSheet_comment_name(),
1567 Bundle.BlackboardArtifactNode_createSheet_comment_displayName(),
1570 if (scoData.getCountAndDescription() !=
null) {
1572 Bundle.BlackboardArtifactNode_createSheet_count_name(),
1573 Bundle.BlackboardArtifactNode_createSheet_count_displayName(),
1574 scoData.getCountAndDescription().getRight(),
1575 scoData.getCountAndDescription().getLeft()));
1585 if (
srcContent instanceof BlackboardArtifact) {
1587 setDisplayName(((BlackboardArtifact)
srcContent).getShortDescription());
1588 }
catch (TskCoreException ex) {
1591 logger.log(Level.WARNING,
"Failed to get short description for artifact id = " +
srcContent.getId(), ex);
1594 }
else if (
srcContent instanceof OsAccount) {
1600 setShortDescription(getDisplayName());
1615 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.score.name=S",
1616 "BlackboardArtifactNode.createSheet.score.displayName=S",
1617 "BlackboardArtifactNode.createSheet.notableFile.description=Associated file recognized as notable.",
1618 "BlackboardArtifactNode.createSheet.interestingResult.description=Result has an interesting result associated with it.",
1619 "BlackboardArtifactNode.createSheet.taggedItem.description=Result or associated file has been tagged.",
1620 "BlackboardArtifactNode.createSheet.notableTaggedItem.description=Result or associated file tagged with notable tag.",
1621 "BlackboardArtifactNode.createSheet.noScore.description=No score"})
1625 sheetSet.put(
new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_score_name(), Bundle.BlackboardArtifactNode_createSheet_score_displayName(), scoreAndDescription.getRight(), scoreAndDescription.getLeft()));
1637 @NbBundle.Messages({
1638 "BlackboardArtifactNode.createSheet.tags.displayName=Tags"}
1642 List<Tag>
tags =
new ArrayList<>();
1647 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting tags for artifact and source content (artifact objID={0})",
artifact.getId()), ex);
1649 sheetSet.put(
new NodeProperty<>(
"Tags", Bundle.BlackboardArtifactNode_createSheet_tags_displayName(),
NO_DESCR,
tags.stream().map(t -> t.getName().getDisplayName()).collect(Collectors.joining(
", "))));
1665 sheetSet.put(
new NodeProperty<>(
"Tags", Bundle.BlackboardArtifactNode_createSheet_tags_displayName(),
NO_DESCR,
tags.stream().map(t -> t.getName().getDisplayName()).collect(Collectors.joining(
", "))));
1680 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.count.name=O",
1681 "BlackboardArtifactNode.createSheet.count.displayName=O",
1682 "BlackboardArtifactNode.createSheet.count.noCorrelationAttributes.description=No correlation properties found",
1683 "BlackboardArtifactNode.createSheet.count.noCorrelationValues.description=Unable to find other occurrences because no value exists for the available correlation property",
1684 "# {0} - occurrenceCount",
1685 "# {1} - attributeType",
1686 "BlackboardArtifactNode.createSheet.count.description=There were {0} datasource(s) found with occurrences of the correlation value of type {1}"})
1689 Pair<Long, String> countAndDescription =
getCountPropertyAndDescription(attribute, Bundle.BlackboardArtifactNode_createSheet_count_noCorrelationAttributes_description());
1690 sheetSet.put(
new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_count_name(), Bundle.BlackboardArtifactNode_createSheet_count_displayName(), countAndDescription.getRight(), countAndDescription.getLeft()));
1707 @NbBundle.Messages({
"BlackboardArtifactNode.createSheet.comment.name=C",
1708 "BlackboardArtifactNode.createSheet.comment.displayName=C"})
1711 List<CorrelationAttributeInstance> attributes =
new ArrayList<>();
1712 attributes.add(attribute);
1714 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)
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)