diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 4f6e1f0eec..a25f7c819e 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -105,6 +105,14 @@ class DirectoryTreeFilterNode extends FilterNode { Directory dir = this.getLookup().lookup(Directory.class); if (dir != null) { actions.add(ExtractAction.getInstance()); + actions.add(new AbstractAction( + NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { + @Override + public void actionPerformed(ActionEvent e) { + final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(dir); + ingestDialog.display(); + } + }); } final Image img = this.getLookup().lookup(Image.class); diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index da49e1546f..4359121310 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -619,8 +619,6 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { - // make sure dataResult is open, redundant? - //dataResult.open(); Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode(); if (treeNode != null) { DirectoryTreeFilterNode.OriginalNode origin = treeNode.getLookup().lookup(DirectoryTreeFilterNode.OriginalNode.class); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index d31c0da8c7..75af39f49a 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -53,12 +53,24 @@ public class IngestJobSettings { private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger logger = Logger.getLogger(IngestJobSettings.class.getName()); private final String context; + private final IngestType ingestType; private String moduleSettingsFolderPath; private static final CharSequence pythonModuleSettingsPrefixCS = "org.python.proxies.".subSequence(0, "org.python.proxies.".length() - 1); private final List moduleTemplates; private boolean processUnallocatedSpace; private final List warnings; + // Determines which modeules to run + public enum IngestType { + + // Run all modules + ALL_MODULES, + // Run only data source modules + DATA_SOURCE_ONLY, + // Run only files modules + FILES_ONLY + } + /** * Constructs an ingest job settings object for a given context. * @@ -66,6 +78,29 @@ public class IngestJobSettings { */ public IngestJobSettings(String context) { this.context = context; + this.ingestType = IngestType.ALL_MODULES; + this.moduleTemplates = new ArrayList<>(); + this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); + this.warnings = new ArrayList<>(); + this.createSavedModuleSettingsFolder(); + this.load(); + } + + /** + * Constructs an ingest job settings object for a given context. + * + * @param context The context identifier string. + * @param ingestType The type of modules ingest is running. + */ + public IngestJobSettings(String context, IngestType ingestType) { + this.ingestType = ingestType; + + if (this.ingestType.equals(IngestType.ALL_MODULES)) { + this.context = context; + } else { + this.context = context + "." + this.ingestType.name(); + } + this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); this.warnings = new ArrayList<>(); @@ -145,10 +180,10 @@ public class IngestJobSettings { void setProcessUnallocatedSpace(boolean processUnallocatedSpace) { this.processUnallocatedSpace = processUnallocatedSpace; } - + /** * Returns the path to the ingest module settings folder. - * + * * @return path to the module settings folder */ public Path getSavedModuleSettingsFolder(){ @@ -178,8 +213,21 @@ public class IngestJobSettings { * Get the ingest module factories discovered by the ingest module * loader. */ - List moduleFactories = IngestModuleFactoryLoader.getIngestModuleFactories(); + List moduleFactories = new ArrayList<>(); + List allModuleFactories = IngestModuleFactoryLoader.getIngestModuleFactories(); HashSet loadedModuleNames = new HashSet<>(); + + // Add modules that are going to be used for this ingest depending on type. + for (IngestModuleFactory moduleFactory : allModuleFactories) { + if (this.ingestType.equals(IngestType.ALL_MODULES)) { + moduleFactories.add(moduleFactory); + } else if (this.ingestType.equals(IngestType.DATA_SOURCE_ONLY) && moduleFactory.isDataSourceIngestModuleFactory()) { + moduleFactories.add(moduleFactory); + } else if (this.ingestType.equals(IngestType.FILES_ONLY) && moduleFactory.isFileIngestModuleFactory()) { + moduleFactories.add(moduleFactory); + } + } + for (IngestModuleFactory moduleFactory : moduleFactories) { loadedModuleNames.add(moduleFactory.getModuleDisplayName()); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java index da491fd22a..27b7f3ecf5 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java @@ -34,7 +34,9 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.Directory; /** * Dialog box that allows a user to configure and run an ingest job on one or @@ -43,6 +45,7 @@ import org.sleuthkit.datamodel.Content; public final class RunIngestModulesDialog extends JDialog { private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); + private final IngestType ingestType; private static Dimension DIMENSIONS = new Dimension(500, 300); private final List dataSources = new ArrayList<>(); private IngestJobSettingsPanel ingestJobSettingsPanel; @@ -59,6 +62,7 @@ public final class RunIngestModulesDialog extends JDialog { public RunIngestModulesDialog(JFrame frame, String title, boolean modal, List dataSources) { super(frame, title, modal); this.dataSources.addAll(dataSources); + this.ingestType = IngestType.ALL_MODULES; } /** @@ -70,6 +74,11 @@ public final class RunIngestModulesDialog extends JDialog { public RunIngestModulesDialog(List dataSources) { this(new JFrame(TITLE), TITLE, true, dataSources); } + + public RunIngestModulesDialog(Directory dir) { + this.dataSources.add(dir); + this.ingestType = IngestType.FILES_ONLY; + } /** * Construct a dialog box that allows a user to configure and run an ingest @@ -84,6 +93,7 @@ public final class RunIngestModulesDialog extends JDialog { @Deprecated public RunIngestModulesDialog(JFrame frame, String title, boolean modal) { super(frame, title, modal); + this.ingestType = IngestType.ALL_MODULES; } /** @@ -129,7 +139,7 @@ public final class RunIngestModulesDialog extends JDialog { * Get the default or saved ingest job settings for this context and use * them to create and add an ingest job settings panel. */ - IngestJobSettings ingestJobSettings = new IngestJobSettings(RunIngestModulesDialog.class.getCanonicalName()); + IngestJobSettings ingestJobSettings = new IngestJobSettings(RunIngestModulesDialog.class.getCanonicalName(), this.ingestType); RunIngestModulesDialog.showWarnings(ingestJobSettings); this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); add(this.ingestJobSettingsPanel, BorderLayout.PAGE_START);