19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.LinkedHashMap;
24 import java.util.List;
26 import java.util.logging.Level;
27 import org.openide.nodes.Children;
28 import org.openide.nodes.Sheet;
29 import org.openide.util.Lookup;
30 import org.openide.util.NbBundle;
31 import org.openide.util.lookup.Lookups;
82 this.associated = this.getLookup().lookup(
Content.class);
85 this.setIconBaseWithExtension(iconPath);
99 this.associated = this.getLookup().lookup(
Content.class);
111 String displayName =
"";
112 if (associated != null)
113 displayName = associated.
getName();
123 if (associatedArtifact != null) {
138 Sheet s = super.createSheet();
139 Sheet.Set ss = s.get(Sheet.PROPERTIES);
141 ss = Sheet.createPropertiesSet();
144 final String NO_DESCR = NbBundle.getMessage(this.getClass(),
"BlackboardArtifactNode.noDesc.text");
146 Map<String, Object> map =
new LinkedHashMap<>();
149 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.srcFile.name"),
150 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.srcFile.displayName"),
152 this.getDisplayName()));
154 for (Map.Entry<String, Object> entry : map.entrySet()) {
162 if (customProperties != null) {
173 AbstractFile af = (AbstractFile) associated;
176 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.ext.name"),
177 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.ext.displayName"),
182 String actualMimeType =
"";
185 List<BlackboardAttribute> atrList = art.getAttributes();
188 actualMimeType = att.getValueString();
192 if (actualMimeType.isEmpty()) {
193 logger.log(Level.WARNING,
"Could not find expected TSK_FILE_TYPE_SIG attribute.");
196 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.mimeType.name"),
197 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.mimeType.displayName"),
202 logger.log(Level.WARNING,
"Error while searching for TSK_FILE_TYPE_SIG attribute: ", ex);
206 if (Arrays.asList(SHOW_UNIQUE_PATH).contains(artifactTypeId)) {
207 String sourcePath =
"";
211 logger.log(Level.WARNING,
"Failed to get unique path from: {0}", associated.
getName());
214 if (sourcePath.isEmpty() ==
false) {
216 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.filePath.name"),
217 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.filePath.displayName"),
222 if (Arrays.asList(SHOW_FILE_METADATA).contains(artifactTypeId)) {
224 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileModifiedTime.name"),
225 NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileModifiedTime.displayName"),
228 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileChangedTime.name"),
229 NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileChangedTime.displayName"),
232 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileAccessedTime.name"),
233 NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileAccessedTime.displayName"),
236 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileCreatedTime.name"),
237 NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileCreatedTime.displayName"),
240 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileSize.name"),
241 NbBundle.getMessage(
this.getClass(),
"ContentTagNode.createSheet.fileSize.displayName"),
246 String dataSourceStr =
"";
249 if (dataSource != null) {
250 dataSourceStr = dataSource.
getName();
255 logger.log(Level.WARNING,
"Failed to get image name from {0}", associated.
getName());
258 if (dataSourceStr.isEmpty() ==
false) {
260 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.dataSrc.name"),
261 NbBundle.getMessage(
this.getClass(),
"BlackboardArtifactNode.createSheet.dataSrc.displayName"),
271 String parentName = associated.
getName();
274 while ((parent = parent.
getParent()) != null) {
278 logger.log(Level.WARNING,
"Failed to get parent name from {0}", associated.
getName());
291 if (null == customProperties) {
293 customProperties =
new ArrayList<>();
295 customProperties.add(np);
306 @SuppressWarnings(
"deprecation")
310 final int attributeTypeID = attribute.getAttributeTypeID();
332 String value = attribute.getDisplayString();
333 if (value.length() > 512)
334 value = value.substring(0, 512);
335 map.put(attribute.getAttributeTypeDisplayName(), value);
338 map.put(attribute.getAttributeTypeDisplayName(), attribute.getDisplayString());
342 logger.log(Level.SEVERE,
"Getting attributes failed", ex);
348 return v.
visit(
this);
358 List<Object> forLookup =
new ArrayList<>();
359 forLookup.add(artifact);
363 if (content != null) {
364 forLookup.add(content);
370 if (highlight != null) {
371 forLookup.add(highlight);
374 return Lookups.fixed(forLookup.toArray(
new Object[forLookup.size()]));
381 logger.log(Level.WARNING,
"Getting file failed", ex);
383 throw new IllegalArgumentException(
392 long objectId = content.
getId();
394 Lookup lookup = Lookup.getDefault();
397 List<BlackboardAttribute> attributes = artifact.
getAttributes();
398 String keyword = null;
399 String regexp = null;
401 final int attributeTypeID = att.getAttributeTypeID();
403 keyword = att.getValueString();
405 regexp = att.getValueString();
408 objectId = att.getValueLong();
411 if (keyword != null) {
412 boolean isRegexp = (regexp != null && !regexp.equals(
""));
419 return highlightFactory.
createInstance(objectId, keyword, isRegexp, origQuery);
422 logger.log(Level.WARNING,
"Failed to retrieve Blackboard Attributes", ex);
430 case TSK_WEB_BOOKMARK:
431 return "bookmarks.png";
433 return "cookies.png";
434 case TSK_WEB_HISTORY:
435 return "history.png";
436 case TSK_WEB_DOWNLOAD:
437 return "downloads.png";
438 case TSK_INSTALLED_PROG:
439 return "programs.png";
440 case TSK_RECENT_OBJECT:
441 return "recent_docs.png";
442 case TSK_DEVICE_ATTACHED:
443 return "usb_devices.png";
444 case TSK_WEB_SEARCH_QUERY:
445 return "searchquery.png";
447 return "blue-tag-icon-16.png";
448 case TSK_TAG_ARTIFACT:
449 return "green-tag-icon-16.png";
450 case TSK_METADATA_EXIF:
451 return "camera-icon-16.png";
453 return "mail-icon-16.png";
455 return "contact.png";
457 return "message.png";
459 return "calllog.png";
460 case TSK_CALENDAR_ENTRY:
461 return "calendar.png";
462 case TSK_SPEED_DIAL_ENTRY:
463 return "speeddialentry.png";
464 case TSK_BLUETOOTH_PAIRING:
465 return "bluetooth.png";
466 case TSK_GPS_BOOKMARK:
468 case TSK_GPS_LAST_KNOWN_LOCATION:
469 return "gps-lastlocation.png";
471 return "gps-search.png";
472 case TSK_SERVICE_ACCOUNT:
473 return "account-icon-16.png";
474 case TSK_ENCRYPTION_DETECTED:
475 return "encrypted-file.png";
476 case TSK_EXT_MISMATCH_DETECTED:
477 return "mismatch-16.png";
479 return "computer.png";
481 return "artifact-icon.png";
void fillPropertyMap(Map< String, Object > map, BlackboardArtifact artifact)
static String getStringTime(long epochSeconds, TimeZone tzone)
static ARTIFACT_TYPE fromID(int ID)
TSK_EXT_MISMATCH_DETECTED
Content getContentById(long id)
BlackboardArtifactNode(BlackboardArtifact artifact, String iconPath)
static Lookup createLookup(BlackboardArtifact artifact)
String getNameExtension()
static final Integer[] SHOW_FILE_METADATA
SleuthkitCase getSleuthkitCase()
BlackboardArtifact getBlackboardArtifact(long artifactID)
T visit(DataSourcesNode in)
static Content getAssociatedContent(BlackboardArtifact artifact)
List< NodeProperty<?extends Object > > customProperties
String getRootParentName()
final BlackboardArtifact artifact
String getIcon(BlackboardArtifact.ARTIFACT_TYPE type)
SleuthkitCase getSleuthkitCase()
static TextMarkupLookup getHighlightLookup(BlackboardArtifact artifact, Content content)
List< BlackboardAttribute > getAttributes()
ArrayList< BlackboardArtifact > getAllArtifacts()
static Case getCurrentCase()
TextMarkupLookup createInstance(long objectId, String keywordHitQuery, boolean isRegex, String originalQuery)
BlackboardArtifactNode(BlackboardArtifact artifact)
static final Integer[] SHOW_UNIQUE_PATH
static Logger getLogger(String name)