19 package org.sleuthkit.autopsy.datamodel;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.Comparator;
26 import java.util.EnumSet;
27 import java.util.HashMap;
28 import java.util.List;
30 import java.util.logging.Level;
31 import org.openide.nodes.ChildFactory;
32 import org.openide.nodes.Children;
33 import org.openide.nodes.Node;
34 import org.openide.nodes.Sheet;
35 import org.openide.util.NbBundle;
36 import org.openide.util.lookup.Lookups;
44 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT;
45 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
46 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_TL_EVENT;
47 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DATA_SOURCE_USAGE;
48 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
49 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO;
50 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT;
51 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT;
52 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT;
53 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT;
54 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DOWNLOAD_SOURCE;
66 public static final String
NAME = NbBundle.getMessage(
RootNode.class,
"ExtractedContentNode.name.text");
88 this.filteringDSObjId = objId;
89 this.blackboard = skCase.getBlackboard();
94 return visitor.
visit(
this);
101 static String getIconFilePath(
int typeID) {
102 String filePath =
"org/sleuthkit/autopsy/images/";
103 if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) {
104 return filePath +
"bookmarks.png";
105 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()) {
106 return filePath +
"cookies.png";
107 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
108 return filePath +
"history.png";
109 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) {
110 return filePath +
"downloads.png";
111 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()) {
112 return filePath +
"recent_docs.png";
113 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) {
114 return filePath +
"gps_trackpoint.png";
115 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()) {
116 return filePath +
"programs.png";
117 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
118 return filePath +
"usb_devices.png";
119 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
120 return filePath +
"mail-icon-16.png";
121 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXTRACTED_TEXT.getTypeID()) {
122 return filePath +
"text-file.png";
123 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) {
124 return filePath +
"searchquery.png";
125 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
126 return filePath +
"camera-icon-16.png";
127 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_INFO.getTypeID()) {
128 return filePath +
"computer.png";
129 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SERVICE_ACCOUNT.getTypeID()) {
130 return filePath +
"account-icon-16.png";
131 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID()) {
132 return filePath +
"contact.png";
133 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
134 return filePath +
"message.png";
135 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()) {
136 return filePath +
"calllog.png";
137 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALENDAR_ENTRY.getTypeID()) {
138 return filePath +
"calendar.png";
139 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SPEED_DIAL_ENTRY.getTypeID()) {
140 return filePath +
"speeddialentry.png";
141 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()) {
142 return filePath +
"bluetooth.png";
143 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) {
144 return filePath +
"gpsfav.png";
145 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) {
146 return filePath +
"gps-lastlocation.png";
147 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) {
148 return filePath +
"gps-search.png";
149 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID()) {
150 return filePath +
"installed.png";
151 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID()
152 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.getTypeID()) {
153 return filePath +
"encrypted-file.png";
154 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
155 return filePath +
"mismatch-16.png";
156 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()) {
157 return filePath +
"gps_trackpoint.png";
158 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_REMOTE_DRIVE.getTypeID()) {
159 return filePath +
"drive_network.png";
160 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_FACE_DETECTED.getTypeID()) {
161 return filePath +
"face.png";
162 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
163 return filePath +
"network-wifi.png";
164 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()) {
165 return filePath +
"network-wifi.png";
166 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
167 return filePath +
"sim_card.png";
168 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
169 return filePath +
"Bluetooth.png";
170 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
171 return filePath +
"devices.png";
172 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED.getTypeID()) {
173 return filePath +
"validationFailed.png";
175 return filePath +
"artifact-icon.png";
181 super(Children.create(
new TypeFactory(),
true), Lookups.singleton(NAME));
183 super.setDisplayName(NAME);
184 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/extracted_content.png");
194 return visitor.
visit(
this);
199 Sheet sheet = super.createSheet();
200 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
201 if (sheetSet == null) {
202 sheetSet = Sheet.createPropertiesSet();
206 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.name"),
207 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.displayName"),
208 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.desc"),
215 return getClass().getName();
224 private class TypeFactory extends ChildFactory.Detachable<BlackboardArtifact.Type> {
226 private final ArrayList<BlackboardArtifact.Type>
doNotShow =
new ArrayList<>();
230 @SuppressWarnings(
"deprecation")
235 doNotShow.add(
new BlackboardArtifact.Type(TSK_GEN_INFO));
236 doNotShow.add(
new BlackboardArtifact.Type(TSK_EMAIL_MSG));
237 doNotShow.add(
new BlackboardArtifact.Type(TSK_HASHSET_HIT));
238 doNotShow.add(
new BlackboardArtifact.Type(TSK_KEYWORD_HIT));
239 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_FILE_HIT));
240 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_ARTIFACT_HIT));
241 doNotShow.add(
new BlackboardArtifact.Type(TSK_ACCOUNT));
242 doNotShow.add(
new BlackboardArtifact.Type(TSK_DATA_SOURCE_USAGE));
243 doNotShow.add(
new BlackboardArtifact.Type(TSK_DOWNLOAD_SOURCE));
244 doNotShow.add(
new BlackboardArtifact.Type(TSK_TL_EVENT));
247 doNotShow.add(
new BlackboardArtifact.Type(TSK_ASSOCIATED_OBJECT));
250 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
251 String eventType = evt.getPropertyName();
266 if (null != event && !(this.
doNotShow.contains(event.getBlackboardArtifactType()))) {
291 if (evt.getNewValue() == null) {
310 typeNodeList.clear();
314 protected boolean createKeys(List<BlackboardArtifact.Type> list) {
315 if (skCase != null) {
317 List<BlackboardArtifact.Type> types = (filteringDSObjId > 0)
318 ? blackboard.getArtifactTypesInUse(filteringDSObjId)
319 : skCase.getArtifactTypesInUse();
322 Collections.sort(types,
323 new Comparator<BlackboardArtifact.Type>() {
325 public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) {
326 return a.getDisplayName().compareTo(b.getDisplayName());
333 for (BlackboardArtifact.Type art : types) {
334 TypeNode node = typeNodeList.get(art);
336 node.updateDisplayName();
339 }
catch (TskCoreException ex) {
340 Logger.
getLogger(
TypeFactory.class.getName()).log(Level.SEVERE,
"Error getting list of artifacts in use: " + ex.getLocalizedMessage());
349 typeNodeList.put(key, node);
362 private final BlackboardArtifact.Type
type;
367 super.setName(
type.getTypeName());
373 final void updateDisplayName() {
374 if (skCase == null) {
382 this.childCount = (filteringDSObjId > 0)
384 : skCase.getBlackboardArtifactsTypeCount(
type.getTypeID());
385 }
catch (TskCoreException ex) {
386 Logger.getLogger(TypeNode.class.getName())
387 .log(Level.WARNING,
"Error getting child count", ex);
389 super.setDisplayName(
type.
getDisplayName() +
" \u200E(\u200E" + childCount +
")\u200E");
394 Sheet sheet = super.createSheet();
395 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
396 if (sheetSet == null) {
397 sheetSet = Sheet.createPropertiesSet();
401 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.name"),
402 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.displayName"),
403 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.desc"),
406 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.name"),
407 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.displayName"),
408 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.desc"),
416 return visitor.
visit(
this);
435 private BlackboardArtifact.Type
type;
438 super(
type.getTypeName());
442 private final PropertyChangeListener
pcl =
new PropertyChangeListener() {
444 public void propertyChange(PropertyChangeEvent evt) {
445 String eventType = evt.getPropertyName();
462 if (null != event && event.getBlackboardArtifactType().equals(
type)) {
509 if (skCase != null) {
511 return (filteringDSObjId > 0)
513 : skCase.getBlackboardArtifacts(
type.getTypeID());
514 }
catch (TskCoreException ex) {
518 return Collections.emptyList();
void removeIngestModuleEventListener(final PropertyChangeListener listener)
static synchronized IngestManager getInstance()
T visit(DataSourcesNode in)
void removeIngestJobEventListener(final PropertyChangeListener listener)
void addIngestJobEventListener(final PropertyChangeListener listener)
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)