19 package org.sleuthkit.autopsy.datamodel;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.sql.ResultSet;
24 import java.sql.SQLException;
25 import java.util.ArrayList;
26 import java.util.Collections;
27 import java.util.EnumSet;
28 import java.util.List;
30 import java.util.logging.Level;
31 import javax.swing.Action;
32 import org.apache.commons.lang3.tuple.Pair;
33 import org.openide.nodes.Sheet;
34 import org.openide.util.NbBundle;
35 import org.openide.util.NbBundle.Messages;
51 import org.
sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
74 static String nameForImage(Image i) {
85 String imgName = nameForImage(img);
86 this.setDisplayName(imgName);
87 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/hard-drive-icon.jpg");
108 @Messages({
"ImageNode.action.runIngestMods.text=Run Ingest Modules",
109 "ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes"})
112 List<Action> actionsList =
new ArrayList<>();
113 for (Action a : super.getActions(
true)) {
117 actionsList.add(
new FileSearchAction(Bundle.ImageNode_getActions_openFileSearchByAttr_text()));
120 actionsList.add(
new NewWindowViewAction(NbBundle.getMessage(
this.getClass(),
"ImageNode.getActions.viewInNewWin.text"),
this));
122 return actionsList.toArray(
new Action[0]);
126 @Messages({
"ImageNode.createSheet.size.name=Size (Bytes)",
127 "ImageNode.createSheet.size.displayName=Size (Bytes)",
128 "ImageNode.createSheet.size.desc=Size of the data source in bytes.",
129 "ImageNode.createSheet.type.name=Type",
130 "ImageNode.createSheet.type.displayName=Type",
131 "ImageNode.createSheet.type.desc=Type of the image.",
132 "ImageNode.createSheet.type.text=Image",
133 "ImageNode.createSheet.sectorSize.name=Sector Size (Bytes)",
134 "ImageNode.createSheet.sectorSize.displayName=Sector Size (Bytes)",
135 "ImageNode.createSheet.sectorSize.desc=Sector size of the image in bytes.",
136 "ImageNode.createSheet.timezone.name=Timezone",
137 "ImageNode.createSheet.timezone.displayName=Timezone",
138 "ImageNode.createSheet.timezone.desc=Timezone of the image",
139 "ImageNode.createSheet.deviceId.name=Device ID",
140 "ImageNode.createSheet.deviceId.displayName=Device ID",
141 "ImageNode.createSheet.deviceId.desc=Device ID of the image"})
143 Sheet sheet = super.createSheet();
144 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
145 if (sheetSet == null) {
146 sheetSet = Sheet.createPropertiesSet();
150 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.name"),
151 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.displayName"),
152 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.desc"),
155 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_type_name(),
156 Bundle.ImageNode_createSheet_type_displayName(),
157 Bundle.ImageNode_createSheet_type_desc(),
158 Bundle.ImageNode_createSheet_type_text()));
160 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_size_name(),
161 Bundle.ImageNode_createSheet_size_displayName(),
162 Bundle.ImageNode_createSheet_size_desc(),
163 this.content.getSize()));
164 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_sectorSize_name(),
165 Bundle.ImageNode_createSheet_sectorSize_displayName(),
166 Bundle.ImageNode_createSheet_sectorSize_desc(),
167 this.content.getSsize()));
169 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_timezone_name(),
170 Bundle.ImageNode_createSheet_timezone_displayName(),
171 Bundle.ImageNode_createSheet_timezone_desc(),
172 this.content.getTimeZone()));
175 ResultSet deviceIdSet = query.getResultSet();
176 if (deviceIdSet.next()) {
177 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_deviceId_name(),
178 Bundle.ImageNode_createSheet_deviceId_displayName(),
179 Bundle.ImageNode_createSheet_deviceId_desc(),
180 deviceIdSet.getString(
"device_id")));
183 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
190 public <T> T accept(ContentNodeVisitor<T> visitor) {
191 return visitor.visit(
this);
201 return visitor.
visit(
this);
206 return getClass().getName();
214 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
215 String eventType = evt.getPropertyName();
223 if ((moduleContentEvent.getSource() instanceof Content) ==
false) {
226 Content newContent = (Content) moduleContentEvent.getSource();
229 Content parent = newContent.getParent();
230 if (parent != null) {
232 if (parent.getName().equals(VirtualDirectory.NAME_CARVED)) {
234 if (newContent.getDataSource().getId() ==
getContent().getDataSource().getId()) {
237 while ((parent = parent.getParent()) != null) {
246 }
catch (TskCoreException ex) {
249 logger.log(Level.WARNING,
"Failed to post key refresh event.", ex);
252 if (evt.getNewValue() == null) {
268 return new ArrayList<>();
void removeIngestModuleEventListener(final PropertyChangeListener listener)
static synchronized IngestManager getInstance()
static List< Action > getActions(Content c)
CorrelationAttributeInstance getCorrelationAttributeInstance()
Action[] getActions(boolean context)
T visit(DataSourcesNode in)
Pair< Long, String > getCountPropertyAndDescription(CorrelationAttributeInstance.Type attributeType, String attributeValue, String defaultDescription)
Pair< DataResultViewerTable.Score, String > getScorePropertyAndDescription(List< Tag > tags)
SleuthkitCase getSleuthkitCase()
final PropertyChangeListener pcl
static void post(String nodeName, Object event)
static final Logger logger
DataResultViewerTable.HasCommentStatus getCommentProperty(List< Tag > tags, CorrelationAttributeInstance attribute)
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
List< Tag > getAllTagsFromDatabase()
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static final Set< IngestManager.IngestModuleEvent > INGEST_MODULE_EVENTS_OF_INTEREST
static final String NO_DESCR