mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge branch 'master' of https://github.com/0xNF/autopsy
This commit is contained in:
commit
80f9ab2d3f
@ -16,8 +16,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.sleuthkit.autopsy.directorytree;
|
package org.sleuthkit.autopsy.directorytree;
|
||||||
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
@ -44,7 +42,6 @@ import org.sleuthkit.datamodel.FileSystem;
|
|||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.Volume;
|
import org.sleuthkit.datamodel.Volume;
|
||||||
|
|
||||||
|
|
||||||
class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
|
class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
|
||||||
|
|
||||||
private static ExplorerNodeActionVisitor instance = new ExplorerNodeActionVisitor();
|
private static ExplorerNodeActionVisitor instance = new ExplorerNodeActionVisitor();
|
||||||
@ -72,15 +69,116 @@ class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Ac
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExplorerNodeActionVisitor() {}
|
ExplorerNodeActionVisitor() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final Image img) {
|
public List<? extends Action> visit(final Image img) {
|
||||||
final String title = "Image Details";
|
|
||||||
|
|
||||||
List<Action> lst = new ArrayList<Action>();
|
List<Action> lst = new ArrayList<Action>();
|
||||||
|
lst.add(new ImageDetails("Image Details", img));
|
||||||
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single Files", img));
|
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single Files", img));
|
||||||
lst.add(new AbstractAction(title) {
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> visit(final FileSystem fs) {
|
||||||
|
return Collections.singletonList(new FileSystemDetails("File System Details", fs));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> visit(final Volume vol) {
|
||||||
|
List<AbstractAction> lst = new ArrayList<AbstractAction>();
|
||||||
|
lst.add(new VolumeDetails("Volume Details", vol));
|
||||||
|
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single File", vol));
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<? extends Action> defaultVisit(Content di) {
|
||||||
|
return new ArrayList<Action>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//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) {
|
||||||
|
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
||||||
|
|
||||||
|
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("Error: No Volume Matches.");
|
||||||
|
error.setFont(new Font("Arial", 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
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -121,7 +219,6 @@ class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Ac
|
|||||||
|
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
imgDetailPanel.setOKButtonActionListener(new ActionListener() {
|
imgDetailPanel.setOKButtonActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
popUpWindow.dispose();
|
popUpWindow.dispose();
|
||||||
@ -133,16 +230,21 @@ class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Ac
|
|||||||
popUpWindow.setResizable(false);
|
popUpWindow.setResizable(false);
|
||||||
popUpWindow.setVisible(true);
|
popUpWindow.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return lst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public List<? extends Action> visit(final FileSystem fs) {
|
* FileSystemDetails class
|
||||||
final String title = "File System Details";
|
*/
|
||||||
|
private class FileSystemDetails extends AbstractAction {
|
||||||
|
|
||||||
return Collections.singletonList(new AbstractAction(title) {
|
private final FileSystem fs;
|
||||||
|
private final String title;
|
||||||
|
|
||||||
|
FileSystemDetails(String title, FileSystem fs) {
|
||||||
|
super(title);
|
||||||
|
this.title = title;
|
||||||
|
this.fs = fs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -199,7 +301,6 @@ class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Ac
|
|||||||
|
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
fsdPanel.setOKButtonActionListener(new ActionListener() {
|
fsdPanel.setOKButtonActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
popUpWindow.dispose();
|
popUpWindow.dispose();
|
||||||
@ -226,73 +327,5 @@ class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Ac
|
|||||||
popUpWindow.setVisible(true);
|
popUpWindow.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<? extends Action> visit(final Volume vol) {
|
|
||||||
List<AbstractAction> lst = new ArrayList<AbstractAction>();
|
|
||||||
final String title = "Volume Details";
|
|
||||||
lst.add(new AbstractAction(title) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
|
||||||
|
|
||||||
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("Error: No Volume Matches.");
|
|
||||||
error.setFont(new Font("Arial", 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);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single File", vol));
|
|
||||||
return lst;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<? extends Action> defaultVisit(Content di) {
|
|
||||||
return new ArrayList<Action>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user