This commit is contained in:
Jeff Wallace 2013-09-17 08:51:38 -04:00
commit acad653fba
12 changed files with 236 additions and 166 deletions

16
Core/autopsy-updates.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.5//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_7.dtd">
<module_updates timestamp="03/01/21/12/03/2008">
<!--notification element goes here for user pop-up. Attribute url is the URL to display along with the message contained between notification xml elements.
-->
<notification url="http://sleuthkit.org/autopsy">
Visit http://sleuthkit.org/autopsy to download the latest version of Autopsy.
</notification>
</module_updates>

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import org.sleuthkit.autopsy.ingest.IngestConfigurator;
import java.awt.Component; import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import org.sleuthkit.autopsy.ingest.IngestConfigurator;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.EventQueue; import java.awt.EventQueue;
@ -28,6 +29,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -39,6 +41,7 @@ import org.sleuthkit.autopsy.casemodule.ContentTypePanel.ContentType;
import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.ingest.IngestDialog;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.Image;
@ -86,7 +89,14 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
this.action = action; this.action = action;
this.wizPanel = wizPanel; this.wizPanel = wizPanel;
ingestConfig = Lookup.getDefault().lookup(IngestConfigurator.class); ingestConfig = Lookup.getDefault().lookup(IngestConfigurator.class);
ingestConfig.setContext(AddImageWizardPanel3.class.getCanonicalName()); List<String> messages = ingestConfig.setContext(AddImageWizardPanel3.class.getCanonicalName());
if (messages.isEmpty() == false) {
StringBuilder warning = new StringBuilder();
for (String message : messages) {
warning.append(message).append("\n");
}
JOptionPane.showMessageDialog(null, warning.toString());
}
} }
/** /**

View File

@ -1,69 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.casemodule;
import java.util.List;
import javax.swing.JPanel;
import org.sleuthkit.datamodel.Content;
/**
* Lookup interface for ingest configuration dialog
*/
public interface IngestConfigurator {
/**
* get JPanel container with the configurator
* @return
*/
JPanel getIngestConfigPanel();
/**
* set input Content to be configured for ingest
* @param inputContent content to be configured for ingest
*/
void setContent(List<Content> inputContent);
/**
* start ingest enqueing previously set image
*/
void start();
/**
* save configuration of lastly selected service
*/
void save();
/**
* reload the simple panel
*/
void reload();
/**
* find out if ingest is currently running
*
* @return true if ingest process is running, false otherwise
*/
boolean isIngestRunning();
/**
* Set the context for the configuration.
* @param context
*/
public void setContext(String context);
}

View File

@ -8,3 +8,5 @@ OpenIDE-Module-Long-Description=\
For more information, see http://www.sleuthkit.org/autopsy/ For more information, see http://www.sleuthkit.org/autopsy/
OpenIDE-Module-Name=Autopsy-Core OpenIDE-Module-Name=Autopsy-Core
OpenIDE-Module-Short-Description=Autopsy Core Module OpenIDE-Module-Short-Description=Autopsy Core Module
org_sleuthkit_autopsy_core_update_center=http://sleuthkit.org/autopsy/updates.xml
Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings=Autopsy Update Center

View File

@ -270,6 +270,13 @@
Services Services
====================================================== --> ====================================================== -->
<folder name="Services"> <folder name="Services">
<folder name="AutoupdateType">
<file name="org_sleuthkit_autopsy_core_update_center.settings" url="org_sleuthkit_autopsy_core_update_centerSettings.xml">
<attr name="displayName" bundlevalue="org.sleuthkit.autopsy.core.Bundle#Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings"/>
<attr name="enabled" boolvalue="true"/>
<attr name="url" bundlevalue="org.sleuthkit.autopsy.core.Bundle#org_sleuthkit_autopsy_core_update_center"/>
</file>
</folder>
<file name="org-sleuthkit-autopsy-corecomponents-DataContentTopComponent.instance"> <file name="org-sleuthkit-autopsy-corecomponents-DataContentTopComponent.instance">
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.corecomponentinterfaces.DataContent"/> <attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.corecomponentinterfaces.DataContent"/>
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.corecomponents.DataContentTopComponent.getDefault"/> <attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.corecomponents.DataContentTopComponent.getDefault"/>

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<module name="org.sleuthkit.autopsy.core/8"/>
<instanceof class="org.openide.ServiceType"/>
<instanceof class="org.netbeans.modules.autoupdate.AutoupdateType"/>
<instanceof class="org.netbeans.modules.autoupdate.XMLAutoupdateType"/>
<instance class="org.netbeans.modules.autoupdate.XMLAutoupdateType" method="createXMLAutoupdateType"/>
</settings>

View File

@ -16,8 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.ingest;
package org.sleuthkit.autopsy.casemodule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,85 +24,101 @@ import javax.swing.JPanel;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestDialogPanel; import org.sleuthkit.autopsy.ingest.IngestDialogPanel;
import static org.sleuthkit.autopsy.ingest.IngestDialogPanel.DISABLED_MOD;
import static org.sleuthkit.autopsy.ingest.IngestDialogPanel.PARSE_UNALLOC;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract; import org.sleuthkit.autopsy.ingest.IngestModuleAbstract;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ServiceProvider(service = IngestConfigurator.class) @ServiceProvider(service = IngestConfigurator.class)
public class GeneralIngestConfigurator implements IngestConfigurator { public class GeneralIngestConfigurator implements IngestConfigurator {
public static final String ENABLED_INGEST_MODULES_KEY = "Enabled_Ingest_Modules";
public static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space";
private List<Content> contentToIngest; private List<Content> contentToIngest;
private IngestManager manager; private IngestManager manager;
private IngestDialogPanel ingestDialogPanel; private IngestDialogPanel ingestDialogPanel;
private String moduleContext; private String moduleContext;
public GeneralIngestConfigurator() { public GeneralIngestConfigurator() {
this.moduleContext = IngestManager.MODULE_PROPERTIES; // Hard-code this for now. this.moduleContext = IngestManager.MODULE_PROPERTIES;
ingestDialogPanel = new IngestDialogPanel(); ingestDialogPanel = new IngestDialogPanel();
ingestDialogPanel.setContext(moduleContext); ingestDialogPanel.setContext(moduleContext);
manager = IngestManager.getDefault(); manager = IngestManager.getDefault();
loadSettings();
} }
@Override @Override
public void setContext(String context) { public List<String> setContext(String context) {
moduleContext = context; moduleContext = context;
ingestDialogPanel.setContext(moduleContext); ingestDialogPanel.setContext(moduleContext);
reload(); return loadSettingsForContext();
}
private List<String> loadSettingsForContext() {
List<String> messages = new ArrayList<>();
// If there is no enabled ingest modules setting for this user, default to enabling all
// of the ingest modules the IngestManager has loaded.
if (ModuleSettings.settingExists(moduleContext, ENABLED_INGEST_MODULES_KEY) == false) {
String defaultSetting = moduleListToCsv(IngestManager.getDefault().enumerateAllModules());
ModuleSettings.setConfigSetting(moduleContext, ENABLED_INGEST_MODULES_KEY, defaultSetting);
}
// Get the enabled ingest modules setting, check for missing modules, and pass the setting to
// the UI component.
List<IngestModuleAbstract> allModules = IngestManager.getDefault().enumerateAllModules();
String[] enabledModuleNames = ModuleSettings.getConfigSetting(moduleContext, ENABLED_INGEST_MODULES_KEY).split(", ");
List<IngestModuleAbstract> enabledModules = new ArrayList<>();
for (String moduleName : enabledModuleNames) {
IngestModuleAbstract moduleFound = null;
for (IngestModuleAbstract module : allModules) {
if (moduleName.equals(module.getName())) {
moduleFound = module;
break;
}
}
if (moduleFound != null) {
enabledModules.add(moduleFound);
}
else {
messages.add("Unable to load " + moduleName + " module");
}
}
ingestDialogPanel.setEnabledIngestModules(enabledModules);
// If there is no process unallocated space flag setting, default it to false.
if (ModuleSettings.settingExists(moduleContext, PARSE_UNALLOC_SPACE_KEY) == false) {
ModuleSettings.setConfigSetting(moduleContext, PARSE_UNALLOC_SPACE_KEY, "false");
}
// Get the process unallocated space flag setting and pass it to the UI component.
boolean processUnalloc = Boolean.parseBoolean(ModuleSettings.getConfigSetting(moduleContext, PARSE_UNALLOC_SPACE_KEY));
ingestDialogPanel.setProcessUnallocSpaceEnabled(processUnalloc);
return messages;
} }
@Override @Override
public JPanel getIngestConfigPanel() { public JPanel getIngestConfigPanel() {
// Note that this panel allows for selecting modules for the ingest process,
// specifying the process unallocated space flag, and also specifying settings
// for a selected ingest module.
return ingestDialogPanel; return ingestDialogPanel;
} }
@Override
public void setContent(List<Content> inputContent) {
this.contentToIngest = inputContent;
}
@Override
public void start() {
// Get the list of ingest modules selected by the user.
List<IngestModuleAbstract> modulesToStart = ingestDialogPanel.getModulesToStart();
// Get the user's selection of whether or not to process unallocated space.
manager.setProcessUnallocSpace(ingestDialogPanel.processUnallocSpaceEnabled());
// Start the ingest.
if (!modulesToStart.isEmpty()) {
manager.execute(modulesToStart, contentToIngest);
}
}
@Override @Override
public void save() { public void save() {
// Save the user's configuration of the currently selected module. // Save the user's configuration of the set of enabled ingest modules.
String enabledModulesCsvList = moduleListToCsv(ingestDialogPanel.getModulesToStart());
ModuleSettings.setConfigSetting(moduleContext, ENABLED_INGEST_MODULES_KEY, enabledModulesCsvList);
// Save the user's setting for the process unallocated space flag.
String processUnalloc = Boolean.toString(ingestDialogPanel.processUnallocSpaceEnabled());
ModuleSettings.setConfigSetting(moduleContext, PARSE_UNALLOC_SPACE_KEY, processUnalloc);
// Save the user's configuration of the currently selected ingest module.
IngestModuleAbstract currentModule = ingestDialogPanel.getCurrentIngestModule(); IngestModuleAbstract currentModule = ingestDialogPanel.getCurrentIngestModule();
if (currentModule != null && currentModule.hasSimpleConfiguration()) { if (currentModule != null && currentModule.hasSimpleConfiguration()) {
currentModule.saveSimpleConfiguration(); currentModule.saveSimpleConfiguration();
} }
// Create a list of the modules the user wants to be disabled.
List<IngestModuleAbstract> disabledModules = IngestManager.getDefault().enumerateAllModules();
disabledModules.removeAll(ingestDialogPanel.getModulesToStart());
String disabledModulesCsv = moduleListToCsv(disabledModules);
// Save the user's general ingest configuration.
ModuleSettings.setConfigSetting(moduleContext, DISABLED_MOD, disabledModulesCsv);
String processUnalloc = Boolean.toString(ingestDialogPanel.processUnallocSpaceEnabled());
ModuleSettings.setConfigSetting(moduleContext, PARSE_UNALLOC, processUnalloc);
}
@Override
public void reload() {
loadSettings();
}
@Override
public boolean isIngestRunning() {
return manager.isIngestRunning();
} }
private static String moduleListToCsv(List<IngestModuleAbstract> lst) { private static String moduleListToCsv(List<IngestModuleAbstract> lst) {
@ -122,38 +137,27 @@ public class GeneralIngestConfigurator implements IngestConfigurator {
return sb.toString(); return sb.toString();
} }
private static List<IngestModuleAbstract> csvToModuleList(String csv) { @Override
List<IngestModuleAbstract> modules = new ArrayList<>(); public void setContent(List<Content> inputContent) {
this.contentToIngest = inputContent;
if (csv == null || csv.isEmpty()) {
return modules;
} }
String[] moduleNames = csv.split(", "); @Override
List<IngestModuleAbstract> allModules = IngestManager.getDefault().enumerateAllModules(); public void start() {
for (String moduleName : moduleNames) { // Get the list of ingest modules selected by the user.
for (IngestModuleAbstract module : allModules) { List<IngestModuleAbstract> modulesToStart = ingestDialogPanel.getModulesToStart();
if (moduleName.equals(module.getName())) {
modules.add(module); // Get the user's selection of whether or not to process unallocated space.
break; manager.setProcessUnallocSpace(ingestDialogPanel.processUnallocSpaceEnabled());
}
if (!modulesToStart.isEmpty() && contentToIngest != null) {
// Queue the ingest process.
manager.execute(modulesToStart, contentToIngest);
} }
} }
return modules; @Override
} public boolean isIngestRunning() {
return manager.isIngestRunning();
private void loadSettings() {
// get the csv list of disabled modules
String disabledModulesCsv = ModuleSettings.getConfigSetting(moduleContext, DISABLED_MOD);
// create a list of modules from it
List<IngestModuleAbstract> disabledModules = csvToModuleList(disabledModulesCsv);
// tell the ingestDialogPanel to unselect these modules
ingestDialogPanel.setDisabledModules(disabledModules);
boolean processUnalloc = Boolean.parseBoolean(ModuleSettings.getConfigSetting(moduleContext, PARSE_UNALLOC));
ingestDialogPanel.setProcessUnallocSpaceEnabled(processUnalloc);
} }
} }

View File

@ -0,0 +1,84 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.ingest;
import java.util.List;
import javax.swing.JPanel;
import org.sleuthkit.datamodel.Content;
/**
* Instances of this class provide the following services:
* 1. A way to save and load the ingest process configuration settings for a
* given ingest process context.
* 2. A UI component for configuring ingest process settings.
* 3. A way to specify input content and start the ingest process for a
* given ingest process context.
*/
// @@@ This interface needs to be re-designed. An interface for allowing the
// authors of ingest modules to expose context sensitive module configuration
// settings needs to be provided; there also needs to be a way for users to
// configure the ingest process that uses those modules. These are separate
// concerns; likewise, kicking off an ingest process for particular content in
// a particular context is a separate concern.
public interface IngestConfigurator {
/**
* Specifies the ingest process context for the purpose of choosing, saving,
* and loading ingest process configuration settings; also determines what
* configuration settings will be in effect if the setContent() and start()
* methods are called to start the ingest process for some content specified
* using the setContent() method.
* @return A list, possibly empty, of messages describing errors that
* occurred when loading the configuration settings.
*/
public List<String> setContext(String contextName);
/**
* Provides a UI component for choosing ingest process configuration
* settings for the ingest process context specified using the setContext()
* method.
*/
JPanel getIngestConfigPanel();
/**
* Saves the ingest process configuration settings for the ingest process
* context specified using the setContext() method.
*/
void save();
/**
* Sets the input content for an ingest process prior to calling start() to
* run the process using the process configuration settings for the context
* specified using setContext().
*/
void setContent(List<Content> inputContent);
/**
* Starts (queues) the ingest process for the content specified using the
* setContent() method, using the configuration settings corresponding to
* the ingest process context specified using the setContext() method.
*/
void start();
/**
* Returns true if any ingest process is running, false otherwise.
* Note that the running process may or may not be the process started
* (queued) by an invocation of the start() method.
*/
boolean isIngestRunning();
}

View File

@ -30,11 +30,9 @@ import javax.swing.BoxLayout;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.casemodule.GeneralIngestConfigurator;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.autopsy.casemodule.IngestConfigurator;
/** /**
* Dialog box that allows ingest modules to be run on an image. * Dialog box that allows ingest modules to be run on an image.
@ -49,8 +47,14 @@ public class IngestDialog extends JDialog {
public IngestDialog(JFrame frame, String title, boolean modal) { public IngestDialog(JFrame frame, String title, boolean modal) {
super(frame, title, modal); super(frame, title, modal);
ingestConfigurator = new GeneralIngestConfigurator(); ingestConfigurator = new GeneralIngestConfigurator();
ingestConfigurator.setContext(IngestDialog.class.getCanonicalName()); List<String> messages = ingestConfigurator.setContext(IngestDialog.class.getCanonicalName());
ingestConfigurator.reload(); if (messages.isEmpty() == false) {
StringBuilder warning = new StringBuilder();
for (String message : messages) {
warning.append(message).append("\n");
}
JOptionPane.showMessageDialog(null, warning.toString());
}
} }
public IngestDialog(){ public IngestDialog(){

View File

@ -44,8 +44,6 @@ public class IngestDialogPanel extends javax.swing.JPanel {
private IngestModuleAbstract currentModule; private IngestModuleAbstract currentModule;
private ModulesTableModel tableModel; private ModulesTableModel tableModel;
public static final String DISABLED_MOD = "Disabled_Ingest_Modules";
public static final String PARSE_UNALLOC = "Process_Unallocated_Space";
private String context; private String context;
/** /**
@ -123,8 +121,8 @@ public class IngestDialogPanel extends javax.swing.JPanel {
processUnallocCheckbox.setSelected(enabled); processUnallocCheckbox.setSelected(enabled);
} }
public void setDisabledModules(List<IngestModuleAbstract> disabledModules) { public void setEnabledIngestModules(List<IngestModuleAbstract> enabledModules) {
tableModel.setUnselectedModules(disabledModules); tableModel.setSelectedModules(enabledModules);
} }
/** /**

View File

@ -28,6 +28,6 @@
<target name="init" depends="basic-init,files-init,build-init,-javac-init"> <target name="init" depends="basic-init,files-init,build-init,-javac-init">
<!-- get additional deps --> <!-- get additional deps -->
<antcall target="getMacTime" /> <!-- This should only be done on non-Windows systems. <antcall target="getMacTime" /> -->
</target> </target>
</project> </project>