mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-02 23:39:50 +00:00
Added properties option to all nodes.
This commit is contained in:
@@ -20,13 +20,13 @@ package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import javax.swing.Action;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
import org.sleuthkit.autopsy.actions.DeleteBlackboardArtifactTagAction;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifactTag;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
@@ -93,7 +93,11 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
|
||||
@Override
|
||||
public Action[] getActions(boolean context) {
|
||||
List<Action> actions = DataModelActionsFactory.getActions(tag.getContent(), true);
|
||||
actions.add(null); // Adds a menu item separator.
|
||||
for (Action a : super.getActions(true)) {
|
||||
actions.add(a);
|
||||
}
|
||||
actions.add(null); // Adds a menu item separator.
|
||||
|
||||
actions.add(DeleteBlackboardArtifactTagAction.getInstance());
|
||||
return actions.toArray(new Action[0]);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,9 @@ class ContentTagNode extends DisplayableItemNode {
|
||||
@Override
|
||||
public Action[] getActions(boolean context) {
|
||||
List<Action> actions = DataModelActionsFactory.getActions(tag.getContent(), false);
|
||||
for (Action a : super.getActions(true)) {
|
||||
actions.add(a);
|
||||
}
|
||||
actions.add(null); // Adds a menu item separator.
|
||||
actions.add(DeleteContentTagAction.getInstance());
|
||||
return actions.toArray(new Action[0]);
|
||||
|
||||
@@ -21,10 +21,9 @@ package org.sleuthkit.autopsy.datamodel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.Action;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
|
||||
import org.sleuthkit.autopsy.directorytree.ExtractAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.directorytree.ViewContextAction;
|
||||
@@ -72,6 +71,9 @@ public class DirectoryNode extends AbstractFsContentNode<AbstractFile> {
|
||||
@Override
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actions = new ArrayList<>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actions.add(a);
|
||||
}
|
||||
if (!getDirectoryBrowseMode()) {
|
||||
actions.add(new ViewContextAction(
|
||||
NbBundle.getMessage(this.getClass(), "DirectoryNode.getActions.viewFileInDir.text"), this));
|
||||
|
||||
@@ -79,6 +79,9 @@ public class FileNode extends AbstractFsContentNode<AbstractFile> {
|
||||
@Override
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actionsList = new ArrayList<>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actionsList.add(a);
|
||||
}
|
||||
if (!this.getDirectoryBrowseMode()) {
|
||||
actionsList.add(new ViewContextAction(NbBundle.getMessage(FileNode.class, "FileNode.viewFileInDir.text"), this));
|
||||
actionsList.add(null); // creates a menu separator
|
||||
|
||||
@@ -85,7 +85,12 @@ public class ImageNode extends AbstractContentNode<Image> {
|
||||
"ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes",})
|
||||
public Action[] getActions(boolean context) {
|
||||
|
||||
|
||||
|
||||
List<Action> actionsList = new ArrayList<Action>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actionsList.add(a);
|
||||
}
|
||||
actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
|
||||
actionsList.add(new FileSearchAction(
|
||||
Bundle.ImageNode_getActions_openFileSearchByAttr_text()));
|
||||
|
||||
@@ -25,11 +25,11 @@ import java.util.Map;
|
||||
import javax.swing.Action;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
|
||||
import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
|
||||
import org.sleuthkit.autopsy.directorytree.ExtractAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.datamodel.LayoutFile;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
@@ -116,6 +116,9 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
|
||||
@Override
|
||||
public Action[] getActions(boolean context) {
|
||||
List<Action> actionsList = new ArrayList<>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actionsList.add(a);
|
||||
}
|
||||
actionsList.add(new NewWindowViewAction(
|
||||
NbBundle.getMessage(this.getClass(), "LayoutFileNode.getActions.viewInNewWin.text"), this));
|
||||
actionsList.add(new ExternalViewerAction(
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.Map;
|
||||
import javax.swing.Action;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
|
||||
import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
|
||||
import org.sleuthkit.autopsy.directorytree.ExtractAction;
|
||||
import org.sleuthkit.autopsy.directorytree.HashSearchAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.directorytree.ViewContextAction;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
@@ -82,6 +82,9 @@ public class LocalFileNode extends AbstractAbstractFileNode<AbstractFile> {
|
||||
@Override
|
||||
public Action[] getActions(boolean context) {
|
||||
List<Action> actionsList = new ArrayList<>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actionsList.add(a);
|
||||
}
|
||||
actionsList.add(new ViewContextAction(NbBundle.getMessage(this.getClass(), "LocalFileNode.viewFileInDir.text"), this.content));
|
||||
actionsList.add(null); // creates a menu separator
|
||||
actionsList.add(new NewWindowViewAction(
|
||||
|
||||
@@ -89,6 +89,9 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
|
||||
@NbBundle.Messages({"VirtualDirectoryNode.action.runIngestMods.text=Run Ingest Modules"})
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actions = new ArrayList<>();
|
||||
for (Action a : super.getActions(true)) {
|
||||
actions.add(a);
|
||||
}
|
||||
|
||||
actions.add(new NewWindowViewAction(
|
||||
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.getActions.viewInNewWin.text"), this));
|
||||
|
||||
@@ -131,6 +131,10 @@ public class VolumeNode extends AbstractContentNode<Volume> {
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actionsList = new ArrayList<>();
|
||||
|
||||
for (Action a : super.getActions(true)) {
|
||||
actionsList.add(a);
|
||||
}
|
||||
|
||||
actionsList.add(new NewWindowViewAction(
|
||||
NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this));
|
||||
actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
|
||||
|
||||
@@ -18,27 +18,14 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.directorytree;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.ContentVisitor;
|
||||
import org.sleuthkit.datamodel.DerivedFile;
|
||||
@@ -77,8 +64,6 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
@Override
|
||||
public List<? extends Action> visit(final Image img) {
|
||||
List<Action> lst = new ArrayList<>();
|
||||
lst.add(new ImageDetails(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.imgDetails.title"), img));
|
||||
//TODO lst.add(new ExtractAction("Extract Image", img));
|
||||
lst.add(new ExtractUnallocAction(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.extUnallocToSingleFiles"), img));
|
||||
@@ -87,15 +72,12 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final FileSystem fs) {
|
||||
return Collections.singletonList(new FileSystemDetails(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.fileSystemDetails.title"), fs));
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final Volume vol) {
|
||||
List<AbstractAction> lst = new ArrayList<>();
|
||||
lst.add(new VolumeDetails(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.volumeDetails.title"), vol));
|
||||
lst.add(new ExtractUnallocAction(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.extUnallocToSingleFile"), vol));
|
||||
return lst;
|
||||
@@ -152,242 +134,4 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
return Collections.<Action>emptyList();
|
||||
}
|
||||
|
||||
//Below here are classes regarding node-specific actions
|
||||
/**
|
||||
* VolumeDetails class
|
||||
*/
|
||||
private class VolumeDetails extends AbstractAction {
|
||||
|
||||
private final String title;
|
||||
private final Volume vol;
|
||||
|
||||
VolumeDetails(String title, Volume vol) {
|
||||
super(title);
|
||||
this.title = title;
|
||||
this.vol = vol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final JFrame frame = new JFrame(title);
|
||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||
|
||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
// set the popUp window / JFrame
|
||||
popUpWindow.setSize(800, 400);
|
||||
|
||||
int w = popUpWindow.getSize().width;
|
||||
int h = popUpWindow.getSize().height;
|
||||
|
||||
// set the location of the popUp Window on the center of the screen
|
||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||
|
||||
VolumeDetailsPanel volumeDetailPanel = new VolumeDetailsPanel();
|
||||
Boolean counter = false;
|
||||
|
||||
volumeDetailPanel.setVolumeIDValue(Long.toString(vol.getAddr()));
|
||||
volumeDetailPanel.setStartValue(Long.toString(vol.getStart()));
|
||||
volumeDetailPanel.setLengthValue(Long.toString(vol.getLength()));
|
||||
volumeDetailPanel.setDescValue(vol.getDescription());
|
||||
volumeDetailPanel.setFlagsValue(vol.getFlagsAsString());
|
||||
counter = true;
|
||||
|
||||
if (counter) {
|
||||
// add the volume detail panel to the popUp window
|
||||
popUpWindow.add(volumeDetailPanel);
|
||||
} else {
|
||||
// error handler if no volume matches
|
||||
JLabel error = new JLabel(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.volDetail.noVolMatchErr"));
|
||||
error.setFont(error.getFont().deriveFont(Font.BOLD, 24));
|
||||
popUpWindow.add(error);
|
||||
}
|
||||
|
||||
// add the command to close the window to the button on the Volume Detail Panel
|
||||
volumeDetailPanel.setOKButtonActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
popUpWindow.dispose();
|
||||
}
|
||||
});
|
||||
popUpWindow.pack();
|
||||
popUpWindow.setResizable(false);
|
||||
popUpWindow.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageDetails panel class
|
||||
*/
|
||||
private class ImageDetails extends AbstractAction {
|
||||
|
||||
final String title;
|
||||
final Image img;
|
||||
|
||||
ImageDetails(String title, Image img) {
|
||||
super(title);
|
||||
this.title = title;
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final JFrame frame = new JFrame(title);
|
||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||
// if we select the Image Details menu
|
||||
|
||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
// set the popUp window / JFrame
|
||||
popUpWindow.setSize(750, 400);
|
||||
|
||||
int w = popUpWindow.getSize().width;
|
||||
int h = popUpWindow.getSize().height;
|
||||
|
||||
// set the location of the popUp Window on the center of the screen
|
||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||
|
||||
ImageDetailsPanel imgDetailPanel = new ImageDetailsPanel();
|
||||
Boolean counter = false;
|
||||
|
||||
imgDetailPanel.setImgNameValue(img.getName());
|
||||
imgDetailPanel.setImgTypeValue(img.getType().getName());
|
||||
imgDetailPanel.setImgSectorSizeValue(Long.toString(img.getSsize()));
|
||||
imgDetailPanel.setImgTotalSizeValue(Long.toString(img.getSize()));
|
||||
String hash = img.getMd5();
|
||||
// don't show the hash if there isn't one
|
||||
imgDetailPanel.setVisibleHashInfo(hash != null);
|
||||
imgDetailPanel.setImgHashValue(hash);
|
||||
|
||||
counter = true;
|
||||
|
||||
if (counter) {
|
||||
// add the volume detail panel to the popUp window
|
||||
popUpWindow.add(imgDetailPanel);
|
||||
} else {
|
||||
// error handler if no volume matches
|
||||
JLabel error = new JLabel(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.imgDetail.noVolMatchesErr"));
|
||||
error.setFont(error.getFont().deriveFont(Font.BOLD, 24));
|
||||
popUpWindow.add(error);
|
||||
}
|
||||
|
||||
// add the command to close the window to the button on the Volume Detail Panel
|
||||
imgDetailPanel.setOKButtonActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
popUpWindow.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
popUpWindow.pack();
|
||||
popUpWindow.setResizable(false);
|
||||
popUpWindow.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FileSystemDetails class
|
||||
*/
|
||||
private class FileSystemDetails extends AbstractAction {
|
||||
|
||||
private final FileSystem fs;
|
||||
private final String title;
|
||||
|
||||
FileSystemDetails(String title, FileSystem fs) {
|
||||
super(title);
|
||||
this.title = title;
|
||||
this.fs = fs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
final JFrame frame = new JFrame(title);
|
||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||
|
||||
// set the popUp window / JFrame
|
||||
popUpWindow.setSize(1000, 500);
|
||||
|
||||
int w = popUpWindow.getSize().width;
|
||||
int h = popUpWindow.getSize().height;
|
||||
|
||||
// set the location of the popUp Window on the center of the screen
|
||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||
|
||||
String[] columnNames = new String[]{
|
||||
"fs_id", //NON-NLS
|
||||
"img_offset", //NON-NLS
|
||||
"par_id", //NON-NLS
|
||||
"fs_type", //NON-NLS
|
||||
"block_size", //NON-NLS
|
||||
"block_count", //NON-NLS
|
||||
"root_inum", //NON-NLS
|
||||
"first_inum", //NON-NLS
|
||||
"last_inum" //NON-NLS
|
||||
};
|
||||
|
||||
Object[][] rowValues = new Object[1][9];
|
||||
|
||||
Content parent = null;
|
||||
try {
|
||||
parent = fs.getParent();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(
|
||||
NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.exception.probGetParent.text",
|
||||
FileSystem.class.getName(), fs), ex);
|
||||
}
|
||||
long id = -1;
|
||||
if (parent != null) {
|
||||
id = parent.getId();
|
||||
}
|
||||
|
||||
Arrays.fill(rowValues, 0, 1, new Object[]{
|
||||
fs.getId(),
|
||||
fs.getImageOffset(),
|
||||
id,
|
||||
fs.getFsType(),
|
||||
fs.getBlock_size(),
|
||||
fs.getBlock_count(),
|
||||
fs.getRoot_inum(),
|
||||
fs.getFirst_inum(),
|
||||
fs.getLastInum()
|
||||
});
|
||||
|
||||
JTable table = new JTable(new DefaultTableModel(rowValues, columnNames));
|
||||
|
||||
FileSystemDetailsPanel fsdPanel = new FileSystemDetailsPanel();
|
||||
|
||||
// add the command to close the window to the button on the Volume Detail Panel
|
||||
fsdPanel.setOKButtonActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
popUpWindow.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
fsdPanel.setFileSystemTypeValue(table.getValueAt(0, 3).toString());
|
||||
fsdPanel.setImageOffsetValue(table.getValueAt(0, 1).toString());
|
||||
fsdPanel.setVolumeIDValue(table.getValueAt(0, 2).toString()); //TODO: fix this to parent id, not vol id
|
||||
fsdPanel.setBlockSizeValue(table.getValueAt(0, 4).toString());
|
||||
fsdPanel.setBlockCountValue(table.getValueAt(0, 5).toString());
|
||||
fsdPanel.setRootInumValue(table.getValueAt(0, 6).toString());
|
||||
fsdPanel.setFirstInumValue(table.getValueAt(0, 7).toString());
|
||||
fsdPanel.setLastInumValue(table.getValueAt(0, 8).toString());
|
||||
|
||||
popUpWindow.add(fsdPanel);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.WARNING, "Error setting up File System Details panel.", ex); //NON-NLS
|
||||
}
|
||||
|
||||
popUpWindow.pack();
|
||||
popUpWindow.setResizable(false);
|
||||
popUpWindow.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user