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;
29 import java.util.Objects;
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;
46 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT;
47 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
48 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO;
49 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT;
50 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT;
51 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT;
52 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT;
65 public static final String
NAME = NbBundle.getMessage(
RootNode.class,
"ExtractedContentNode.name.text");
85 this.datasourceObjId = objId;
86 this.blackboard = skCase.getBlackboard();
91 return visitor.
visit(
this);
98 static String getIconFilePath(
int typeID) {
99 String filePath =
"org/sleuthkit/autopsy/images/";
100 if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) {
101 return filePath +
"bookmarks.png";
102 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()) {
103 return filePath +
"cookies.png";
104 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
105 return filePath +
"history.png";
106 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) {
107 return filePath +
"downloads.png";
108 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()) {
109 return filePath +
"recent_docs.png";
110 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) {
111 return filePath +
"gps_trackpoint.png";
112 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()) {
113 return filePath +
"programs.png";
114 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
115 return filePath +
"usb_devices.png";
116 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
117 return filePath +
"mail-icon-16.png";
118 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXTRACTED_TEXT.getTypeID()) {
119 return filePath +
"text-file.png";
120 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) {
121 return filePath +
"searchquery.png";
122 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
123 return filePath +
"camera-icon-16.png";
124 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_INFO.getTypeID()) {
125 return filePath +
"computer.png";
126 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SERVICE_ACCOUNT.getTypeID()) {
127 return filePath +
"account-icon-16.png";
128 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID()) {
129 return filePath +
"contact.png";
130 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
131 return filePath +
"message.png";
132 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()) {
133 return filePath +
"calllog.png";
134 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALENDAR_ENTRY.getTypeID()) {
135 return filePath +
"calendar.png";
136 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SPEED_DIAL_ENTRY.getTypeID()) {
137 return filePath +
"speeddialentry.png";
138 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()) {
139 return filePath +
"bluetooth.png";
140 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) {
141 return filePath +
"gpsfav.png";
142 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) {
143 return filePath +
"gps-lastlocation.png";
144 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) {
145 return filePath +
"gps-search.png";
146 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID()) {
147 return filePath +
"installed.png";
148 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID() ||
149 typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.getTypeID()) {
150 return filePath +
"encrypted-file.png";
151 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
152 return filePath +
"mismatch-16.png";
153 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()) {
154 return filePath +
"gps_trackpoint.png";
155 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_REMOTE_DRIVE.getTypeID()) {
156 return filePath +
"drive_network.png";
157 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_FACE_DETECTED.getTypeID()) {
158 return filePath +
"face.png";
159 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
160 return filePath +
"network-wifi.png";
161 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()) {
162 return filePath +
"network-wifi.png";
163 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
164 return filePath +
"sim_card.png";
165 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
166 return filePath +
"Bluetooth.png";
167 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
168 return filePath +
"devices.png";
169 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED.getTypeID()) {
170 return filePath +
"validationFailed.png";
172 return filePath +
"artifact-icon.png";
178 super(Children.create(
new TypeFactory(),
true), Lookups.singleton(NAME));
180 super.setDisplayName(NAME);
181 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/extracted_content.png");
191 return visitor.
visit(
this);
196 Sheet sheet = super.createSheet();
197 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
198 if (sheetSet == null) {
199 sheetSet = Sheet.createPropertiesSet();
203 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.name"),
204 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.displayName"),
205 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.desc"),
212 return getClass().getName();
221 private class TypeFactory extends ChildFactory.Detachable<BlackboardArtifact.Type> {
223 private final ArrayList<BlackboardArtifact.Type>
doNotShow =
new ArrayList<>();
231 doNotShow.add(
new BlackboardArtifact.Type(TSK_GEN_INFO));
232 doNotShow.add(
new BlackboardArtifact.Type(TSK_EMAIL_MSG));
233 doNotShow.add(
new BlackboardArtifact.Type(TSK_HASHSET_HIT));
234 doNotShow.add(
new BlackboardArtifact.Type(TSK_KEYWORD_HIT));
235 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_FILE_HIT));
236 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_ARTIFACT_HIT));
237 doNotShow.add(
new BlackboardArtifact.Type(TSK_ACCOUNT));
240 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
241 String eventType = evt.getPropertyName();
256 if (null != event && !(this.
doNotShow.contains(event.getBlackboardArtifactType()))) {
281 if (evt.getNewValue() == null) {
300 typeNodeList.clear();
304 protected boolean createKeys(List<BlackboardArtifact.Type> list) {
305 if (skCase != null) {
308 blackboard.getArtifactTypesInUse(datasourceObjId) :
309 skCase.getArtifactTypesInUse() ;
312 Collections.sort(types,
313 new Comparator<BlackboardArtifact.Type>() {
315 public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) {
316 return a.getDisplayName().compareTo(b.getDisplayName());
323 for (BlackboardArtifact.Type art : types) {
324 TypeNode node = typeNodeList.get(art);
326 node.updateDisplayName();
329 }
catch (TskCoreException ex) {
330 Logger.
getLogger(
TypeFactory.class.getName()).log(Level.SEVERE,
"Error getting list of artifacts in use: " + ex.getLocalizedMessage());
339 typeNodeList.put(key, node);
352 private final BlackboardArtifact.Type
type;
357 super.setName(
type.getTypeName());
363 final void updateDisplayName() {
364 if (skCase == null) {
374 skCase.getBlackboardArtifactsTypeCount(
type.getTypeID());
375 }
catch (TskException ex) {
376 Logger.getLogger(TypeNode.class.getName())
377 .log(Level.WARNING,
"Error getting child count", ex);
379 super.setDisplayName(
type.getDisplayName() +
" \u200E(\u200E" + childCount +
")\u200E");
384 Sheet sheet = super.createSheet();
385 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
386 if (sheetSet == null) {
387 sheetSet = Sheet.createPropertiesSet();
391 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.name"),
392 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.displayName"),
393 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.desc"),
394 type.getDisplayName()));
396 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.name"),
397 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.displayName"),
398 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.desc"),
406 return visitor.
visit(
this);
416 return getClass().getName() +
type.getDisplayName();
425 private BlackboardArtifact.Type
type;
432 private final PropertyChangeListener
pcl =
new PropertyChangeListener() {
434 public void propertyChange(PropertyChangeEvent evt) {
435 String eventType = evt.getPropertyName();
452 if (null != event && event.getBlackboardArtifactType().equals(
type)) {
493 protected boolean createKeys(List<BlackboardArtifact> list) {
494 if (skCase != null) {
496 List<BlackboardArtifact> arts =
499 skCase.getBlackboardArtifacts(
type.getTypeID());
501 }
catch (TskException ex) {
void removeIngestModuleEventListener(final PropertyChangeListener listener)
static synchronized IngestManager getInstance()
T visit(DataSourcesNode in)
void removeIngestJobEventListener(final PropertyChangeListener listener)
void addIngestJobEventListener(final PropertyChangeListener listener)
static Boolean getGroupItemsInTreeByDataSource()
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)