mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Add support for 'path id' attribute
This commit is contained in:
parent
a2267f34f5
commit
abc449f8bc
@ -18,8 +18,9 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -27,7 +28,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
@ -101,7 +101,9 @@ public class BlackboardArtifactNode extends AbstractNode implements DisplayableI
|
||||
public static void fillPropertyMap(Map<Integer, Object> map, BlackboardArtifact artifact) {
|
||||
try {
|
||||
for(BlackboardAttribute attribute : artifact.getAttributes()){
|
||||
switch(attribute.getValueType()){
|
||||
if(attribute.getAttributeTypeID() == ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID())
|
||||
continue;
|
||||
else switch(attribute.getValueType()){
|
||||
case STRING:
|
||||
map.put(attribute.getAttributeTypeID(), attribute.getValueString());
|
||||
break;
|
||||
@ -109,6 +111,11 @@ public class BlackboardArtifactNode extends AbstractNode implements DisplayableI
|
||||
map.put(attribute.getAttributeTypeID(), attribute.getValueInt());
|
||||
break;
|
||||
case LONG:
|
||||
if(attribute.getAttributeTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID() ||
|
||||
attribute.getAttributeTypeID() == ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID()) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd-yyyy HH:mm");
|
||||
map.put(attribute.getAttributeTypeID(), formatter.format(new Date(attribute.getValueLong())));
|
||||
} else
|
||||
map.put(attribute.getAttributeTypeID(), attribute.getValueLong());
|
||||
break;
|
||||
case DOUBLE:
|
||||
|
@ -50,7 +50,10 @@ import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode;
|
||||
import org.sleuthkit.autopsy.datamodel.RecentFilesFilterNode;
|
||||
import org.sleuthkit.autopsy.datamodel.RecentFilesNode;
|
||||
import org.sleuthkit.autopsy.datamodel.SearchFiltersNode;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
|
||||
|
||||
/**
|
||||
@ -178,7 +181,10 @@ public class DataResultFilterNode extends FilterNode{
|
||||
public List<Action> visit(BlackboardArtifactNode ba) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
//actions.add(new ViewAssociatedContentAction("View Associated Content", ba));
|
||||
actions.add(new ViewContextAction("View in Directory", ba));
|
||||
actions.add(new ViewContextAction("View Source in Directory", ba));
|
||||
Content c = findLinked(ba);
|
||||
if(c != null)
|
||||
actions.add(new ViewContextAction("View Linked in Directory", c));
|
||||
return actions;
|
||||
}
|
||||
|
||||
@ -187,6 +193,28 @@ public class DataResultFilterNode extends FilterNode{
|
||||
return new ArrayList<Action>();
|
||||
}
|
||||
|
||||
private Content findLinked(BlackboardArtifactNode ba) {
|
||||
BlackboardArtifact art = ba.getLookup().lookup(BlackboardArtifact.class);
|
||||
Content c = null;
|
||||
try {
|
||||
for(BlackboardAttribute attr : art.getAttributes()) {
|
||||
if(attr.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) {
|
||||
switch(attr.getValueType()) {
|
||||
case INTEGER:
|
||||
c = art.getSleuthkitCase().getContentById(attr.getValueInt());
|
||||
break;
|
||||
case LONG:
|
||||
c = art.getSleuthkitCase().getContentById(attr.getValueLong());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(TskException ex) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Error getting linked file");
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class GetPreferredActionsDisplayableItemNodeVisitor extends DisplayableItemNodeVisitor.Default<AbstractAction>{
|
||||
|
@ -67,6 +67,11 @@ class ViewContextAction extends AbstractAction {
|
||||
this.content = node.getLookup().lookup(Content.class);
|
||||
}
|
||||
|
||||
public ViewContextAction(String title, Content content) {
|
||||
super(title);
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user