Merge branch 'master' of github.com:sleuthkit/autopsy

This commit is contained in:
Brian Carrier 2013-09-04 09:49:00 -04:00
commit 2bae58809d
27 changed files with 633 additions and 424 deletions

View File

@ -59,7 +59,7 @@ import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
public class Case implements SleuthkitCase.ErrorObserver { public class Case implements SleuthkitCase.ErrorObserver {
private static final String autopsyVer = Version.getVersion(); // current version of autopsy. Change it when the version is changed private static final String autopsyVer = Version.getVersion(); // current version of autopsy. Change it when the version is changed
private static final String appName = Version.getName() + " " + autopsyVer; private static String appName = null;
/** /**
* Property name that indicates the name of the current case has changed. * Property name that indicates the name of the current case has changed.
* Fired with the case is renamed, and when the current case is * Fired with the case is renamed, and when the current case is
@ -507,6 +507,9 @@ public class Case implements SleuthkitCase.ErrorObserver {
* @return appName * @return appName
*/ */
public static String getAppName() { public static String getAppName() {
if ((appName == null ) || appName.equals("")) {
appName = WindowManager.getDefault().getMainWindow().getTitle();
}
return appName; return appName;
} }
@ -575,6 +578,19 @@ public class Case implements SleuthkitCase.ErrorObserver {
return xmlcm.getCacheDir(); return xmlcm.getCacheDir();
} }
} }
/**
* Gets the full path to the export directory of this case
*
* @return export DirectoryPath
*/
public String getExportDirectory() {
if (xmlcm == null) {
return "";
} else {
return xmlcm.getExportDir();
}
}
/** /**
* get the created date of this case * get the created date of this case

View File

@ -24,16 +24,14 @@ import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.coreutils.Version;
import org.netbeans.api.options.OptionsDisplayer;
/** /**
* *
* @author jantonius
*/ */
public class CueBannerPanel extends javax.swing.JPanel { public class CueBannerPanel extends javax.swing.JPanel {
@ -45,11 +43,19 @@ public class CueBannerPanel extends javax.swing.JPanel {
private static JPanel caller = new JPanel(); private static JPanel caller = new JPanel();
private String className = this.getClass().toString(); private String className = this.getClass().toString();
/** Creates new form CueBannerPanel */
public CueBannerPanel() { public CueBannerPanel() {
initComponents(); initComponents();
} }
public CueBannerPanel(String welcomeLogo) {
initComponents();
ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
if (cl != null) {
ImageIcon icon = new ImageIcon(cl.getResource(welcomeLogo));
autopsyLogo.setIcon(icon);
}
}
/** This method is called from within the constructor to /** This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
@ -254,7 +260,7 @@ public class CueBannerPanel extends javax.swing.JPanel {
*/ */
public void setCloseButtonText(String text) { public void setCloseButtonText(String text) {
closeButton.setText(text); closeButton.setText(text);
} }
/** /**
* Close the open recent cases window. * Close the open recent cases window.

View File

@ -58,7 +58,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa
// set the location of the popUp Window on the center of the screen // set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2); setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
CueBannerPanel welcomeWindow = new CueBannerPanel(); CueBannerPanel welcomeWindow = new CueBannerPanel();
// 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

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -39,11 +39,10 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* Holds commonalities between all DataResultViewers, such as: * Holds commonalities between all DataResultViewers, such as:
* - Pushes selection to DataContentViewers * - Pushes selection to DataContentViewers
*/ */
public abstract class AbstractDataResultViewer extends JPanel implements public abstract class AbstractDataResultViewer extends JPanel implements DataResultViewer, Provider {
DataResultViewer, Provider {
private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName()); private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName());
protected transient ExplorerManager em = new ExplorerManager(); protected transient ExplorerManager em;
private PropertyChangeListener nodeSelListener; private PropertyChangeListener nodeSelListener;
/** /**
* Content viewer to respond to selection events Either the main one, or * Content viewer to respond to selection events Either the main one, or
@ -51,8 +50,17 @@ public abstract class AbstractDataResultViewer extends JPanel implements
*/ */
protected DataContent contentViewer; protected DataContent contentViewer;
public AbstractDataResultViewer(ExplorerManager explorerManager) {
this.em = explorerManager;
initialize();
}
public AbstractDataResultViewer() { public AbstractDataResultViewer() {
em = new ExplorerManager();
initialize();
}
private void initialize() {
//DataContent is designed to return only the default viewer from lookup //DataContent is designed to return only the default viewer from lookup
//use the default one unless set otherwise //use the default one unless set otherwise
contentViewer = Lookup.getDefault().lookup(DataContent.class); contentViewer = Lookup.getDefault().lookup(DataContent.class);
@ -113,19 +121,12 @@ public abstract class AbstractDataResultViewer extends JPanel implements
} }
}; };
em.addPropertyChangeListener(nodeSelListener); em.addPropertyChangeListener(nodeSelListener);
} }
@Override @Override
public void clearComponent() { public void clearComponent() {
em.removePropertyChangeListener(nodeSelListener); em.removePropertyChangeListener(nodeSelListener);
try {
this.em.getRootContext().destroy();
em = null;
} catch (IOException ex) {
logger.log(Level.WARNING, "Can't clear the component of the Thumbnail Result Viewer.", ex);
}
} }
@Deprecated @Deprecated

View File

@ -177,6 +177,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
@Override @Override
public void resetComponent() { public void resetComponent() {
lastFile = null;
videoPanel.reset(); videoPanel.reset();
} }

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
@ -47,11 +48,12 @@ import org.sleuthkit.autopsy.coreutils.Logger;
*/ */
public class DataResultPanel extends javax.swing.JPanel implements DataResult, ChangeListener { public class DataResultPanel extends javax.swing.JPanel implements DataResult, ChangeListener {
private ExplorerManager explorerManager;
private Node rootNode; private Node rootNode;
private PropertyChangeSupport pcs; private PropertyChangeSupport pcs;
// Different DataResultsViewers // Different DataResultsViewers
private final List<UpdateWrapper> viewers = new ArrayList<UpdateWrapper>(); private final List<UpdateWrapper> viewers = new ArrayList<>();
//custom content viewer to send selections to, or null if the main one //custom content viewer to send selections to, or null if the main one
private DataContent customContentViewer; private DataContent customContentViewer;
private boolean isMain; private boolean isMain;
@ -90,7 +92,6 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.isMain = isMain; this.isMain = isMain;
this.title = title; this.title = title;
} }
/** /**
@ -110,7 +111,6 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.customContentViewer = customContentViewer; this.customContentViewer = customContentViewer;
} }
/** /**
* Factory method to create, customize and open a new custom data result panel. * Factory method to create, customize and open a new custom data result panel.
* *
@ -170,20 +170,31 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.customContentViewer = customContentViewer; this.customContentViewer = customContentViewer;
} }
/** /**
* Initializes the panel internals and activates it. * Initializes the panel internals and activates it.
* Call it within your top component when it is opened. * Call it within your top component when it is opened.
* Do not use if used one of the factory methods to create and open the component. * Do not use if used one of the factory methods to create and open the component.
*/ */
public void open() { public void open() {
if (null == this.explorerManager) {
this.explorerManager = ExplorerManager.find(this);
}
// Add all the DataContentViewer to the tabbed pannel. // Add all the DataContentViewer to the tabbed pannel.
// (Only when the it's opened at the first time: tabCount = 0) // (Only when the it's opened at the first time: tabCount = 0)
int totalTabs = this.dataResultTabbedPanel.getTabCount(); int totalTabs = this.dataResultTabbedPanel.getTabCount();
if (totalTabs == 0) { if (totalTabs == 0) {
// find all dataContentViewer and add them to the tabbed pane // @@@ Restore the implementation of DataResultViewerTable and DataResultViewerThumbnail
// as DataResultViewer service providers when DataResultViewers can be made compatible with node
// multiple selection actions.
addDataResultViewer(new DataResultViewerTable(this.explorerManager));
addDataResultViewer(new DataResultViewerThumbnail(this.explorerManager));
// Find all DataResultViewer service providers and add them to the tabbed pane.
for (DataResultViewer factory : Lookup.getDefault().lookupAll(DataResultViewer.class)) { for (DataResultViewer factory : Lookup.getDefault().lookupAll(DataResultViewer.class)) {
// @@@ Revist this isMain condition, it may be obsolete. If not,
// document the intent of DataResultViewer.createInstance() in the
// DataResultViewer interface defintion.
DataResultViewer drv; DataResultViewer drv;
if (isMain) { if (isMain) {
//for main window, use the instance in the lookup //for main window, use the instance in the lookup
@ -193,14 +204,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
//create a new instance of the viewer for non-main window //create a new instance of the viewer for non-main window
drv = factory.createInstance(); drv = factory.createInstance();
} }
UpdateWrapper resultViewer = new UpdateWrapper(drv); addDataResultViewer(drv);
if (customContentViewer != null) {
//set custom content viewer to respond to events from this result viewer
resultViewer.setContentViewer(customContentViewer);
}
this.viewers.add(resultViewer);
this.dataResultTabbedPanel.addTab(drv.getTitle(), drv.getComponent());
} }
} }
@ -211,12 +215,18 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
} }
} }
this.setVisible(true); this.setVisible(true);
} }
private void addDataResultViewer(DataResultViewer dataResultViewer) {
UpdateWrapper viewerWrapper = new UpdateWrapper(dataResultViewer);
if (null != this.customContentViewer) {
viewerWrapper.setContentViewer(this.customContentViewer);
}
this.viewers.add(viewerWrapper);
this.dataResultTabbedPanel.addTab(dataResultViewer.getTitle(), dataResultViewer.getComponent());
}
/** /**
* Tears down the component. * Tears down the component.
* Use within your outer container (such as a top component) when it goes away to tear * Use within your outer container (such as a top component) when it goes away to tear
@ -249,12 +259,8 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.removeAll(); this.removeAll();
this.setVisible(false); this.setVisible(false);
} }
} }
@Override @Override
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
if (pcs == null) { if (pcs == null) {
@ -335,8 +341,6 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
return ret; return ret;
} }
public boolean canClose() { public boolean canClose() {
return (!this.isMain) || !Case.existsCurrentCase() || Case.getCurrentCase().getRootObjectsCount() == 0; // only allow this window to be closed when there's no case opened or no image in this case return (!this.isMain) || !Case.existsCurrentCase() || Case.getCurrentCase().getRootObjectsCount() == 0; // only allow this window to be closed when there's no case opened or no image in this case
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResult; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResult;
import java.util.logging.Level; import java.util.logging.Level;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils; import org.openide.explorer.ExplorerUtils;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
@ -50,15 +51,15 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* *
* Implements DataResult interface by delegating to the encapsulated DataResultPanel. * Implements DataResult interface by delegating to the encapsulated DataResultPanel.
*/ */
public class DataResultTopComponent extends TopComponent implements DataResult { public class DataResultTopComponent extends TopComponent implements DataResult, ExplorerManager.Provider {
private static final Logger logger = Logger.getLogger(DataResultTopComponent.class.getName()); private static final Logger logger = Logger.getLogger(DataResultTopComponent.class.getName());
private ExplorerManager explorerManager = new ExplorerManager();
private DataResultPanel dataResultPanel; //embedded component with all the logic private DataResultPanel dataResultPanel; //embedded component with all the logic
private boolean isMain; private boolean isMain;
private boolean lookupSet = false;
private String customModeName; private String customModeName;
//keep track of tcs openeded for menu presenters //keep track of tcs opened for menu presenters
private static final List<String> activeComponentIds = Collections.synchronizedList(new ArrayList<String>()); private static final List<String> activeComponentIds = Collections.synchronizedList(new ArrayList<String>());
/** /**
@ -69,14 +70,10 @@ public class DataResultTopComponent extends TopComponent implements DataResult {
* @param title title of the data result window * @param title title of the data result window
*/ */
public DataResultTopComponent(boolean isMain, String title) { public DataResultTopComponent(boolean isMain, String title) {
super(); associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
//dataResultPanel is added to this tc using UI builder
this.dataResultPanel = new DataResultPanel(isMain, title); this.dataResultPanel = new DataResultPanel(isMain, title);
initComponents(); initComponents();
customizeComponent(isMain, title); customizeComponent(isMain, title);
} }
/** /**
@ -89,18 +86,13 @@ public class DataResultTopComponent extends TopComponent implements DataResult {
* to * to
*/ */
DataResultTopComponent(String name, String mode, DataContentTopComponent customContentViewer) { DataResultTopComponent(String name, String mode, DataContentTopComponent customContentViewer) {
super(); associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
this.customModeName = mode; this.customModeName = mode;
//custom content viewer to link to this result viewer
//dataResultPanel is added to this tc using UI builder
dataResultPanel = new DataResultPanel(name, customContentViewer); dataResultPanel = new DataResultPanel(name, customContentViewer);
initComponents(); initComponents();
customizeComponent(isMain, name);; customizeComponent(isMain, name);
} }
private void customizeComponent(boolean isMain, String title) { private void customizeComponent(boolean isMain, String title) {
this.isMain = isMain; this.isMain = isMain;
this.customModeName = null; this.customModeName = null;
@ -185,16 +177,19 @@ public class DataResultTopComponent extends TopComponent implements DataResult {
return newDataResult; return newDataResult;
} }
@Override
public ExplorerManager getExplorerManager() {
return explorerManager;
}
/** /**
* Get a list with names of active windows ids, e.g. for the menus * Get a list with names of active windows ids, e.g. for the menus
* @return * @return
*/ */
public static List<String> getActiveComponentIds() { public static List<String> getActiveComponentIds() {
return new ArrayList<String>(activeComponentIds); return new ArrayList<>(activeComponentIds);
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -226,7 +221,6 @@ public class DataResultTopComponent extends TopComponent implements DataResult {
} else { } else {
return TopComponent.PERSISTENCE_ALWAYS; return TopComponent.PERSISTENCE_ALWAYS;
} }
} }
@Override @Override
@ -240,54 +234,36 @@ public class DataResultTopComponent extends TopComponent implements DataResult {
return dataResultPanel.getViewers(); return dataResultPanel.getViewers();
} }
private void setCustomMode() { private void setCustomMode() {
if (customModeName != null) { if (customModeName != null) {
//putClientProperty("TopComponentAllowDockAnywhere", Boolean.TRUE); //putClientProperty("TopComponentAllowDockAnywhere", Boolean.TRUE);
Mode mode = WindowManager.getDefault().findMode(customModeName); Mode mode = WindowManager.getDefault().findMode(customModeName);
if (mode != null) { if (mode != null) {
logger.log(Level.INFO, "Found custom mode, setting: " + customModeName); StringBuilder message = new StringBuilder("Found custom mode, setting: ");
message.append(customModeName);
logger.log(Level.INFO, message.toString());
mode.dockInto(this); mode.dockInto(this);
} else { } else {
logger.log(Level.WARNING, "Could not find mode: " + customModeName + ", will dock into the default one"); StringBuilder message = new StringBuilder("Could not find mode: ");
message.append(customModeName);
message.append(", will dock into the default one");
logger.log(Level.WARNING, message.toString());
} }
} }
} }
@Override @Override
public void componentOpened() { public void componentOpened() {
super.componentOpened(); super.componentOpened();
this.dataResultPanel.open();
this.dataResultPanel.open();
/* @@@ Short-term hack to associate lookup with the table view so that we can do multi-select.
* Longer-term solution is to use same explorer Manager for all viewers.
*/
if (!this.lookupSet) {
List <DataResultViewer> resultViewers = this.dataResultPanel.getViewers();
for (DataResultViewer viewer : resultViewers) {
if (viewer instanceof DataResultViewerTable) {
associateLookup(ExplorerUtils.createLookup(((DataResultViewerTable)viewer).getExplorerManager(), getActionMap()));
break;
}
}
this.lookupSet = true;
}
} }
@Override @Override
public void componentClosed() { public void componentClosed() {
super.componentClosed(); super.componentClosed();
activeComponentIds.remove(this.getName()); activeComponentIds.remove(this.getName());
dataResultPanel.close(); dataResultPanel.close();
} }
@Override @Override

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -31,6 +31,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import org.netbeans.swing.outline.DefaultOutlineModel; import org.netbeans.swing.outline.DefaultOutlineModel;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.view.OutlineView; import org.openide.explorer.view.OutlineView;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
@ -38,23 +39,39 @@ import org.openide.nodes.Node;
import org.openide.nodes.Node.Property; import org.openide.nodes.Node.Property;
import org.openide.nodes.Node.PropertySet; import org.openide.nodes.Node.PropertySet;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
/** /**
* DataResult sortable table viewer * DataResult sortable table viewer
*/ */
@ServiceProvider(service = DataResultViewer.class) // @@@ Restore implementation of DataResultViewerTable as a DataResultViewer
// service provider when DataResultViewers can be made compatible with node
// multiple selection actions.
//@ServiceProvider(service = DataResultViewer.class)
public class DataResultViewerTable extends AbstractDataResultViewer { public class DataResultViewerTable extends AbstractDataResultViewer {
private String firstColumnLabel = "Name"; private String firstColumnLabel = "Name";
private Set<Property> propertiesAcc = new LinkedHashSet<Property>(); private Set<Property> propertiesAcc = new LinkedHashSet<>();
private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName()); private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName());
/** /**
* Creates new form DataResultViewerTable * Creates a DataResultViewerTable object that is compatible with node
* multiple selection actions.
*/
public DataResultViewerTable(ExplorerManager explorerManager) {
super(explorerManager);
initialize();
}
/**
* Creates a DataResultViewerTable object that is NOT compatible with node
* multiple selection actions.
*/ */
public DataResultViewerTable() { public DataResultViewerTable() {
initialize();
}
private void initialize() {
initComponents(); initComponents();
OutlineView ov = ((OutlineView) this.tableScrollPanel); OutlineView ov = ((OutlineView) this.tableScrollPanel);
@ -66,9 +83,9 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
// don't show the root node // don't show the root node
ov.getOutline().setRootVisible(false); ov.getOutline().setRootVisible(false);
ov.getOutline().setDragEnabled(false); ov.getOutline().setDragEnabled(false);
} }
/** /**
* Expand node * Expand node
* *
@ -435,8 +452,6 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
this.tableScrollPanel.removeAll(); this.tableScrollPanel.removeAll();
this.tableScrollPanel = null; this.tableScrollPanel = null;
//this destroys em
super.clearComponent(); super.clearComponent();
} }
} }

View File

@ -39,6 +39,8 @@
<Component id="imagesLabel" min="-2" max="-2" attributes="0"/> <Component id="imagesLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="imagesRangeLabel" min="-2" pref="91" max="-2" attributes="0"/> <Component id="imagesRangeLabel" min="-2" pref="91" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="thumbnailSizeComboBox" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
@ -61,6 +63,7 @@
<Component id="imagesRangeLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="imagesRangeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="goToPageLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="goToPageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="goToPageField" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="goToPageField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="thumbnailSizeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/> <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
@ -196,5 +199,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="goToPageFieldActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="goToPageFieldActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Small Thumbnails"/>
<StringItem index="1" value="Medium Thumbnails"/>
<StringItem index="2" value="Large Thumbnails"/>
</StringArray>
</Property>
<Property name="selectedIndex" type="int" value="1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,6 +22,7 @@ import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.util.Arrays;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -29,6 +30,7 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.view.IconView; import org.openide.explorer.view.IconView;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
@ -37,7 +39,6 @@ import org.openide.nodes.NodeEvent;
import org.openide.nodes.NodeListener; import org.openide.nodes.NodeListener;
import org.openide.nodes.NodeMemberEvent; import org.openide.nodes.NodeMemberEvent;
import org.openide.nodes.NodeReorderEvent; import org.openide.nodes.NodeReorderEvent;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
@ -50,7 +51,10 @@ import org.sleuthkit.datamodel.TskCoreException;
* are being lazy loaded or not. * are being lazy loaded or not.
* *
*/ */
@ServiceProvider(service = DataResultViewer.class) // @@@ Restore implementation of DataResultViewerThumbnail as a DataResultViewer
// service provider when DataResultViewers can be made compatible with node
// multi-selection actions.
//@ServiceProvider(service = DataResultViewer.class)
public final class DataResultViewerThumbnail extends AbstractDataResultViewer { public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
private static final Logger logger = Logger.getLogger(DataResultViewerThumbnail.class.getName()); private static final Logger logger = Logger.getLogger(DataResultViewerThumbnail.class.getName());
@ -58,25 +62,37 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
private int curPage; private int curPage;
private int totalPages; private int totalPages;
private int curPageImages; private int curPageImages;
private int iconSize = ThumbnailViewNode.ICON_SIZE_MEDIUM;
private final PageUpdater pageUpdater = new PageUpdater(); private final PageUpdater pageUpdater = new PageUpdater();
/** /**
* Creates new form DataResultViewerThumbnail * Creates a DataResultViewerThumbnail object that is compatible with node
* multiple selection actions.
*/
public DataResultViewerThumbnail(ExplorerManager explorerManager) {
super(explorerManager);
initialize();
}
/**
* Creates a DataResultViewerThumbnail object that is NOT compatible with
* node multiple selection actions.
*/ */
public DataResultViewerThumbnail() { public DataResultViewerThumbnail() {
super(); initialize();
}
private void initialize() {
initComponents(); initComponents();
// only allow one item to be selected at a time // only allow one item to be selected at a time
((IconView) thumbnailScrollPanel).setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ((IconView) thumbnailScrollPanel).setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
curPage = -1; curPage = -1;
totalPages = 0; totalPages = 0;
curPageImages = 0; curPageImages = 0;
}
}
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -97,6 +113,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
filePathLabel = new javax.swing.JLabel(); filePathLabel = new javax.swing.JLabel();
goToPageLabel = new javax.swing.JLabel(); goToPageLabel = new javax.swing.JLabel();
goToPageField = new javax.swing.JTextField(); goToPageField = new javax.swing.JTextField();
thumbnailSizeComboBox = new javax.swing.JComboBox();
thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348)); thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348));
@ -146,6 +163,14 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
} }
}); });
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.setSelectedIndex(1);
thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
thumbnailSizeComboBoxActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -172,8 +197,10 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
.addGap(12, 12, 12) .addGap(12, 12, 12)
.addComponent(imagesLabel) .addComponent(imagesLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(imagesRangeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(imagesRangeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(thumbnailSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -189,7 +216,8 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
.addComponent(imagesLabel) .addComponent(imagesLabel)
.addComponent(imagesRangeLabel) .addComponent(imagesRangeLabel)
.addComponent(goToPageLabel) .addComponent(goToPageLabel)
.addComponent(goToPageField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(goToPageField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(thumbnailSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -209,6 +237,38 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
goToPage(goToPageField.getText()); goToPage(goToPageField.getText());
}//GEN-LAST:event_goToPageFieldActionPerformed }//GEN-LAST:event_goToPageFieldActionPerformed
private void thumbnailSizeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_thumbnailSizeComboBoxActionPerformed
iconSize = ThumbnailViewNode.ICON_SIZE_MEDIUM; //default size
switch(thumbnailSizeComboBox.getSelectedIndex()) {
case 0:
iconSize = ThumbnailViewNode.ICON_SIZE_SMALL;
break;
case 2:
iconSize = ThumbnailViewNode.ICON_SIZE_LARGE;
break;
}
Node root = em.getRootContext();
for (Children c : Arrays.asList(root.getChildren()) ) {
((ThumbnailViewChildren)c).setIconSize(iconSize);
}
for (Node page : root.getChildren().getNodes()) {
for (Node node : page.getChildren().getNodes()) {
((ThumbnailViewNode)node).setIconSize(iconSize);
}
}
// Temporarily set the explored context to the root, instead of a child node.
// This is a workaround hack to convince org.openide.explorer.ExplorerManager to
// update even though the new and old Node values are identical. This in turn
// will cause the entire view to update completely. After this we
// immediately set the node back to the current child by calling switchPage().
em.setExploredContext(root);
switchPage();
}//GEN-LAST:event_thumbnailSizeComboBoxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel filePathLabel; private javax.swing.JLabel filePathLabel;
private javax.swing.JTextField goToPageField; private javax.swing.JTextField goToPageField;
@ -221,6 +281,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
private javax.swing.JButton pagePrevButton; private javax.swing.JButton pagePrevButton;
private javax.swing.JLabel pagesLabel; private javax.swing.JLabel pagesLabel;
private javax.swing.JScrollPane thumbnailScrollPanel; private javax.swing.JScrollPane thumbnailScrollPanel;
private javax.swing.JComboBox thumbnailSizeComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@Override @Override
@ -246,8 +307,8 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
if (givenNode != null) { if (givenNode != null) {
ThumbnailViewChildren childNode = new ThumbnailViewChildren(givenNode); ThumbnailViewChildren childNode = new ThumbnailViewChildren(givenNode, iconSize);
final Node root = new AbstractNode(childNode); final Node root = new AbstractNode(childNode);
pageUpdater.setRoot(root); pageUpdater.setRoot(root);
root.addNodeListener(pageUpdater); root.addNodeListener(pageUpdater);
@ -315,7 +376,6 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
this.thumbnailScrollPanel.removeAll(); this.thumbnailScrollPanel.removeAll();
this.thumbnailScrollPanel = null; this.thumbnailScrollPanel = null;
//this destroyes em
super.clearComponent(); super.clearComponent();
} }
@ -377,7 +437,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
progress.start(); progress.start();
progress.switchToIndeterminate(); progress.switchToIndeterminate();
Node root = em.getRootContext(); Node root = em.getRootContext();
Node pageNode = root.getChildren().getNodeAt(curPage - 1); Node pageNode = root.getChildren().getNodeAt(curPage - 1);
em.setExploredContext(pageNode); em.setExploredContext(pageNode);
curPageImages = pageNode.getChildren().getNodesCount(); curPageImages = pageNode.getChildren().getNodesCount();
return null; return null;
@ -387,8 +447,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
protected void done() { protected void done() {
progress.finish(); progress.finish();
setCursor(null); setCursor(null);
updateControls(); updateControls();
} }
}.execute(); }.execute();

View File

@ -21,16 +21,19 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" max="32767" attributes="1"/>
<Component id="jScrollPane2" alignment="0" pref="394" max="32767" attributes="0"/> <Component id="jScrollPane2" alignment="0" pref="394" max="32767" attributes="0"/>
<Component id="jScrollPane3" alignment="1" pref="394" max="32767" attributes="0"/> <Component id="jScrollPane3" alignment="1" pref="394" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="0" pref="394" max="32767" attributes="0"/> <Component id="jLabel1" alignment="0" pref="394" max="32767" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="jPanel1" pref="237" max="32767" attributes="1"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Component id="verboseLoggingButton" min="-2" max="-2" attributes="0"/> <Component id="verboseLoggingButton" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -43,17 +46,15 @@
<EmptySpace min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane3" pref="101" max="32767" attributes="2"/> <Component id="jScrollPane3" pref="94" max="32767" attributes="2"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/> <EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="103" max="32767" attributes="0"/> <Component id="jScrollPane2" pref="96" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Component id="verboseLoggingButton" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0"> <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/> <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
</Group> <Component id="jButton2" min="-2" max="-2" attributes="0"/>
<Component id="verboseLoggingButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -80,26 +81,6 @@
</Properties> </Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/core/ui/Bundle.properties" key="LBL_Close" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container> </Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane3"> <Container class="javax.swing.JScrollPane" name="jScrollPane3">
<Properties> <Properties>
@ -159,5 +140,18 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="activateVerboseLogging"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="activateVerboseLogging"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/core/ui/Bundle.properties" key="LBL_Close" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -43,13 +43,13 @@ import org.sleuthkit.datamodel.SleuthkitJNI;
/** /**
* Custom "About" window panel. * Custom "About" window panel.
*/ */
class ProductInformationPanel extends JPanel implements HyperlinkListener { public class ProductInformationPanel extends JPanel implements HyperlinkListener {
private URL url = null; private URL url = null;
private Icon about; private Icon about;
private boolean verboseLogging; private boolean verboseLogging;
ProductInformationPanel() { public ProductInformationPanel() {
about = new ImageIcon(org.netbeans.core.startup.Splash.loadContent(true)); about = new ImageIcon(org.netbeans.core.startup.Splash.loadContent(true));
initComponents(); initComponents();
jLabel1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); jLabel1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -67,16 +67,15 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel();
jButton2 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane(); jScrollPane3 = new javax.swing.JScrollPane();
copyright = new javax.swing.JTextPane(); copyright = new javax.swing.JTextPane();
jScrollPane2 = new javax.swing.JScrollPane(); jScrollPane2 = new javax.swing.JScrollPane();
description = new javax.swing.JTextPane(); description = new javax.swing.JTextPane();
verboseLoggingButton = new javax.swing.JButton(); verboseLoggingButton = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 255, 255)); setBackground(new java.awt.Color(255, 255, 255));
@ -92,22 +91,10 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setLayout(new java.awt.GridBagLayout()); jPanel1.setLayout(new java.awt.GridBagLayout());
jButton2.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setText(NbBundle.getMessage(ProductInformationPanel.class, "LBL_Close")); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jButton2, gridBagConstraints);
jScrollPane3.setBorder(null); jScrollPane3.setBorder(null);
copyright.setBorder(null); copyright.setBorder(null);
copyright.setContentType("text/html"); copyright.setContentType("text/html"); // NOI18N
copyright.setEditable(false); copyright.setEditable(false);
copyright.setText(org.openide.util.NbBundle.getBundle(ProductInformationPanel.class).getString("LBL_Copyright")); // NOI18N copyright.setText(org.openide.util.NbBundle.getBundle(ProductInformationPanel.class).getString("LBL_Copyright")); // NOI18N
copyright.addMouseListener(new java.awt.event.MouseAdapter() { copyright.addMouseListener(new java.awt.event.MouseAdapter() {
@ -117,7 +104,7 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
}); });
jScrollPane3.setViewportView(copyright); jScrollPane3.setViewportView(copyright);
description.setContentType("text/html"); description.setContentType("text/html"); // NOI18N
description.setEditable(false); description.setEditable(false);
jScrollPane2.setViewportView(description); jScrollPane2.setViewportView(description);
@ -129,6 +116,14 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
} }
}); });
jButton2.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setText(NbBundle.getMessage(ProductInformationPanel.class, "LBL_Close")); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -136,13 +131,15 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE) .addGap(0, 0, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(verboseLoggingButton))) .addComponent(verboseLoggingButton, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING))))
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
@ -151,15 +148,15 @@ class ProductInformationPanel extends JPanel implements HyperlinkListener {
.addContainerGap() .addContainerGap()
.addComponent(jLabel1) .addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
.addGap(32, 32, 32) .addGap(32, 32, 32)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(verboseLoggingButton)
.addGroup(layout.createSequentialGroup() .addGap(0, 0, 0)
.addGap(27, 27, 27) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18)
.addComponent(verboseLoggingButton)) .addComponent(jButton2)
.addContainerGap()) .addContainerGap())
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -253,7 +250,11 @@ private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:eve
private static String getEncodingValue() { private static String getEncodingValue() {
return System.getProperty("file.encoding", "unknown"); return System.getProperty("file.encoding", "unknown");
} }
public void setCopyright(String text) {
copyright.setText(text);
}
@Override @Override
public void hyperlinkUpdate(HyperlinkEvent event) { public void hyperlinkUpdate(HyperlinkEvent event) {
if (HyperlinkEvent.EventType.ENTERED == event.getEventType()) { if (HyperlinkEvent.EventType.ENTERED == event.getEventType()) {

View File

@ -52,15 +52,17 @@ class ThumbnailViewChildren extends Children.Keys<Integer> {
private final HashMap<Integer, List<Node>> pages = new HashMap<Integer, List<Node>>(); private final HashMap<Integer, List<Node>> pages = new HashMap<Integer, List<Node>>();
private int totalImages = 0; private int totalImages = 0;
private int totalPages = 0; private int totalPages = 0;
private int iconSize = ThumbnailViewNode.ICON_SIZE_MEDIUM;
private static final Logger logger = Logger.getLogger(ThumbnailViewChildren.class.getName()); private static final Logger logger = Logger.getLogger(ThumbnailViewChildren.class.getName());
/** /**
* the constructor * the constructor
*/ */
ThumbnailViewChildren(Node arg) { ThumbnailViewChildren(Node arg, int iconSize) {
super(true); //support lazy loading super(true); //support lazy loading
this.parent = arg; this.parent = arg;
this.iconSize = iconSize;
// //
} }
@ -153,6 +155,10 @@ class ThumbnailViewChildren extends Children.Keys<Integer> {
return false; return false;
} }
public void setIconSize(int iconSize) {
this.iconSize = iconSize;
}
private static class IsSupportedContentVisitor extends ContentVisitor.Default<Boolean> { private static class IsSupportedContentVisitor extends ContentVisitor.Default<Boolean> {
private final List<String> SUPP_EXTENSIONS; private final List<String> SUPP_EXTENSIONS;
@ -255,7 +261,7 @@ class ThumbnailViewChildren extends Children.Keys<Integer> {
@Override @Override
protected Node[] createNodes(Node wrapped) { protected Node[] createNodes(Node wrapped) {
if (wrapped != null) { if (wrapped != null) {
final ThumbnailViewNode thumb = new ThumbnailViewNode(wrapped); final ThumbnailViewNode thumb = new ThumbnailViewNode(wrapped, iconSize);
return new Node[]{thumb}; return new Node[]{thumb};
} else { } else {
return new Node[]{}; return new Node[]{};

View File

@ -49,16 +49,21 @@ import org.sleuthkit.datamodel.TskException;
*/ */
class ThumbnailViewNode extends FilterNode { class ThumbnailViewNode extends FilterNode {
private SoftReference<Image> iconCache; private SoftReference<Image> iconCache = null;
private static final Image defaultIcon = new ImageIcon("/org/sleuthkit/autopsy/images/file-icon.png").getImage(); private static final Image defaultIcon = new ImageIcon("/org/sleuthkit/autopsy/images/file-icon.png").getImage();
private static final Logger logger = Logger.getLogger(ThumbnailViewNode.class.getName()); private static final Logger logger = Logger.getLogger(ThumbnailViewNode.class.getName());
static final int ICON_SIZE_SMALL = 50;
static final int ICON_SIZE_MEDIUM = 100;
static final int ICON_SIZE_LARGE = 200;
private int iconSize = ICON_SIZE_MEDIUM;
//private final BufferedImage defaultIconBI; //private final BufferedImage defaultIconBI;
/** /**
* the constructor * the constructor
*/ */
ThumbnailViewNode(Node arg) { ThumbnailViewNode(Node arg, int iconSize) {
super(arg, Children.LEAF); super(arg, Children.LEAF);
this.iconSize = iconSize;
} }
@Override @Override
@ -73,36 +78,31 @@ class ThumbnailViewNode extends FilterNode {
@Override @Override
public Image getIcon(int type) { public Image getIcon(int type) {
Image icon = null; Image icon = null;
if (iconCache != null) { if (iconCache != null) {
icon = iconCache.get(); icon = iconCache.get();
} }
if (icon == null) { if (icon == null) {
Content content = this.getLookup().lookup(Content.class); Content content = this.getLookup().lookup(Content.class);
if (content != null) { if (content != null) {
// If a thumbnail file is already saved locally
if (getFile(content.getId()).exists()) { if (getFile(content.getId()).exists()) {
try { try {
icon = ImageIO.read(getFile(content.getId())); BufferedImage bicon = ImageIO.read(getFile(content.getId()));
if (icon == null) { if (bicon == null) {
icon = ThumbnailViewNode.defaultIcon; icon = ThumbnailViewNode.defaultIcon;
} else if (bicon.getWidth() != iconSize) {
icon = generateAndSaveIcon(content);
} else {
icon = bicon;
} }
} catch (IOException ex) { } catch (IOException ex) {
icon = ThumbnailViewNode.defaultIcon; icon = ThumbnailViewNode.defaultIcon;
} }
} else { } else { // Make a new icon
try { icon = generateAndSaveIcon(content);
icon = generateIcon(content);
if (icon == null) {
icon = ThumbnailViewNode.defaultIcon;
} else {
ImageIO.write((BufferedImage) icon, "jpg", getFile(content.getId()));
}
} catch (IOException ex) {
logger.log(Level.WARNING, "Could not write cache thumbnail: " + content, ex);
}
} }
} else { } else {
icon = ThumbnailViewNode.defaultIcon; icon = ThumbnailViewNode.defaultIcon;
@ -110,14 +110,33 @@ class ThumbnailViewNode extends FilterNode {
iconCache = new SoftReference<Image>(icon); iconCache = new SoftReference<Image>(icon);
} }
return icon; return icon;
} }
private Image generateAndSaveIcon(Content content) {
Image icon = null;
try {
icon = generateIcon(content);
if (icon == null) {
icon = ThumbnailViewNode.defaultIcon;
} else {
File f = getFile(content.getId());
if (f.exists()) {
f.delete();
}
ImageIO.write((BufferedImage) icon, "jpg", getFile(content.getId()));
}
} catch (IOException ex) {
logger.log(Level.WARNING, "Could not write cache thumbnail: " + content, ex);
}
return icon;
}
/* /*
* Generate a scaled image * Generate a scaled image
*/ */
static private BufferedImage generateIcon(Content content) { private BufferedImage generateIcon(Content content) {
InputStream inputStream = null; InputStream inputStream = null;
try { try {
@ -127,7 +146,8 @@ class ThumbnailViewNode extends FilterNode {
logger.log(Level.WARNING, "No image reader for file: " + content.getName()); logger.log(Level.WARNING, "No image reader for file: " + content.getName());
return null; return null;
} }
BufferedImage biScaled = ScalrWrapper.resizeFast(bi, 100, 100); BufferedImage biScaled = ScalrWrapper.resizeFast(bi, iconSize);
return biScaled; return biScaled;
}catch (OutOfMemoryError e) { }catch (OutOfMemoryError e) {
logger.log(Level.WARNING, "Could not scale image (too large): " + content.getName(), e); logger.log(Level.WARNING, "Could not scale image (too large): " + content.getName(), e);
@ -151,4 +171,10 @@ class ThumbnailViewNode extends FilterNode {
private static File getFile(long id) { private static File getFile(long id) {
return new File(Case.getCurrentCase().getCacheDirectory() + File.separator + id + ".jpg"); return new File(Case.getCurrentCase().getCacheDirectory() + File.separator + id + ".jpg");
} }
public void setIconSize(int iconSize) {
this.iconSize = iconSize;
iconCache = null;
}
} }

View File

@ -40,6 +40,7 @@ import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.LocalFile; import org.sleuthkit.datamodel.LocalFile;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.VirtualDirectory; import org.sleuthkit.datamodel.VirtualDirectory;
/** /**
@ -224,30 +225,34 @@ public class FileSize implements AutopsyVisitableItem {
@Override @Override
protected boolean createKeys(List<AbstractFile> list) { protected boolean createKeys(List<AbstractFile> list) {
list.addAll(runFsQuery()); List<AbstractFile> l = runFsQuery();
if (l == null) {
return false;
}
list.addAll(l);
return true; return true;
} }
private String makeQuery() { private String makeQuery() {
String query = ""; String query;
switch (filter) { switch (filter) {
case SIZE_50_200: case SIZE_50_200:
query = "size >= 50000000 AND size < 200000000"; query = "(size >= 50000000 AND size < 200000000)";
break; break;
case SIZE_200_1000: case SIZE_200_1000:
query = "size >= 200000000 AND size < 1000000000"; query = "(size >= 200000000 AND size < 1000000000)";
break; break;
case SIZE_1000_: case SIZE_1000_:
query = "size >= 1000000000"; query = "(size >= 1000000000)";
break; break;
default: default:
logger.log(Level.SEVERE, "Unsupported filter type to get files by size: " + filter); logger.log(Level.SEVERE, "Unsupported filter type to get files by size: " + filter);
return null;
} }
// ignore unalloc block files
query = query + " AND (type != " + TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS.getFileType() + ")";
return query; return query;
} }
@ -256,6 +261,10 @@ public class FileSize implements AutopsyVisitableItem {
List<AbstractFile> ret = new ArrayList<AbstractFile>(); List<AbstractFile> ret = new ArrayList<AbstractFile>();
String query = makeQuery(); String query = makeQuery();
if (query == null) {
return null;
}
try { try {
ret = skCase.findAllFilesWhere(query); ret = skCase.findAllFilesWhere(query);
} catch (TskCoreException e) { } catch (TskCoreException e) {

View File

@ -80,25 +80,20 @@ public class Tags implements AutopsyVisitableItem {
// When this class is loaded, either create an new app settings file or // When this class is loaded, either create an new app settings file or
// get the tag names setting from the existing app settings file. // get the tag names setting from the existing app settings file.
static { static {
if (!ModuleSettings.configExists(APP_SETTINGS_FILE_NAME)) { String setting = ModuleSettings.getConfigSetting(APP_SETTINGS_FILE_NAME, TAG_NAMES_SETTING_KEY);
ModuleSettings.makeConfigFile(APP_SETTINGS_FILE_NAME); if (null != setting && !setting.isEmpty()) {
} // Make a speedy lookup for the tag names in the setting to aid in the
else { // detection of new tag names.
String setting = ModuleSettings.getConfigSetting(APP_SETTINGS_FILE_NAME, TAG_NAMES_SETTING_KEY); List<String> tagNamesFromAppSettings = Arrays.asList(setting.split(","));
if (!setting.isEmpty()) { for (String tagName : tagNamesFromAppSettings) {
// Make a speedy lookup for the tag names in the setting to aid in the appSettingTagNames.add(tagName);
// detection of new tag names. }
List<String> tagNamesFromAppSettings = Arrays.asList(setting.split(","));
for (String tagName : tagNamesFromAppSettings) { // Load the raw comma separated values list from the setting into a
appSettingTagNames.add(tagName); // string builder to facilitate adding new tag names to the list and writing
} // it back to the app settings file.
tagNamesAppSetting.append(setting);
// Load the raw comma separated values list from the setting into a }
// string builder to facilitate adding new tag names to the list and writing
// it back to the app settings file.
tagNamesAppSetting.append(setting);
}
}
} }
Tags(SleuthkitCase skCase) { Tags(SleuthkitCase skCase) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -86,7 +86,9 @@ public class DataResultFilterNode extends FilterNode {
private final DisplayableItemNodeVisitor<AbstractAction> getPreferredActionsDIV; private final DisplayableItemNodeVisitor<AbstractAction> getPreferredActionsDIV;
/** /**
* the constructor *
* @param node Root node to be passed to DataResult viewers
* @param em ExplorerManager for component that is creating the node
*/ */
public DataResultFilterNode(Node node, ExplorerManager em) { public DataResultFilterNode(Node node, ExplorerManager em) {
super(node, new DataResultFilterChildren(node, em)); super(node, new DataResultFilterChildren(node, em));
@ -316,6 +318,9 @@ public class DataResultFilterNode extends FilterNode {
} }
} }
/*
* Action for double-click / preferred action on nodes.
*/
private class GetPreferredActionsDisplayableItemNodeVisitor extends DisplayableItemNodeVisitor.Default<AbstractAction> { private class GetPreferredActionsDisplayableItemNodeVisitor extends DisplayableItemNodeVisitor.Default<AbstractAction> {
@Override @Override
@ -412,9 +417,11 @@ public class DataResultFilterNode extends FilterNode {
public AbstractAction visit(DirectoryNode dn) { public AbstractAction visit(DirectoryNode dn) {
if (dn.getDisplayName().equals(DirectoryNode.DOTDOTDIR)) { if (dn.getDisplayName().equals(DirectoryNode.DOTDOTDIR)) {
return openParent(dn); return openParent(dn);
} else if (!dn.getDisplayName().equals(DirectoryNode.DOTDIR)) { }
else if (dn.getDisplayName().equals(DirectoryNode.DOTDIR) == false) {
return openChild(dn); return openChild(dn);
} else { }
else {
return null; return null;
} }
} }
@ -428,7 +435,8 @@ public class DataResultFilterNode extends FilterNode {
public AbstractAction visit(FileNode fn) { public AbstractAction visit(FileNode fn) {
if (fn.hasContentChildren()) { if (fn.hasContentChildren()) {
return openChild(fn); return openChild(fn);
} else { }
else {
return null; return null;
} }
} }
@ -437,7 +445,8 @@ public class DataResultFilterNode extends FilterNode {
public AbstractAction visit(LocalFileNode dfn) { public AbstractAction visit(LocalFileNode dfn) {
if (dfn.hasContentChildren()) { if (dfn.hasContentChildren()) {
return openChild(dfn); return openChild(dfn);
} else { }
else {
return null; return null;
} }
} }
@ -472,21 +481,31 @@ public class DataResultFilterNode extends FilterNode {
return null; return null;
} }
/**
* Tell the originating ExplorerManager to display the given node.
* @param node Original (non-filtered) node to open
* @return
*/
private AbstractAction openChild(AbstractNode node) { private AbstractAction openChild(AbstractNode node) {
final Node[] parentNode = sourceEm.getSelectedNodes(); // get the parent node from sourceEm because that will get us the filtered version of it.
final Node parentContext = parentNode[0]; // node.getParentNode() returns the low-level datamodel node.
final Node original = node; final Node[] parentFilterNodes = sourceEm.getSelectedNodes();
final Node parentFilterNode = parentFilterNodes[0];
final Node originalNode = node;
return new AbstractAction() { return new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (parentContext != null) { if (parentFilterNode != null) {
final int childrenNodesCount = parentContext.getChildren().getNodesCount();
// Find the filter version of the passed in node.
final int childrenNodesCount = parentFilterNode.getChildren().getNodesCount();
for (int i = 0; i < childrenNodesCount; i++) { for (int i = 0; i < childrenNodesCount; i++) {
Node selectedNode = parentContext.getChildren().getNodeAt(i); Node childFilterNode = parentFilterNode.getChildren().getNodeAt(i);
if (selectedNode != null && selectedNode.getName().equals(original.getName())) { if (childFilterNode != null && childFilterNode.getName().equals(originalNode.getName())) {
try { try {
sourceEm.setExploredContextAndSelection(selectedNode, new Node[]{selectedNode}); sourceEm.setExploredContextAndSelection(childFilterNode, new Node[]{childFilterNode});
break;
} catch (PropertyVetoException ex) { } catch (PropertyVetoException ex) {
// throw an error here // throw an error here
Logger logger = Logger.getLogger(DataResultFilterNode.class.getName()); Logger logger = Logger.getLogger(DataResultFilterNode.class.getName());
@ -499,10 +518,16 @@ public class DataResultFilterNode extends FilterNode {
}; };
} }
/**
* Tell the originating ExplorerManager to display the parent of the given node.
* @param node Original (non-filtered) node to open
* @return
*/
private AbstractAction openParent(AbstractNode node) { private AbstractAction openParent(AbstractNode node) {
Node[] selectedNode = sourceEm.getSelectedNodes(); // @@@ Why do we ignore node?
Node selectedContext = selectedNode[0]; Node[] selectedFilterNodes = sourceEm.getSelectedNodes();
final Node parentNode = selectedContext.getParentNode(); Node selectedFilterNode = selectedFilterNodes[0];
final Node parentNode = selectedFilterNode.getParentNode();
return new AbstractAction() { return new AbstractAction() {
@Override @Override

View File

@ -609,14 +609,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
//and legacy selection events are pumped //and legacy selection events are pumped
return; return;
} }
//this looks redundant?
// if (getSelectedNode() == null && oldNodes != null) {
// try {
// em.setSelectedNodes(oldNodes);
// } catch (PropertyVetoException ex) {
// logger.log(Level.WARNING, "Error resetting node", ex);
// }
// }
// Some lock that prevents certain Node operations is set during the // Some lock that prevents certain Node operations is set during the
// ExplorerManager selection-change, so we must handle changes after the // ExplorerManager selection-change, so we must handle changes after the
@ -640,26 +633,24 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
return; return;
} }
Node originNode = origin.getNode(); Node originNode = origin.getNode();
DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//set node, wrap in filter node first to filter out children //set node, wrap in filter node first to filter out children
Node drfn = new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em); Node drfn = new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
DirectoryTreeTopComponent.this.dataResult.setNode(new TableFilterNode(drfn, true)); dataResult.setNode(new TableFilterNode(drfn, true));
String displayName = ""; String displayName = "";
if (originNode.getLookup().lookup(Content.class) != null) { Content content = originNode.getLookup().lookup(Content.class);
Content content = originNode.getLookup().lookup(Content.class); if (content != null) {
if (content != null) { try {
try { displayName = content.getUniquePath();
displayName = content.getUniquePath(); } catch (TskCoreException ex) {
} catch (TskCoreException ex) { logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for node: " + originNode);
logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for node: " + originNode); }
} }
} else if (originNode.getLookup().lookup(String.class) != null) {
} else if (originNode.getLookup().lookup(String.class) != null) {
displayName = originNode.getLookup().lookup(String.class); displayName = originNode.getLookup().lookup(String.class);
} }
DirectoryTreeTopComponent.this.dataResult.setPath(displayName); dataResult.setPath(displayName);
} }
// set the directory listing to be active // set the directory listing to be active
@ -674,7 +665,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
} }
} }
} finally { } finally {
DirectoryTreeTopComponent.this.setCursor(null); setCursor(null);
} }
} }
}); });

View File

@ -21,7 +21,9 @@ package org.sleuthkit.autopsy.directorytree;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -34,13 +36,16 @@ import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.util.Cancellable; import org.openide.util.Cancellable;
import org.openide.util.Utilities; import org.openide.util.Utilities;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils.ExtractFscContentVisitor; import org.sleuthkit.autopsy.datamodel.ContentUtils.ExtractFscContentVisitor;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Exports files and folders * Extracts AbstractFiles to a location selected by the user.
*/ */
public final class ExtractAction extends AbstractAction { public final class ExtractAction extends AbstractAction {
private Logger logger = Logger.getLogger(ExtractAction.class.getName()); private Logger logger = Logger.getLogger(ExtractAction.class.getName());
@ -54,143 +59,206 @@ public final class ExtractAction extends AbstractAction {
if (null == instance) { if (null == instance) {
instance = new ExtractAction(); instance = new ExtractAction();
} }
return instance; return instance;
} }
private ExtractAction() { private ExtractAction() {
super("Extract"); super("Extract File(s)");
} }
/** /**
* Asks user to choose destination, then extracts content/directory to * Asks user to choose destination, then extracts content to destination
* destination (recursing on directories) * (recursing on directories).
* @param e the action event * @param e The action event.
*/ */
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class); Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
for (AbstractFile file : selectedFiles) { if (selectedFiles.size() > 1) {
extractFile(e, file); extractFiles(e, selectedFiles);
} }
else if (selectedFiles.size() == 1) {
AbstractFile source = selectedFiles.iterator().next();
if (source.isDir()) {
extractFiles(e, selectedFiles);
}
else {
extractFile(e, selectedFiles.iterator().next());
}
}
} }
private void extractFile(ActionEvent e, AbstractFile file) { private void extractFile(ActionEvent e, AbstractFile source) {
// Get content and check that it's okay to overwrite existing content JFileChooser fileChooser = new JFileChooser();
JFileChooser fc = new JFileChooser(); fileChooser.setCurrentDirectory(new File(Case.getCurrentCase().getExportDirectory()));
fc.setCurrentDirectory(new File(Case.getCurrentCase().getCaseDirectory())); fileChooser.setSelectedFile(new File(source.getName()));
fc.setSelectedFile(new File(file.getName())); if (fileChooser.showSaveDialog((Component)e.getSource()) == JFileChooser.APPROVE_OPTION) {
int returnValue = fc.showSaveDialog((Component) e.getSource()); ArrayList<FileExtractionTask> fileExtractionTasks = new ArrayList<>();
fileExtractionTasks.add(new FileExtractionTask(source, fileChooser.getSelectedFile()));
if (returnValue == JFileChooser.APPROVE_OPTION) { doFileExtraction(e, fileExtractionTasks);
File destination = fc.getSelectedFile();
// do the check
if (destination.exists()) {
int choice = JOptionPane.showConfirmDialog(
(Component) e.getSource(),
"Destination file already exists, it will be overwritten.",
"Destination already exists!",
JOptionPane.OK_CANCEL_OPTION);
if (choice != JOptionPane.OK_OPTION) {
return; // Just exit the function
}
if (!destination.delete()) {
JOptionPane.showMessageDialog(
(Component) e.getSource(),
"Couldn't delete existing file.");
}
}
try {
ExtractFileThread extract = new ExtractFileThread();
extract.init(file, e, destination);
extract.execute();
} catch (Exception ex) {
logger.log(Level.WARNING, "Unable to start background thread.", ex);
}
} }
} }
private class ExtractFileThread extends SwingWorker<Object,Void> {
private Logger logger = Logger.getLogger(ExtractFileThread.class.getName());
private ProgressHandle progress;
private AbstractFile fsContent;
private ActionEvent e;
private File destination;
private void init(AbstractFile fsContent, ActionEvent e, File destination) { private void extractFiles(ActionEvent e, Collection<? extends AbstractFile> selectedFiles) {
this.fsContent = fsContent; JFileChooser folderChooser = new JFileChooser();
this.e = e; folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
this.destination = destination; folderChooser.setCurrentDirectory(new File(Case.getCurrentCase().getExportDirectory()));
if (folderChooser.showSaveDialog((Component)e.getSource()) == JFileChooser.APPROVE_OPTION) {
File destinationFolder = folderChooser.getSelectedFile();
if (!destinationFolder.exists()) {
try {
destinationFolder.mkdirs();
}
catch (Exception ex) {
JOptionPane.showMessageDialog((Component) e.getSource(), "Couldn't create selected folder.");
logger.log(Level.INFO, "Unable to create folder(s) for user " + destinationFolder.getAbsolutePath(), ex);
return;
}
}
ArrayList<FileExtractionTask> fileExtractionTasks = new ArrayList<>();
for (AbstractFile source : selectedFiles) {
fileExtractionTasks.add(new FileExtractionTask(source, new File(destinationFolder, source.getId() + "-" + source.getName())));
}
doFileExtraction(e, fileExtractionTasks);
}
}
private void doFileExtraction(ActionEvent e, ArrayList<FileExtractionTask> fileExtractionTasks) {
// verify all of the sources and destinations are OK
for (Iterator<FileExtractionTask> it = fileExtractionTasks.iterator(); it.hasNext(); ) {
FileExtractionTask task = it.next();
if (ContentUtils.isDotDirectory(task.source)) {
//JOptionPane.showMessageDialog((Component) e.getSource(), "Cannot extract virtual " + task.source.getName() + " directory.", "File is Virtual Directory", JOptionPane.WARNING_MESSAGE);
it.remove();
continue;
}
/*
* @@@ Problems with this code:
* - does not prevent us from having multiple files with the same target name in the task list (in which case, the first ones are overwritten)
* Unique Id was added to set of names before calling this method to deal with that.
*/
if (task.destination.exists()) {
if (JOptionPane.showConfirmDialog((Component) e.getSource(), "Destination file " + task.destination.getAbsolutePath() + " already exists, overwrite?", "File Exists", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
if (!FileUtil.deleteFileDir(task.destination)) {
JOptionPane.showMessageDialog((Component) e.getSource(), "Couldn't overwrite existing file " + task.destination.getAbsolutePath());
it.remove();
}
}
else {
it.remove();
}
}
} }
if (!fileExtractionTasks.isEmpty()) {
try {
FileExtracter extracter = new FileExtracter(fileExtractionTasks);
extracter.execute();
}
catch (Exception ex) {
logger.log(Level.WARNING, "Unable to start background file extraction thread", ex);
}
}
else {
MessageNotifyUtil.Message.info("No file(s) to extract.");
}
}
private class FileExtractionTask {
AbstractFile source;
File destination;
FileExtractionTask(AbstractFile source, File destination) {
this.source = source;
this.destination = destination;
}
}
private class FileExtracter extends SwingWorker<Object,Void> {
private Logger logger = Logger.getLogger(FileExtracter.class.getName());
private ProgressHandle progress;
private ArrayList<FileExtractionTask> extractionTasks;
FileExtracter(ArrayList<FileExtractionTask> extractionTasks) {
this.extractionTasks = extractionTasks;
}
@Override @Override
protected Object doInBackground() throws Exception { protected Object doInBackground() throws Exception {
logger.log(Level.INFO, "Starting background processing for file extraction."); if (extractionTasks.isEmpty()) {
return null;
}
// Setup progress bar // Setup progress bar.
final String displayName = "Extracting"; final String displayName = "Extracting";
progress = ProgressHandleFactory.createHandle(displayName, new Cancellable() { progress = ProgressHandleFactory.createHandle(displayName, new Cancellable() {
@Override @Override
public boolean cancel() { public boolean cancel() {
if (progress != null) if (progress != null)
progress.setDisplayName(displayName + " (Cancelling...)"); progress.setDisplayName(displayName + " (Cancelling...)");
return ExtractAction.ExtractFileThread.this.cancel(true); return ExtractAction.FileExtracter.this.cancel(true);
} }
}); });
// Start the progress bar as indeterminate
progress.start(); progress.start();
progress.switchToIndeterminate(); progress.switchToIndeterminate();
if(fsContent.isFile()) {
// Max content size of 200GB /* @@@ Add back in -> Causes exceptions
//long filesize = fsContent.getSize(); int workUnits = 0;
//int unit = (int) (filesize / 100); for (FileExtractionTask task : extractionTasks) {
progress.switchToDeterminate(100); workUnits += calculateProgressBarWorkUnits(task.source);
} else if(fsContent.isDir()) {
// If dir base progress off number of children
int toProcess = fsContent.getChildren().size();
progress.switchToDeterminate(toProcess);
} }
progress.switchToDeterminate(workUnits);
// Start extracting the content/directory */
ExtractFscContentVisitor.extract(fsContent, destination, progress, this);
logger.log(Level.INFO, "Done background processing"); // Do the extraction tasks.
for (FileExtractionTask task : this.extractionTasks) {
// @@@ Note, we are no longer passing in progress
ExtractFscContentVisitor.extract(task.source, task.destination, null, this);
}
return null; return null;
} }
@Override @Override
protected void done() { protected void done() {
try { try {
super.get(); //block and get all exceptions thrown while doInBackground() super.get();
} catch (CancellationException ex) { }
logger.log(Level.INFO, "Extraction was canceled."); catch (CancellationException | InterruptedException ex) {
} catch (InterruptedException ex) { }
logger.log(Level.INFO, "Extraction was interrupted."); catch (Exception ex) {
} catch (Exception ex) { logger.log(Level.SEVERE, "Fatal error during file extraction", ex);
logger.log(Level.SEVERE, "Fatal error during file extraction.", ex); }
} finally { finally {
progress.finish(); progress.finish();
if (!this.isCancelled()) { if (!this.isCancelled()) {
logger.log(Level.INFO, "Extracting completed without cancellation."); MessageNotifyUtil.Message.info("File(s) extracted.");
// Alert the user extraction is over }
if(fsContent.isDir()) { }
MessageNotifyUtil.Message.info("Directory extracted."); }
} else if(fsContent.isFile()){
MessageNotifyUtil.Message.info("File extracted."); private int calculateProgressBarWorkUnits(AbstractFile file) {
} int workUnits = 0;
} else { if (file.isFile()) {
logger.log(Level.INFO, "Attempting to delete file(s)."); workUnits += file.getSize();
if(FileUtil.deleteFileDir(destination)) { }
logger.log(Level.INFO, "Finished deletion sucessfully."); else {
} else { try {
logger.log(Level.WARNING, "Deletion attempt complete; not all files were sucessfully deleted."); for (Content child : file.getChildren()) {
if (child instanceof AbstractFile) {
workUnits += calculateProgressBarWorkUnits((AbstractFile)child);
}
} }
} }
catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not get children of content", ex);
}
} }
return workUnits;
} }
} }
} }

View File

@ -333,7 +333,7 @@ public final class IngestModuleLoader {
try { try {
urls.add(new URL(urlPath)); urls.add(new URL(urlPath));
logger.log(Level.INFO, "JAR: " + urlPath); //logger.log(Level.INFO, "JAR: " + urlPath);
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
logger.log(Level.WARNING, "Invalid URL: " + urlPath, ex); logger.log(Level.WARNING, "Invalid URL: " + urlPath, ex);
} }
@ -476,13 +476,14 @@ public final class IngestModuleLoader {
for (final ModuleInfo moduleInfo : moduleInfos) { for (final ModuleInfo moduleInfo : moduleInfos) {
if (moduleInfo.isEnabled()) { if (moduleInfo.isEnabled()) {
String basePackageName = moduleInfo.getCodeNameBase(); String basePackageName = moduleInfo.getCodeNameBase();
// skip the standard ones
if (basePackageName.startsWith("org.netbeans") if (basePackageName.startsWith("org.netbeans")
|| basePackageName.startsWith("org.openide")) { || basePackageName.startsWith("org.openide")) {
//skip
continue; continue;
} }
logger.log(Level.INFO, "Module enabled: " + moduleInfo.getDisplayName() + " " + basePackageName logger.log(Level.INFO, "Found module: " + moduleInfo.getDisplayName() + " " + basePackageName
+ " Build version: " + moduleInfo.getBuildVersion() + " Build version: " + moduleInfo.getBuildVersion()
+ " Spec version: " + moduleInfo.getSpecificationVersion() + " Spec version: " + moduleInfo.getSpecificationVersion()
+ " Impl version: " + moduleInfo.getImplementationVersion()); + " Impl version: " + moduleInfo.getImplementationVersion());
@ -493,6 +494,12 @@ public final class IngestModuleLoader {
cb.setScanners(new SubTypesScanner(), new ResourcesScanner()); cb.setScanners(new SubTypesScanner(), new ResourcesScanner());
reflectionsSet.add(new Reflections(cb)); reflectionsSet.add(new Reflections(cb));
} }
else {
// log if we have our own modules disabled
if (moduleInfo.getCodeNameBase().startsWith("org.sleuthkit")) {
logger.log(Level.WARNING, "Sleuth Kit Module not enabled: " + moduleInfo.getDisplayName());
}
}
} }
/* This area is used to load the example modules. They are not found via lookup since they /* This area is used to load the example modules. They are not found via lookup since they
@ -520,6 +527,11 @@ public final class IngestModuleLoader {
while (it.hasNext()) { while (it.hasNext()) {
logger.log(Level.INFO, "Found DataSource ingest module in: " + reflections.getClass().getSimpleName() + ": " + it.next().toString()); logger.log(Level.INFO, "Found DataSource ingest module in: " + reflections.getClass().getSimpleName() + ": " + it.next().toString());
} }
if ((fileModules.isEmpty()) && (dataSourceModules.isEmpty())) {
logger.log(Level.INFO, "Module has no ingest modules: " + reflections.getClass().getSimpleName());
continue;
}
//find out which modules to add //find out which modules to add
//TODO check which modules to remove (which modules were uninstalled) //TODO check which modules to remove (which modules were uninstalled)

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -84,12 +84,13 @@ public class ReportGenerator {
static final String REPORTS_DIR = "Reports"; static final String REPORTS_DIR = "Reports";
ReportGenerator(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates) { ReportGenerator(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates) {
// Setup the reporting directory to be [CASE DIRECTORY]/Reports/[Case name] [Timestamp]/ // Create the root reports directory path of the form: <CASE DIRECTORY>/Reports/<Case name> <Timestamp>/
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
Date date = new Date(); Date date = new Date();
String datenotime = dateFormat.format(date); String dateNoTime = dateFormat.format(date);
this.reportPath = currentCase.getCaseDirectory() + File.separator + REPORTS_DIR + File.separator + currentCase.getName() + " " + datenotime + File.separator; this.reportPath = currentCase.getCaseDirectory() + File.separator + REPORTS_DIR + File.separator + currentCase.getName() + " " + dateNoTime + File.separator;
// Create the reporting directory
// Create the root reports directory.
try { try {
FileUtil.createFolder(new File(this.reportPath)); FileUtil.createFolder(new File(this.reportPath));
} catch (IOException ex) { } catch (IOException ex) {
@ -109,16 +110,21 @@ public class ReportGenerator {
* @param generalModuleStates the enabled/disabled state of each GeneralReportModule * @param generalModuleStates the enabled/disabled state of each GeneralReportModule
*/ */
private void setupProgressPanels(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates) { private void setupProgressPanels(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates) {
for (Entry<TableReportModule, Boolean> entry : tableModuleStates.entrySet()) { if (null != tableModuleStates) {
if (entry.getValue()) { for (Entry<TableReportModule, Boolean> entry : tableModuleStates.entrySet()) {
TableReportModule module = entry.getKey(); if (entry.getValue()) {
tableProgress.put(module, panel.addReport(module.getName(), reportPath + module.getFilePath())); TableReportModule module = entry.getKey();
tableProgress.put(module, panel.addReport(module.getName(), reportPath + module.getFilePath()));
}
} }
} }
for (Entry<GeneralReportModule, Boolean> entry : generalModuleStates.entrySet()) {
if (entry.getValue()) { if (null != generalModuleStates) {
GeneralReportModule module = entry.getKey(); for (Entry<GeneralReportModule, Boolean> entry : generalModuleStates.entrySet()) {
generalProgress.put(module, panel.addReport(module.getName(), reportPath + module.getFilePath())); if (entry.getValue()) {
GeneralReportModule module = entry.getKey();
generalProgress.put(module, panel.addReport(module.getName(), reportPath + module.getFilePath()));
}
} }
} }
} }
@ -171,8 +177,10 @@ public class ReportGenerator {
* @param tagSelections the enabled/disabled state of the tags to be included in the report * @param tagSelections the enabled/disabled state of the tags to be included in the report
*/ */
public void generateArtifactTableReports(Map<ARTIFACT_TYPE, Boolean> artifactTypeSelections, Map<String, Boolean> tagSelections) { public void generateArtifactTableReports(Map<ARTIFACT_TYPE, Boolean> artifactTypeSelections, Map<String, Boolean> tagSelections) {
ArtifactsReportsWorker worker = new ArtifactsReportsWorker(artifactTypeSelections, tagSelections); if (!tableProgress.isEmpty() && null != artifactTypeSelections) {
worker.execute(); ArtifactsReportsWorker worker = new ArtifactsReportsWorker(artifactTypeSelections, tagSelections);
worker.execute();
}
} }
/** /**
@ -216,7 +224,7 @@ public class ReportGenerator {
} }
// Get the tags selected by the user. // Get the tags selected by the user.
if (tagSelections != null) { if (null != tagSelections) {
for (Entry<String, Boolean> entry : tagSelections.entrySet()) { for (Entry<String, Boolean> entry : tagSelections.entrySet()) {
if (entry.getValue() == true) { if (entry.getValue() == true) {
tagNamesFilter.add(entry.getKey()); tagNamesFilter.add(entry.getKey());

View File

@ -64,38 +64,13 @@ public final class ReportWizardAction extends CallableSystemAction implements P
* and start all necessary reports. * and start all necessary reports.
*/ */
public static void doReportWizard() { public static void doReportWizard() {
// Create the wizard
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator()); WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
wiz.setTitleFormat(new MessageFormat("{0} {1}")); wiz.setTitleFormat(new MessageFormat("{0} {1}"));
wiz.setTitle("Generate Report"); wiz.setTitle("Generate Report");
// When the user presses the finish button
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
// Get the wizard information ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"), (Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"));
Object wizProp1 = wiz.getProperty("tableModuleStates"); generator.generateArtifactTableReports((Map<ARTIFACT_TYPE, Boolean>)wiz.getProperty("artifactStates"), (Map<String, Boolean>)wiz.getProperty("tagStates"));
Object wizProp2 = wiz.getProperty("generalModuleStates");
Object wizProp3 = wiz.getProperty("isTagsSelected");
Object wizProp4 = wiz.getProperty("tagStates");
Object wizProp5 = wiz.getProperty("artifactStates");
// Initialize variables
Map<TableReportModule, Boolean> tableModuleStates = (Map<TableReportModule, Boolean>) wizProp1;
Map<GeneralReportModule, Boolean> generalModuleStates = (Map<GeneralReportModule, Boolean>) wizProp2;
Boolean isTagsSelected = (Boolean) wizProp3;
Map<String, Boolean> tagSelections = (Map<String, Boolean>) wizProp4;
Map<ARTIFACT_TYPE, Boolean> artifactTypeSelections = (Map<ARTIFACT_TYPE, Boolean>) wizProp5;
// Create the generator and generate reports
ReportGenerator generator = new ReportGenerator(tableModuleStates, generalModuleStates);
if (isTagsSelected) {
generator.generateArtifactTableReports(artifactTypeSelections, tagSelections);
}
else {
generator.generateArtifactTableReports(artifactTypeSelections, null);
}
generator.generateGeneralReports(); generator.generateGeneralReports();
// Open the progress window for the user
generator.displayProgressPanels(); generator.displayProgressPanels();
} }
} }

View File

@ -214,7 +214,10 @@ public final class ExifParserFileIngestModule extends IngestModuleAbstractFile {
if (bytesRead != 2) { if (bytesRead != 2) {
return false; return false;
} }
if ((fileHeaderBuffer[0] == 0xff) && (fileHeaderBuffer[1] == 0xd8)) { /* Check for the JPEG header.
* Since Java bytes are signed, we cast them to an int first.
*/
if (((int)(fileHeaderBuffer[0] & 0xff) == 0xff) && ((int)(fileHeaderBuffer[1] & 0xff) == 0xd8)) {
return true; return true;
} }
return false; return false;

View File

@ -40,7 +40,7 @@ public class KeywordSearchSettings {
static final String PROPERTIES_SCRIPTS = MODULE_NAME+"_Scripts"; static final String PROPERTIES_SCRIPTS = MODULE_NAME+"_Scripts";
private static boolean skipKnown = true; private static boolean skipKnown = true;
private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName());
private static UpdateFrequency UpdateFreq = UpdateFrequency.AVG; private static UpdateFrequency UpdateFreq = UpdateFrequency.DEFAULT;
private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts = new ArrayList<StringExtract.StringExtractUnicodeTable.SCRIPT>(); private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts = new ArrayList<StringExtract.StringExtractUnicodeTable.SCRIPT>();
private static Map<String,String> stringExtractOptions = new HashMap<String,String>(); private static Map<String,String> stringExtractOptions = new HashMap<String,String>();
@ -190,7 +190,7 @@ public class KeywordSearchSettings {
//setting default Update Frequency //setting default Update Frequency
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")){ if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")){
logger.log(Level.INFO, "No configuration for Update Frequency found, generating default..."); logger.log(Level.INFO, "No configuration for Update Frequency found, generating default...");
KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.AVG); KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT);
} }
//setting default Extract UTF8 //setting default Extract UTF8
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())){ if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())){

View File

@ -1,5 +1,5 @@
#Updated by build script #Updated by build script
#Wed, 07 Aug 2013 08:19:27 -0400 #Fri, 23 Aug 2013 15:47:56 -0400
LBL_splash_window_title=Starting Autopsy LBL_splash_window_title=Starting Autopsy
SPLASH_HEIGHT=288 SPLASH_HEIGHT=288
SPLASH_WIDTH=538 SPLASH_WIDTH=538
@ -8,4 +8,4 @@ SplashRunningTextBounds=5,266,530,17
SplashRunningTextColor=0x0 SplashRunningTextColor=0x0
SplashRunningTextFontSize=18 SplashRunningTextFontSize=18
currentVersion=Autopsy 20130807 currentVersion=Autopsy 20130823

View File

@ -1,5 +1,5 @@
#Updated by build script #Updated by build script
#Wed, 07 Aug 2013 08:19:27 -0400 #Fri, 23 Aug 2013 15:47:56 -0400
CTL_MainWindow_Title=Autopsy 20130807 CTL_MainWindow_Title=Autopsy 20130823
CTL_MainWindow_Title_No_Project=Autopsy 20130807 CTL_MainWindow_Title_No_Project=Autopsy 20130823