Prepare for merge of develop branch

This commit is contained in:
Richard Cordovano 2014-03-18 15:33:38 -04:00
parent 03e2f5fb6c
commit bed31e5f8f
54 changed files with 348 additions and 473 deletions

View File

@ -19,7 +19,7 @@
package org.sleuthkit.autopsy.casemodule;
import org.sleuthkit.autopsy.ingest.IngestConfigurator;
import org.sleuthkit.autopsy.ingest.IngestJobLauncher;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.event.ActionEvent;
@ -36,12 +36,12 @@ import org.openide.DialogDisplayer;
import org.openide.WizardDescriptor;
import org.openide.util.ChangeSupport;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.openide.util.actions.Presenter;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.Image;
/**
@ -109,8 +109,7 @@ public final class AddImageAction extends CallableSystemAction implements Presen
public void actionPerformed(ActionEvent e) {
Logger.noteAction(AddImageAction.class);
final IngestConfigurator ingestConfig = Lookup.getDefault().lookup(IngestConfigurator.class);
if (null != ingestConfig && ingestConfig.isIngestRunning()) {
if (IngestManager.getDefault().isIngestRunning()) {
final String msg = "<html>Ingest is ongoing on another data source. Adding a new source now might slow down the current ingest.<br />Do you want to proceed and add a new data source now?</html>";
if (JOptionPane.showConfirmDialog(null, msg, "Ingest in progress", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
return;

View File

@ -19,7 +19,7 @@
package org.sleuthkit.autopsy.casemodule;
import org.sleuthkit.autopsy.ingest.IngestConfigurator;
import org.sleuthkit.autopsy.ingest.IngestJobLauncher;
import java.awt.Color;
import java.awt.Component;
import java.awt.Window;
@ -46,7 +46,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDescriptor> {
private static final Logger logger = Logger.getLogger(AddImageWizardIngestConfigPanel.class.getName());
private IngestConfigurator ingestConfig;
private IngestJobLauncher ingestConfig;
/**
* The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent().
@ -73,8 +73,8 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
this.progressPanel = proPanel;
this.dataSourcePanel = dsPanel;
ingestConfig = new IngestConfigurator(AddImageWizardIngestConfigPanel.class.getCanonicalName());
List<String> messages = ingestConfig.getMissingIngestModuleErrorMessages();
ingestConfig = new IngestJobLauncher(AddImageWizardIngestConfigPanel.class.getCanonicalName());
List<String> messages = ingestConfig.getMissingIngestModuleMessages();
if (messages.isEmpty() == false) {
StringBuilder warning = new StringBuilder();
for (String message : messages) {
@ -95,7 +95,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
@Override
public Component getComponent() {
if (component == null) {
component = new AddImageWizardIngestConfigVisual(ingestConfig.getIngestConfigPanel());
component = new AddImageWizardIngestConfigVisual(ingestConfig.getIngestJobConfigPanel());
}
return component;
}
@ -187,7 +187,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
*/
@Override
public void storeSettings(WizardDescriptor settings) {
ingestConfig.save();
ingestConfig.saveIngestJobConfig();
// Start ingest if it hasn't already been started
readyToIngest = true;
@ -201,8 +201,8 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
private void startIngest() {
if (!newContents.isEmpty() && readyToIngest && !ingested) {
ingested = true;
ingestConfig.setContent(newContents);
ingestConfig.start();
ingestConfig.setDataSourcesToIngest(newContents);
ingestConfig.startIngestJobs();
progressPanel.setStateFinished();
}

View File

@ -113,7 +113,7 @@ class DirectoryTreeFilterNode extends FilterNode {
@Override
public void actionPerformed(ActionEvent e) {
final IngestDialog ingestDialog = new IngestDialog();
ingestDialog.setContent(Collections.<Content>singletonList(content));
ingestDialog.setDataSources(Collections.<Content>singletonList(content));
ingestDialog.display();
}
});

View File

@ -44,13 +44,14 @@ import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
// RJCTODO: Remove inheritance from IngestModuleAdapter and provide better documentation.
/**
* Sample data source ingest module that doesn't do much. Note that the
* IngestModuleAdapter abstract class could have been used as a base class to
* obtain default implementations of many of the DataSourceIngestModule methods.
*/
// RJCTODO: Add service provider annotatin (commend out)
// RJCTODO: Add service provider annotation (commend out)
// RJCTODO: Remove inheritance from IngestModuleAdapter and provide better documentation,
// and more extensive demonstration of how to use various ingest services.
class SampleDataSourceIngestModule extends IngestModuleAdapter implements DataSourceIngestModule {
private static final Logger logger = Logger.getLogger(SampleDataSourceIngestModule.class);
@ -80,18 +81,4 @@ class SampleDataSourceIngestModule extends IngestModuleAdapter implements DataSo
return IngestModule.ResultCode.OK;
}
// @Override
// public String getName() {
// return "SampleDataSourceIngestModule";
// }
//
// @Override
// public String getVersion() {
// return "1.0";
// }
//
// @Override
// public String getDescription() {
// return "Doesn't do much";
// }
}

View File

@ -1,33 +1,32 @@
/*
* Sample module in the public domain. Feel free to use this as a template
* for your modules.
*
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
* Sample module in the public domain. Feel free to use this as a template
* for your modules.
*
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.sleuthkit.autopsy.examples;
import org.apache.log4j.Logger;
@ -36,7 +35,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
@ -44,23 +43,26 @@ import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData;
// RJCTODO: Remove inheritance from IngestModuleAdapter and provide better documentation.
/**
* This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set.
* It does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow.
*
* Autopsy has been hard coded to ignore this module based on the it's package name.
* IngestModuleLoader will not load things from the org.sleuthkit.autopsy.examples package.
* Either change the package or the loading code to make this module actually run.
* This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set. It
* does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow.
*
* Autopsy has been hard coded to ignore this module based on the it's package
* name. IngestModuleLoader will not load things from the
* org.sleuthkit.autopsy.examples package. Either change the package or the
* loading code to make this module actually run.
*/
// RJCTODO: Add service provider annotatin (commend out)
// RJCTODO: Add service provider annotation (commend out)
// RJCTODO: Remove inheritance from IngestModuleAdapter and provide better documentation,
// and more extensive demonstration of how to use various ingest services.
class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestModule {
private int attrId = -1;
@Override
public void startUp(IngestModuleContext initContext) {
public void startUp(IngestJobContext initContext) {
/* For this demo, we are going to make a private attribute to post our
* results to the blackbaord with. There are many standard blackboard artifact
* and attribute types and you should first consider using one of those before
@ -70,7 +72,7 @@ class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestMo
*/
Case case1 = Case.getCurrentCase();
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
// see if the type already exists in the blackboard.
try {
attrId = sleuthkitCase.getAttrTypeID("ATTR_SAMPLE");
@ -85,21 +87,21 @@ class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestMo
}
}
}
@Override
public IngestModule.ResultCode process(AbstractFile abstractFile) {
// skip non-files
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) ||
(abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
|| (abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
return IngestModule.ResultCode.OK;
}
// skip NSRL / known files
if (abstractFile.getKnown() == TskData.FileKnown.KNOWN) {
return IngestModule.ResultCode.OK;
}
/* Do a non-sensical calculation of the number of 0x00 bytes
* in the first 1024-bytes of the file. This is for demo
* purposes only.
@ -113,7 +115,7 @@ class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestMo
count++;
}
}
if (attrId != -1) {
// Make an attribute using the ID for the private type that we previously created.
BlackboardAttribute attr = new BlackboardAttribute(attrId, "SampleFileIngestModule", count); // RJCTODO: Set up with name as exmaple
@ -124,7 +126,7 @@ class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestMo
BlackboardArtifact art = abstractFile.getGenInfoArtifact();
art.addAttribute(attr);
}
return IngestModule.ResultCode.OK;
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
@ -133,20 +135,4 @@ class SampleFileIngestModule extends IngestModuleAdapter implements FileIngestMo
}
// RJCTODO: Add a module factory
// @Override
// public String getVersion() {
// return "1.0";
// }
//
// @Override
// public String getName() {
// return "SampleFileIngestModule";
// }
//
// @Override
// public String getDescription() {
// return "Doesn't do much";
// }
}

View File

@ -31,6 +31,6 @@ IngestMessagePanel.totalMessagesNameLabel.text=Total:
IngestMessagePanel.totalMessagesNameVal.text=-
IngestMessagePanel.totalUniqueMessagesNameLabel.text=Unique:
IngestMessagePanel.totalUniqueMessagesNameVal.text=-
IngestConfigurationPanel.advancedButton.text=Advanced
IngestConfigurationPanel.processUnallocCheckbox.toolTipText=Processes unallocated space, such as deleted files. Produces more complete results, but it may take longer to process on large images.
IngestConfigurationPanel.processUnallocCheckbox.text=Process Unallocated Space
IngestJobConfigurationPanel.processUnallocCheckbox.toolTipText=Processes unallocated space, such as deleted files. Produces more complete results, but it may take longer to process on large images.
IngestJobConfigurationPanel.processUnallocCheckbox.text=Process Unallocated Space
IngestJobConfigurationPanel.advancedButton.text=Advanced

View File

@ -35,54 +35,55 @@ import org.sleuthkit.datamodel.VolumeSystem;
/**
* Abstract visitor for getting all the files from content.
*/
// TODO Could be moved to utility package, is there another version of this
// somewhere?
abstract class GetFilesContentVisitor implements ContentVisitor<Collection<AbstractFile>> {
// RJCTODO: Could this be moved to utility package, is there another version of this
// somewhere? An old comment said something about circular dependencies. Note: will use
// this for per ingest job progress bars.
abstract class GetFilesContentVisitor implements ContentVisitor<Collection<AbstractFile>> {
private static final Logger logger = Logger.getLogger(GetFilesContentVisitor.class.getName());
private static final Logger logger = Logger.getLogger(GetFilesContentVisitor.class.getName());
@Override
public Collection<AbstractFile> visit(VirtualDirectory ld) {
return getAllFromChildren(ld);
}
@Override
public Collection<AbstractFile> visit(Directory drctr) {
return getAllFromChildren(drctr);
}
@Override
public Collection<AbstractFile> visit(VirtualDirectory ld) {
return getAllFromChildren(ld);
}
@Override
public Collection<AbstractFile> visit(Image image) {
return getAllFromChildren(image);
}
@Override
public Collection<AbstractFile> visit(Directory drctr) {
return getAllFromChildren(drctr);
}
@Override
public Collection<AbstractFile> visit(Volume volume) {
return getAllFromChildren(volume);
}
@Override
public Collection<AbstractFile> visit(Image image) {
return getAllFromChildren(image);
}
@Override
public Collection<AbstractFile> visit(VolumeSystem vs) {
return getAllFromChildren(vs);
}
@Override
public Collection<AbstractFile> visit(Volume volume) {
return getAllFromChildren(volume);
}
/**
* Aggregate all the matches from visiting the children Content objects of the
* one passed
* @param parent
* @return
*/
protected Collection<AbstractFile> getAllFromChildren(Content parent) {
Collection<AbstractFile> all = new ArrayList<>();
@Override
public Collection<AbstractFile> visit(VolumeSystem vs) {
return getAllFromChildren(vs);
}
try {
for (Content child : parent.getChildren()) {
all.addAll(child.accept(this));
}
} catch (TskException ex) {
logger.log(Level.SEVERE, "Error getting Content children", ex);
}
/**
* Aggregate all the matches from visiting the children Content objects of the
* one passed
* @param parent
* @return
*/
protected Collection<AbstractFile> getAllFromChildren(Content parent) {
Collection<AbstractFile> all = new ArrayList<>();
return all;
}
try {
for (Content child : parent.getChildren()) {
all.addAll(child.accept(this));
}
} catch (TskException ex) {
logger.log(Level.SEVERE, "Error getting Content children", ex);
}
return all;
}
}

View File

@ -34,21 +34,21 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.sleuthkit.datamodel.Content;
// RJCTODO: Rename to RunIngestModulesDialog after internationalization
// RJCTODO: Rename to RunIngestModulesDialog after internationalization.
/**
* Dialog box that allows ingest modules to be run on an image.
* Dialog box that allows ingest modules to be run on a data source.
* Used outside of the wizards.
*/
public class IngestDialog extends JDialog {
public final class IngestDialog extends JDialog {
private static final String TITLE = "Ingest Modules";
private static Dimension DIMENSIONS = new Dimension(500, 300);
private IngestConfigurator ingestConfigurator;
private IngestJobLauncher ingestConfigurator;
public IngestDialog(JFrame frame, String title, boolean modal) {
super(frame, title, modal);
ingestConfigurator = new IngestConfigurator(IngestDialog.class.getCanonicalName());
List<String> messages = ingestConfigurator.getMissingIngestModuleErrorMessages();
ingestConfigurator = new IngestJobLauncher(IngestDialog.class.getCanonicalName());
List<String> messages = ingestConfigurator.getMissingIngestModuleMessages();
if (messages.isEmpty() == false) {
StringBuilder warning = new StringBuilder();
for (String message : messages) {
@ -77,15 +77,15 @@ public class IngestDialog extends JDialog {
// set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
add(ingestConfigurator.getIngestConfigPanel(), BorderLayout.PAGE_START);
add(ingestConfigurator.getIngestJobConfigPanel(), BorderLayout.PAGE_START);
JButton startButton = new JButton("Start");
JButton closeButton = new JButton("Close");
startButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ingestConfigurator.save();
ingestConfigurator.start();
ingestConfigurator.saveIngestJobConfig();
ingestConfigurator.startIngestJobs();
close();
}
});
@ -93,7 +93,7 @@ public class IngestDialog extends JDialog {
@Override
public void actionPerformed(ActionEvent e) {
ingestConfigurator.save();
ingestConfigurator.saveIngestJobConfig();
close();
}
});
@ -101,7 +101,7 @@ public class IngestDialog extends JDialog {
@Override
public void windowClosing(WindowEvent e) {
ingestConfigurator.save();
ingestConfigurator.saveIngestJobConfig();
close();
}
});
@ -118,8 +118,8 @@ public class IngestDialog extends JDialog {
setVisible(true);
}
public void setContent(List<Content> inputContent) {
ingestConfigurator.setContent(inputContent);
public void setDataSources(List<Content> inputContent) {
ingestConfigurator.setDataSourcesToIngest(inputContent);
}
/**

View File

@ -33,7 +33,7 @@ import org.sleuthkit.datamodel.Content;
* Encapsulates a data source and the ingest module pipelines to be used to
* ingest the data source.
*/
final class DataSourceIngestTask {
final class IngestJob {
private final long id;
private final Content dataSource;
@ -45,7 +45,7 @@ final class DataSourceIngestTask {
private DataSourceIngestPipeline initialDataSourceIngestPipeline = null;
private boolean cancelled;
DataSourceIngestTask(long id, Content dataSource, List<IngestModuleTemplate> ingestModuleTemplates, boolean processUnallocatedSpace) {
IngestJob(long id, Content dataSource, List<IngestModuleTemplate> ingestModuleTemplates, boolean processUnallocatedSpace) {
this.id = id;
this.dataSource = dataSource;
this.ingestModuleTemplates = ingestModuleTemplates;
@ -92,7 +92,7 @@ final class DataSourceIngestTask {
dataSourceIngestPipelines.put(threadId, pipeline);
} else if (!dataSourceIngestPipelines.containsKey(threadId)) {
pipeline = new DataSourceIngestPipeline(this, ingestModuleTemplates);
pipeline.startUp(); // RJCTODO: If time permits, return possible errors with pipeline or some such thing
pipeline.startUp(); // RJCTODO: Get errors and log
dataSourceIngestPipelines.put(threadId, pipeline);
} else {
pipeline = dataSourceIngestPipelines.get(threadId);
@ -146,11 +146,11 @@ final class DataSourceIngestTask {
static final class DataSourceIngestPipeline {
private static final Logger logger = Logger.getLogger(DataSourceIngestPipeline.class.getName());
private final DataSourceIngestTask task;
private final IngestJob task;
private final List<IngestModuleTemplate> moduleTemplates;
private List<DataSourceIngestModuleDecorator> modules = new ArrayList<>();
private DataSourceIngestPipeline(DataSourceIngestTask task, List<IngestModuleTemplate> moduleTemplates) {
private DataSourceIngestPipeline(IngestJob task, List<IngestModuleTemplate> moduleTemplates) {
this.task = task;
this.moduleTemplates = moduleTemplates;
}
@ -169,7 +169,7 @@ final class DataSourceIngestTask {
if (factory.isDataSourceIngestModuleFactory()) {
IngestModuleSettings ingestOptions = template.getIngestOptions();
DataSourceIngestModuleDecorator module = new DataSourceIngestModuleDecorator(factory.createDataSourceIngestModule(ingestOptions), factory.getModuleDisplayName());
IngestModuleContext context = new IngestModuleContext(task, factory);
IngestJobContext context = new IngestJobContext(task, factory);
try {
module.startUp(context);
modulesByClass.put(module.getClassName(), module);
@ -250,7 +250,7 @@ final class DataSourceIngestTask {
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
module.startUp(context);
}
@ -273,11 +273,11 @@ final class DataSourceIngestTask {
static final class FileIngestPipeline {
private static final Logger logger = Logger.getLogger(FileIngestPipeline.class.getName());
private final DataSourceIngestTask task;
private final IngestJob task;
private final List<IngestModuleTemplate> moduleTemplates;
private List<FileIngestModuleDecorator> modules = new ArrayList<>();
private FileIngestPipeline(DataSourceIngestTask task, List<IngestModuleTemplate> moduleTemplates) {
private FileIngestPipeline(IngestJob task, List<IngestModuleTemplate> moduleTemplates) {
this.task = task;
this.moduleTemplates = moduleTemplates;
}
@ -296,7 +296,7 @@ final class DataSourceIngestTask {
if (factory.isFileIngestModuleFactory()) {
IngestModuleSettings ingestOptions = template.getIngestOptions();
FileIngestModuleDecorator module = new FileIngestModuleDecorator(factory.createFileIngestModule(ingestOptions), factory.getModuleDisplayName());
IngestModuleContext context = new IngestModuleContext(task, factory);
IngestJobContext context = new IngestJobContext(task, factory);
try {
module.startUp(context);
modulesByClass.put(module.getClassName(), module);
@ -376,7 +376,7 @@ final class DataSourceIngestTask {
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
module.startUp(context);
}

View File

@ -134,7 +134,7 @@
<Component class="javax.swing.JButton" name="advancedButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestConfigurationPanel.advancedButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestJobConfigurationPanel.advancedButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
@ -201,10 +201,10 @@
<Component class="javax.swing.JCheckBox" name="processUnallocCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestConfigurationPanel.processUnallocCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestJobConfigurationPanel.processUnallocCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestConfigurationPanel.processUnallocCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestJobConfigurationPanel.processUnallocCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>

View File

@ -38,13 +38,13 @@ import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog;
* User interface component to allow a user to set ingest module options and
* enable/disable the modules.
*/
class IngestConfigurationPanel extends javax.swing.JPanel {
class IngestJobConfigurationPanel extends javax.swing.JPanel {
private List<IngestModuleModel> modules = new ArrayList<>();
private boolean processUnallocatedSpace = false;
private IngestModuleModel selectedModule = null;
IngestConfigurationPanel(List<IngestModuleTemplate> moduleTemplates, boolean processUnallocatedSpace) {
IngestJobConfigurationPanel(List<IngestModuleTemplate> moduleTemplates, boolean processUnallocatedSpace) {
for (IngestModuleTemplate moduleTemplate : moduleTemplates) {
modules.add(new IngestModuleModel(moduleTemplate));
}
@ -157,7 +157,7 @@ class IngestConfigurationPanel extends javax.swing.JPanel {
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160)));
jPanel1.setPreferredSize(new java.awt.Dimension(338, 257));
advancedButton.setText(org.openide.util.NbBundle.getMessage(IngestConfigurationPanel.class, "IngestConfigurationPanel.advancedButton.text")); // NOI18N
advancedButton.setText(org.openide.util.NbBundle.getMessage(IngestJobConfigurationPanel.class, "IngestJobConfigurationPanel.advancedButton.text")); // NOI18N
advancedButton.setEnabled(false);
advancedButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -195,8 +195,8 @@ class IngestConfigurationPanel extends javax.swing.JPanel {
processUnallocPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160)));
processUnallocCheckbox.setText(org.openide.util.NbBundle.getMessage(IngestConfigurationPanel.class, "IngestConfigurationPanel.processUnallocCheckbox.text")); // NOI18N
processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestConfigurationPanel.class, "IngestConfigurationPanel.processUnallocCheckbox.toolTipText")); // NOI18N
processUnallocCheckbox.setText(org.openide.util.NbBundle.getMessage(IngestJobConfigurationPanel.class, "IngestJobConfigurationPanel.processUnallocCheckbox.text")); // NOI18N
processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestJobConfigurationPanel.class, "IngestJobConfigurationPanel.processUnallocCheckbox.toolTipText")); // NOI18N
processUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
processUnallocCheckboxActionPerformed(evt);
@ -295,18 +295,18 @@ class IngestConfigurationPanel extends javax.swing.JPanel {
private final IngestModuleTemplate moduleTemplate;
private IngestModuleGlobalSetttingsPanel resourcesConfigPanel = null;
private IngestModuleSettingsPanel ingestJobOptionsPanel = null;
private IngestModuleJobSettingsPanel ingestJobOptionsPanel = null;
IngestModuleModel(IngestModuleTemplate moduleTemplate) {
this.moduleTemplate = moduleTemplate;
IngestModuleFactory moduleFactory = moduleTemplate.getIngestModuleFactory();
if (moduleFactory.providesIngestJobOptionsPanels()) {
ingestJobOptionsPanel = moduleFactory.getIngestJobOptionsPanel(moduleTemplate.getIngestOptions());
if (moduleFactory.providesModuleSettingsPanel()) {
ingestJobOptionsPanel = moduleFactory.getModuleSettingsPanel(moduleTemplate.getIngestOptions());
}
if (moduleFactory.providesResourcesConfigPanels()) {
resourcesConfigPanel = moduleFactory.getResourcesConfigPanel();
if (moduleFactory.providesGlobalSettingsPanel()) {
resourcesConfigPanel = moduleFactory.getGlobalSettingsPanel();
}
}
@ -331,15 +331,15 @@ class IngestConfigurationPanel extends javax.swing.JPanel {
}
boolean hasIngestOptionsPanel() {
return moduleTemplate.getIngestModuleFactory().providesIngestJobOptionsPanels();
return moduleTemplate.getIngestModuleFactory().providesModuleSettingsPanel();
}
IngestModuleSettingsPanel getIngestOptionsPanel() {
IngestModuleJobSettingsPanel getIngestOptionsPanel() {
return ingestJobOptionsPanel;
}
boolean hasResourcesConfigPanel() {
return moduleTemplate.getIngestModuleFactory().providesResourcesConfigPanels();
return moduleTemplate.getIngestModuleFactory().providesGlobalSettingsPanel();
}
IngestModuleGlobalSetttingsPanel getResourcesConfigPanel() {

View File

@ -32,16 +32,16 @@ import org.sleuthkit.datamodel.SleuthkitCase;
* Acts as a facade for the parts of the ingest framework that make up the
* processing context of an ingest module.
*/
public final class IngestModuleContext {
public final class IngestJobContext {
private final DataSourceIngestTask ingestJob;
private final IngestJob ingestJob;
private final IngestModuleFactory moduleFactory;
private final IngestManager ingestManager;
private final IngestScheduler scheduler;
private final Case autopsyCase;
private final SleuthkitCase sleuthkitCase;
IngestModuleContext(DataSourceIngestTask ingestJob, IngestModuleFactory moduleFactory) {
IngestJobContext(IngestJob ingestJob, IngestModuleFactory moduleFactory) {
this.ingestJob = ingestJob;
this.moduleFactory = moduleFactory;
ingestManager = IngestManager.getDefault();
@ -54,20 +54,10 @@ public final class IngestModuleContext {
return this.ingestJob.isCancelled();
}
/**
* RJCTODO
*
* @return
*/
public Case getCase() {
return autopsyCase;
}
/**
* RJCTODO
*
* @return
*/
public SleuthkitCase getSleuthkitCase() {
return sleuthkitCase;
}

View File

@ -25,33 +25,22 @@ import javax.swing.JPanel;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.Content;
/**
* RJCTODO: Improve comment Controller to allow a user to set context-sensitive
* ingest module options, enable/disable ingest modules, and set general ingest
* options. Provides an ingest module model class and instances of a UI
* component to its clients (Model-View-Controller design pattern).
*/
public class IngestConfigurator {
public final class IngestJobLauncher {
private static final String ENABLED_INGEST_MODULES_KEY = "Enabled_Ingest_Modules";
private static final String DISABLED_INGEST_MODULES_KEY = "Disabled_Ingest_Modules";
private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space";
private final String context;
private List<String> missingIngestModuleErrorMessages = new ArrayList<>();
private IngestConfigurationPanel ingestConfigPanel = null;
private List<Content> contentToIngest = null; // RJCTODO: Remove if start() method removed
private final String launcherContext;
private final List<String> missingIngestModuleErrorMessages = new ArrayList<>();
private final List<Content> dataSourcesToIngest = new ArrayList<>();
private IngestJobConfigurationPanel ingestConfigPanel;
/**
* RJCTODO
*
* @param context
*/
public IngestConfigurator(String context) {
this.context = context;
public IngestJobLauncher(String launcherContext) {
this.launcherContext = launcherContext;
// Get the ingest module factories discovered by the ingest module
// loader.
// RJCTODO: Put in name uniqueness test/solution in loader!
// RJCTODO: Put in module name uniqueness test/notification either here or in the loader
List<IngestModuleFactory> moduleFactories = IngestModuleLoader.getInstance().getIngestModuleFactories();
HashSet<String> loadedModuleNames = new HashSet<>();
for (IngestModuleFactory moduleFactory : moduleFactories) {
@ -67,10 +56,11 @@ public class IngestConfigurator {
HashSet<String> knownModuleNames = new HashSet<>();
List<IngestModuleTemplate> moduleTemplates = new ArrayList<>();
for (IngestModuleFactory moduleFactory : moduleFactories) {
// RJCTODO: Make sure there is a story in JIRA for this.
// NOTE: In the future, this code will be modified to get the
// resources configuration and ingest job options for each module
// for the current context; for now just get the defaults.
IngestModuleSettings ingestOptions = moduleFactory.getDefaultIngestJobOptions();
IngestModuleSettings ingestOptions = moduleFactory.getDefaultModuleSettings();
IngestModuleTemplate moduleTemplate = new IngestModuleTemplate(moduleFactory, ingestOptions);
String moduleName = moduleTemplate.getIngestModuleFactory().getModuleDisplayName();
if (enabledModuleNames.contains(moduleName)) {
@ -94,48 +84,32 @@ public class IngestConfigurator {
if (!knownModuleNames.contains(moduleName)) {
missingIngestModuleErrorMessages.add(moduleName + " was previously enabled, but could not be found");
enabledModuleNames.remove(moduleName);
disabledModuleNames.add(moduleName); // RJCTODO: Is this the right behavior?
disabledModuleNames.add(moduleName);
}
}
ModuleSettings.setConfigSetting(context, ENABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(enabledModuleNames));
ModuleSettings.setConfigSetting(context, DISABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(disabledModuleNames));
ModuleSettings.setConfigSetting(launcherContext, ENABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(enabledModuleNames));
ModuleSettings.setConfigSetting(launcherContext, DISABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(disabledModuleNames));
// Get the process unallocated space flag setting. If the setting does
// not exist yet, default it to false.
if (ModuleSettings.settingExists(context, PARSE_UNALLOC_SPACE_KEY) == false) {
ModuleSettings.setConfigSetting(context, PARSE_UNALLOC_SPACE_KEY, "false");
if (ModuleSettings.settingExists(launcherContext, PARSE_UNALLOC_SPACE_KEY) == false) {
ModuleSettings.setConfigSetting(launcherContext, PARSE_UNALLOC_SPACE_KEY, "false");
}
boolean processUnallocatedSpace = Boolean.parseBoolean(ModuleSettings.getConfigSetting(context, PARSE_UNALLOC_SPACE_KEY));
boolean processUnallocatedSpace = Boolean.parseBoolean(ModuleSettings.getConfigSetting(launcherContext, PARSE_UNALLOC_SPACE_KEY));
// Make the configuration panel for the current context (view).
ingestConfigPanel = new IngestConfigurationPanel(moduleTemplates, processUnallocatedSpace);
ingestConfigPanel = new IngestJobConfigurationPanel(moduleTemplates, processUnallocatedSpace);
}
/**
* RJCTODO
*
* @return
*/
public List<String> getMissingIngestModuleErrorMessages() {
public List<String> getMissingIngestModuleMessages() {
return missingIngestModuleErrorMessages;
}
/**
* RJCTODO
*
* @return
*/
public JPanel getIngestConfigPanel() {
public JPanel getIngestJobConfigPanel() {
return ingestConfigPanel;
}
/**
* RJCTODO
*
* @throws
* org.sleuthkit.autopsy.ingest.IngestConfigurator.IngestConfigurationException
*/
public void save() {
public void saveIngestJobConfig() {
List<IngestModuleTemplate> moduleTemplates = ingestConfigPanel.getIngestModuleTemplates();
// Save the enabled/disabled ingest module settings for the current context.
@ -149,31 +123,24 @@ public class IngestConfigurator {
disabledModuleNames.add(moduleName);
}
}
ModuleSettings.setConfigSetting(context, ENABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(enabledModuleNames));
ModuleSettings.setConfigSetting(context, DISABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(disabledModuleNames));
ModuleSettings.setConfigSetting(launcherContext, ENABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(enabledModuleNames));
ModuleSettings.setConfigSetting(launcherContext, DISABLED_INGEST_MODULES_KEY, makeCommaSeparatedList(disabledModuleNames));
// Save the process unallocated space setting for the current context.
String processUnalloc = Boolean.toString(ingestConfigPanel.getProcessUnallocSpace());
ModuleSettings.setConfigSetting(context, PARSE_UNALLOC_SPACE_KEY, processUnalloc);
ModuleSettings.setConfigSetting(launcherContext, PARSE_UNALLOC_SPACE_KEY, processUnalloc);
// NOTE: In the future, this code will be modified to persist the ingest
// options for each ingest module for the current context.
// options for each ingest module for the current launch context.
}
// RJCTODO: If time permits, make it so that this class is not responsible
// starting and running the ingest - probably need to do this anyway, at
// least if the IngestConfigurator interface goes away and this becomes the
// IngestConfigurator class.
public void setContent(List<Content> inputContent) {
this.contentToIngest = inputContent;
public void setDataSourcesToIngest(List<Content> dataSourcesToIngest) {
this.dataSourcesToIngest.clear();
this.dataSourcesToIngest.addAll(dataSourcesToIngest);
}
// RJCTODO: If time permits, make it so that this class is not responsible
// starting and running the ingest - probably need to do this anyway, at
// least if the IngestConfigurator interface goes away and this becomes the
// IngestConfigurator class.
public void start() {
// Filter out the disabled module tremplates.
public void startIngestJobs() {
// Filter out the disabled ingest module templates.
List<IngestModuleTemplate> enabledModuleTemplates = new ArrayList<>();
List<IngestModuleTemplate> moduleTemplates = ingestConfigPanel.getIngestModuleTemplates();
for (IngestModuleTemplate moduleTemplate : moduleTemplates) {
@ -182,19 +149,11 @@ public class IngestConfigurator {
}
}
if ((!enabledModuleTemplates.isEmpty()) && (contentToIngest != null)) {
IngestManager.getDefault().scheduleDataSourceTasks(contentToIngest, enabledModuleTemplates, ingestConfigPanel.getProcessUnallocSpace());
if ((!enabledModuleTemplates.isEmpty()) && (dataSourcesToIngest != null)) {
IngestManager.getDefault().scheduleDataSourceTasks(dataSourcesToIngest, enabledModuleTemplates, ingestConfigPanel.getProcessUnallocSpace());
}
}
// RJCTODO: If time permits, make it so that this class is not responsible
// starting and running the ingest - probably need to do this anyway, at
// least if the IngestConfigurator interface goes away and this becomes the
// IngestConfigurator class.
public boolean isIngestRunning() {
return IngestManager.getDefault().isIngestRunning();
}
private static String makeCommaSeparatedList(HashSet<String> input) {
if (input == null || input.isEmpty()) {
return "";
@ -210,15 +169,14 @@ public class IngestConfigurator {
return csvList.toString();
}
// RJCTODO: May need additional mappings - EWF Verify to EWF Verifier
private HashSet<String> getModulesNamesFromSetting(String key, String defaultSetting) {
// Get the ingest modules setting from the user's config file.
// If there is no such setting yet, create the default setting.
if (ModuleSettings.settingExists(context, key) == false) {
ModuleSettings.setConfigSetting(context, key, defaultSetting);
if (ModuleSettings.settingExists(launcherContext, key) == false) {
ModuleSettings.setConfigSetting(launcherContext, key, defaultSetting);
}
HashSet<String> moduleNames = new HashSet<>();
String modulesSetting = ModuleSettings.getConfigSetting(context, key);
String modulesSetting = ModuleSettings.getConfigSetting(launcherContext, key);
if (!modulesSetting.isEmpty()) {
String[] settingNames = modulesSetting.split(", ");
for (String name : settingNames) {
@ -231,6 +189,9 @@ public class IngestConfigurator {
case "File Extension Mismatch Detection":
moduleNames.add("Extension Mismatch Detector");
break;
case "EWF Verify":
moduleNames.add("EWF Verifier");
break;
default:
moduleNames.add(name);
}

View File

@ -35,6 +35,8 @@ import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
// RJCTODO: Fix comment
// RJCTODO: It woulod be really nice to move such a powerful class behind a
// facade. This is a good argument for IngestServices as the facade.
/**
* IngestManager sets up and manages ingest modules runs them in a background
* thread notifies modules when work is complete or should be interrupted
@ -50,7 +52,7 @@ public class IngestManager {
private static IngestManager instance;
private final IngestScheduler scheduler;
private final IngestMonitor ingestMonitor = new IngestMonitor();
private final HashMap<Long, DataSourceIngestTask> ingestJobs = new HashMap<>();
private final HashMap<Long, IngestJob> ingestJobs = new HashMap<>();
private TaskSchedulingWorker taskSchedulingWorker;
private FileTaskWorker fileTaskWorker;
private DataSourceTaskWorker dataSourceTaskWorker;
@ -261,13 +263,13 @@ public class IngestManager {
* @param pipelineContext ingest context used to ingest parent of the file
* to be scheduled
*/
void scheduleFileTask(long ingestJobId, AbstractFile file) { // RJCTODO: With the module context, this can be passed the task itself
DataSourceIngestTask job = this.ingestJobs.get(ingestJobId); // RJCTODO: Consider renaming
void scheduleFileTask(long ingestJobId, AbstractFile file) { // RJCTODO: Consider renaming method
IngestJob job = this.ingestJobs.get(ingestJobId);
if (job == null) {
// RJCTODO: Handle severe error
}
scheduler.getFileScheduler().scheduleIngestOfDerivedFile(job, file); // RJCTODO: Consider renaming
scheduler.getFileScheduler().scheduleIngestOfDerivedFile(job, file);
}
/**
@ -282,30 +284,28 @@ public class IngestManager {
* worker
*/
private synchronized void startAll() {
// RJCTODO: What does this do?
if (!ingestMonitor.isRunning()) {
ingestMonitor.start();
}
if (scheduler.getDataSourceScheduler().hasNext()) {
if (dataSourceTaskWorker == null || dataSourceTaskWorker.isDone()) {
dataSourceTaskWorker = new DataSourceTaskWorker(getNextThreadId()); // RJCTODO: May not need method call
dataSourceTaskWorker = new DataSourceTaskWorker(getNextThreadId());
dataSourceTaskWorker.execute();
}
}
if (scheduler.getFileScheduler().hasNext()) {
if (fileTaskWorker == null || fileTaskWorker.isDone()) {
fileTaskWorker = new FileTaskWorker(getNextThreadId()); // RJCTODO: May not need method call
fileTaskWorker = new FileTaskWorker(getNextThreadId());
fileTaskWorker.execute();
}
}
}
synchronized void reportThreadDone(long threadId) {
for (DataSourceIngestTask job : ingestJobs.values()) {
for (IngestJob job : ingestJobs.values()) {
job.releaseIngestPipelinesForThread(threadId);
// RJCTODO: Add logging of errors or send ingest messages
if (job.areIngestPipelinesShutDown()) {
ingestJobs.remove(job.getId());
}
@ -326,7 +326,7 @@ public class IngestManager {
// Now mark all of the ingest jobs as cancelled. This way the ingest
// modules will know they are being shut down due to cancellation when
// the ingest worker threads release their pipelines.
for (DataSourceIngestTask job : ingestJobs.values()) {
for (IngestJob job : ingestJobs.values()) {
job.cancel();
}
@ -423,7 +423,7 @@ public class IngestManager {
}
final String inputName = dataSource.getName();
DataSourceIngestTask ingestJob = new DataSourceIngestTask(IngestManager.this.getNextDataSourceTaskId(), dataSource, moduleTemplates, processUnallocatedSpace);
IngestJob ingestJob = new IngestJob(IngestManager.this.getNextDataSourceTaskId(), dataSource, moduleTemplates, processUnallocatedSpace);
List<IngestModuleError> errors = ingestJob.startUpIngestPipelines();
if (!errors.isEmpty()) {
@ -513,8 +513,8 @@ public class IngestManager {
return null;
}
DataSourceIngestTask ingestJob = scheduler.next();
DataSourceIngestTask.DataSourceIngestPipeline pipeline = ingestJob.getDataSourceIngestPipelineForThread(this.id);
IngestJob ingestJob = scheduler.next();
IngestJob.DataSourceIngestPipeline pipeline = ingestJob.getDataSourceIngestPipelineForThread(this.id);
pipeline.process(this, this.progress);
}
@ -588,7 +588,7 @@ public class IngestManager {
IngestScheduler.FileScheduler.FileTask task = fileScheduler.next();
AbstractFile file = task.getFile();
progress.progress(file.getName(), processedFiles);
DataSourceIngestTask.FileIngestPipeline pipeline = task.getParent().getFileIngestPipelineForThread(this.id);
IngestJob.FileIngestPipeline pipeline = task.getParent().getFileIngestPipelineForThread(this.id);
pipeline.process(file);
// Update the progress bar.
@ -610,6 +610,7 @@ public class IngestManager {
@Override
protected void done() {
// RJCTODO: Why was GC done here in the old code?
try {
super.get();
} catch (CancellationException | InterruptedException e) {

View File

@ -29,7 +29,7 @@ public interface IngestModule {
};
// RJCTODO: Write header comment, make sure to mention "one module instance per thread"
void startUp(IngestModuleContext context) throws Exception;
void startUp(IngestJobContext context) throws Exception;
// RJCTODO: Write header comment, make sure to mention "one module instance per thread"
void shutDown(boolean ingestJobWasCancelled);

View File

@ -25,7 +25,7 @@ package org.sleuthkit.autopsy.ingest;
public abstract class IngestModuleAdapter implements IngestModule {
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
}
@Override

View File

@ -22,7 +22,7 @@ package org.sleuthkit.autopsy.ingest;
* Encapsulates an exception thrown by an ingest module during an operation such
* as startup or shut down with an exception object for the error that occurred.
*/
class IngestModuleError {
final class IngestModuleError {
private final String moduleDisplayName;
private final Exception error;

View File

@ -81,7 +81,7 @@ public interface IngestModuleFactory {
*
* @return True if the factory provides resource configuration panels.
*/
boolean providesResourcesConfigPanels();
boolean providesGlobalSettingsPanel();
/**
* Gets a user interface panel that can be used to configure resources for
@ -104,7 +104,7 @@ public interface IngestModuleFactory {
* the panel.
* @return A user interface panel for configuring ingest module resources.
*/
IngestModuleGlobalSetttingsPanel getResourcesConfigPanel();
IngestModuleGlobalSetttingsPanel getGlobalSettingsPanel();
/**
* Gets the default per ingest job options for instances of the family of
@ -117,7 +117,7 @@ public interface IngestModuleFactory {
*
* @return The ingest options.
*/
IngestModuleSettings getDefaultIngestJobOptions();
IngestModuleSettings getDefaultModuleSettings();
/**
* Queries the factory to determine if it provides user interface panels to
@ -130,7 +130,7 @@ public interface IngestModuleFactory {
*
* @return True if the factory provides ingest job options panels.
*/
boolean providesIngestJobOptionsPanels();
boolean providesModuleSettingsPanel();
/**
* Gets a user interface panel that can be used to set per ingest job
@ -152,7 +152,7 @@ public interface IngestModuleFactory {
* @param ingestOptions Per ingest job options to initialize the panel.
* @return A user interface panel.
*/
IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestOptions);
IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestOptions);
/**
* Queries the factory to determine if it is capable of creating file ingest

View File

@ -34,27 +34,27 @@ public abstract class IngestModuleFactoryAdapter implements IngestModuleFactory
public abstract String getModuleVersionNumber();
@Override
public boolean providesResourcesConfigPanels() {
public boolean providesGlobalSettingsPanel() {
return false;
}
@Override
public IngestModuleGlobalSetttingsPanel getResourcesConfigPanel() {
public IngestModuleGlobalSetttingsPanel getGlobalSettingsPanel() {
throw new UnsupportedOperationException();
}
@Override
public IngestModuleSettings getDefaultIngestJobOptions() {
public IngestModuleSettings getDefaultModuleSettings() {
return new NoIngestModuleSettings();
}
@Override
public boolean providesIngestJobOptionsPanels() {
public boolean providesModuleSettingsPanel() {
return false;
}
@Override
public IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestOptions) {
public IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestOptions) {
throw new UnsupportedOperationException();
}

View File

@ -23,7 +23,7 @@ import javax.swing.JPanel;
/**
* Abstract base class for ingest module per ingest job options panels.
*/
public abstract class IngestModuleSettingsPanel extends JPanel {
public abstract class IngestModuleJobSettingsPanel extends JPanel {
/**
* Gets the ingest options for an ingest module.

View File

@ -35,13 +35,6 @@ final class IngestModuleLoader {
private final List<IngestModuleFactory> moduleFactories = new ArrayList<>();
private IngestModuleLoader() {
// RJCTODO: Possibly add code to listen to changes in the collection and restore listener code...
// RJCTODO: Need a name uniqueness test/solution?
Collection<? extends IngestModuleFactory> factories = Lookup.getDefault().lookupAll(IngestModuleFactory.class);
for (IngestModuleFactory factory : factories) {
logger.log(Level.INFO, "Found ingest module factory: name = {0}, version = {1}", new Object[]{factory.getModuleDisplayName(), factory.getModuleVersionNumber()});
moduleFactories.add(factory);
}
}
synchronized static IngestModuleLoader getInstance() {
@ -51,7 +44,14 @@ final class IngestModuleLoader {
return instance;
}
List<IngestModuleFactory> getIngestModuleFactories() {
synchronized List<IngestModuleFactory> getIngestModuleFactories() {
moduleFactories.clear();
// RJCTODO: Need a name uniqueness test/solution?
Collection<? extends IngestModuleFactory> factories = Lookup.getDefault().lookupAll(IngestModuleFactory.class);
for (IngestModuleFactory factory : factories) {
logger.log(Level.INFO, "Found ingest module factory: name = {0}, version = {1}", new Object[]{factory.getModuleDisplayName(), factory.getModuleVersionNumber()});
moduleFactories.add(factory);
}
return new ArrayList<>(moduleFactories);
}
}

View File

@ -26,12 +26,4 @@ import java.io.Serializable;
* application.
*/
public interface IngestModuleSettings extends Serializable {
// RJCTODO: Keep this as a shell if that works, otherwise go with Serializable
/**
* Determines whether the per ingest job options are valid.
*
* @return True if the options are valid, false otherwise.
*/
boolean areValid();
}

View File

@ -38,7 +38,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
*/
public final class IngestMonitor {
public static final int DISK_FREE_SPACE_UNKNOWN = -1; // RJCTODO: This is ugly
public static final int DISK_FREE_SPACE_UNKNOWN = -1;
private static final int INITIAL_INTERVAL_MS = 60000; //1 min.
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());
private Timer timer;
@ -102,7 +102,7 @@ public final class IngestMonitor {
return monitor.getFreeSpace();
} catch (SecurityException e) {
logger.log(Level.WARNING, "Error checking for free disk space on ingest data drive", e);
return IngestServices.DISK_FREE_SPACE_UNKNOWN;
return DISK_FREE_SPACE_UNKNOWN;
}
}
@ -183,7 +183,7 @@ public final class IngestMonitor {
//check if network drive, some network filesystems always return 0
final String monitoredPath = root.getAbsolutePath();
if (monitoredPath.startsWith("\\\\") || monitoredPath.startsWith("//")) {
return IngestServices.DISK_FREE_SPACE_UNKNOWN;
return DISK_FREE_SPACE_UNKNOWN;
}
}
@ -206,7 +206,7 @@ public final class IngestMonitor {
return true; //OK
}
if (freeSpace == IngestServices.DISK_FREE_SPACE_UNKNOWN) {
if (freeSpace == DISK_FREE_SPACE_UNKNOWN) {
return true;
} else {
//logger.log(Level.INFO, "Checking free disk apce: " + freeSpace + " need: " + Long.toString(MIN_FREE_DISK_SPACE));

View File

@ -148,11 +148,7 @@ final class IngestScheduler {
return sb.toString();
}
synchronized void scheduleIngestOfFiles(DataSourceIngestTask dataSourceTask) {
// RJCTODO: This should go to the ingest manager as the job manager?
// Save the data source task to manage its pipelines.
//dataSourceTasks.put(dataSourceTask.getId(), dataSourceTask);
synchronized void scheduleIngestOfFiles(IngestJob dataSourceTask) {
Content dataSource = dataSourceTask.getDataSource();
Collection<AbstractFile> rootObjects = dataSource.accept(new GetRootDirVisitor());
List<AbstractFile> firstLevelFiles = new ArrayList<>();
@ -188,7 +184,6 @@ final class IngestScheduler {
FileTask fileTask = new FileTask(firstLevelFile, dataSourceTask);
if (shouldEnqueueTask(fileTask)) {
rootDirectoryTasks.add(fileTask);
// RJCTODO: Increment DataSourceTask counters (not necesssary if scanninf)
}
}
@ -199,7 +194,6 @@ final class IngestScheduler {
updateQueues();
}
// RJCTODO:
/**
* Schedule a file to the file ingest, with associated modules. This
* will add the file to beginning of the file queue. The method is
@ -212,7 +206,7 @@ final class IngestScheduler {
* @param originalContext original content schedule context that was used
* to schedule the parent origin content, with the modules, settings, etc.
*/
synchronized void scheduleIngestOfDerivedFile(DataSourceIngestTask ingestJob, AbstractFile file) {
synchronized void scheduleIngestOfDerivedFile(IngestJob ingestJob, AbstractFile file) {
FileTask fileTask = new FileTask(file, ingestJob);
if (shouldEnqueueTask(fileTask)) {
fileTasks.addFirst(fileTask);
@ -221,7 +215,6 @@ final class IngestScheduler {
}
}
// RJCTODO: Used? If not anymore, why?
float getPercentageDone() {
if (filesEnqueuedEst == 0) {
return 0;
@ -229,7 +222,6 @@ final class IngestScheduler {
return ((100.f) * filesDequeued) / filesEnqueuedEst;
}
// RJCTODO: Used? If not anymore, why?
/**
* query num files enqueued total num of files to be enqueued.
*
@ -252,7 +244,6 @@ final class IngestScheduler {
return totalFiles;
}
// RJCTODO: Used? If not anymore, why?
/**
* get total est. number of files to be enqueued for current ingest
* input sources in queues
@ -263,7 +254,6 @@ final class IngestScheduler {
return filesEnqueuedEst;
}
// RJCTODO: Used? If not anymore, why?
/**
* Get number of files dequeued so far. This is reset after the same
* content is enqueued that is already in a queue
@ -462,14 +452,14 @@ final class IngestScheduler {
*/
static class FileTask {
private final AbstractFile file;
private final DataSourceIngestTask task;
private final IngestJob task;
public FileTask(AbstractFile file, DataSourceIngestTask task) {
public FileTask(AbstractFile file, IngestJob task) {
this.file = file;
this.task = task;
}
public DataSourceIngestTask getParent() { // RJCTODO: Provide wrappers to get rid of train-style calls
public IngestJob getParent() { // RJCTODO: Provide wrappers to get rid of train-style calls
return task;
}
@ -509,8 +499,8 @@ final class IngestScheduler {
if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) {
return false;
}
DataSourceIngestTask thisTask = this.getParent();
DataSourceIngestTask otherTask = other.getParent();
IngestJob thisTask = this.getParent();
IngestJob otherTask = other.getParent();
if (thisTask != otherTask
&& (thisTask == null || !thisTask.equals(otherTask))) {
@ -766,15 +756,15 @@ final class IngestScheduler {
/**
* DataSourceScheduler ingest scheduler
*/
static class DataSourceScheduler implements Iterator<DataSourceIngestTask> {
static class DataSourceScheduler implements Iterator<IngestJob> {
private LinkedList<DataSourceIngestTask> tasks;
private LinkedList<IngestJob> tasks;
DataSourceScheduler() {
tasks = new LinkedList<>();
}
synchronized void schedule(DataSourceIngestTask task) {
synchronized void schedule(IngestJob task) {
try {
if (task.getDataSource().getParent() != null) {
//only accepting parent-less content objects (Image, parentless VirtualDirectory)
@ -790,12 +780,12 @@ final class IngestScheduler {
}
@Override
public synchronized DataSourceIngestTask next() throws IllegalStateException {
public synchronized IngestJob next() throws IllegalStateException {
if (!hasNext()) {
throw new IllegalStateException("There is no data source tasks in the queue, check hasNext()");
}
final DataSourceIngestTask ret = tasks.pollFirst();
final IngestJob ret = tasks.pollFirst();
return ret;
}
@ -806,7 +796,7 @@ final class IngestScheduler {
*/
synchronized List<org.sleuthkit.datamodel.Content> getContents() {
List<org.sleuthkit.datamodel.Content> contents = new ArrayList<org.sleuthkit.datamodel.Content>();
for (DataSourceIngestTask task : tasks) {
for (IngestJob task : tasks) {
contents.add(task.getDataSource());
}
return contents;
@ -834,7 +824,7 @@ final class IngestScheduler {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("DataSourceQueue, size: ").append(getCount());
for (DataSourceIngestTask task : tasks) {
for (IngestJob task : tasks) {
sb.append(task.toString()).append(" ");
}
return sb.toString();

View File

@ -18,14 +18,10 @@
*/
package org.sleuthkit.autopsy.ingest;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
@ -34,7 +30,6 @@ import org.sleuthkit.datamodel.SleuthkitCase;
* singleton instance.
*/
public final class IngestServices {
public static final int DISK_FREE_SPACE_UNKNOWN = -1; // RJCTODO: Move this back to the monitor or ingest manager? It is used here...
private static final Logger logger = Logger.getLogger(IngestServices.class.getName());
private IngestManager manager;
@ -151,4 +146,6 @@ public final class IngestServices {
public long getFreeDiskSpace() {
return manager.getFreeDiskSpace();
}
// RJCTODO: Add properties methods back into IngestServices
}

View File

@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.ingest;
import javax.swing.event.ChangeEvent;
import org.sleuthkit.datamodel.Content;
// RJCTODO: Really?
// RJCTODO: Rename
/**
* Event data that are fired off by ingest modules when they changed or added new content.
*/

View File

@ -38,6 +38,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
*
* By design, only a single type of artifacts can be contained in a single data event.
*/
// RJCTODO: Rename
public class ModuleDataEvent extends ChangeEvent {
private String moduleName;

View File

@ -24,7 +24,7 @@ package org.sleuthkit.autopsy.ingest;
*/
public final class NoIngestModuleSettings implements IngestModuleSettings {
private final String options = "None";
private final String setting = "None";
/**
* Gets the string used as an ingest options placeholder for serialization
@ -32,12 +32,7 @@ public final class NoIngestModuleSettings implements IngestModuleSettings {
*
* @return The string "None"
*/
String getOptions() {
return options;
}
@Override
public boolean areValid() {
return true;
String getSetting() {
return setting;
}
}

View File

@ -65,7 +65,7 @@ public final class ExifParserFileIngestModule extends IngestModuleAdapter implem
}
@Override
public void startUp(org.sleuthkit.autopsy.ingest.IngestModuleContext context) throws Exception {
public void startUp(org.sleuthkit.autopsy.ingest.IngestJobContext context) throws Exception {
super.startUp(context);
services = IngestServices.getDefault();
logger.log(Level.INFO, "init() {0}", this.toString());

View File

@ -24,16 +24,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.AbstractTableModel;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
//import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
//import org.sleuthkit.autopsy.coreutils.Logger;
//import org.sleuthkit.autopsy.filetypeid.FileTypeIdIngestModule; RJCTODO
import org.sleuthkit.autopsy.filetypeid.FileTypeIdIngestModule;
/**
* Container panel for File Extension Mismatch Ingest Module advanced configuration options
@ -404,12 +401,11 @@ final class FileExtMismatchConfigPanel extends IngestModuleGlobalSetttingsPanel
return;
}
// RJCTODO
// if (!FileTypeIdIngestModule.isMimeTypeDetectable(newMime)) {
// mimeErrLabel.setForeground(Color.red);
// mimeErrLabel.setText("MIME type is not detectable by this module.");
// return;
// }
if (!FileTypeIdIngestModule.isMimeTypeDetectable(newMime)) {
mimeErrLabel.setForeground(Color.red);
mimeErrLabel.setText("MIME type is not detectable by this module.");
return;
}
editableMap.put(newMime, new String[0]);
@ -505,29 +501,27 @@ final class FileExtMismatchConfigPanel extends IngestModuleGlobalSetttingsPanel
@Override
public void load() {
// RJCTODO
// Load the XML into a buffer that the user can modify. They can choose
// to save it back to the file after making changes.
// editableMap = FileExtMismatchXML.getDefault().load();
editableMap = FileExtMismatchXML.getDefault().load();
updateMimeList();
updateExtList();
}
@Override
public void store() {
// RJCTODO
// if (FileExtMismatchXML.getDefault().save(editableMap)) {
// mimeErrLabel.setText(" ");
// mimeRemoveErrLabel.setText(" ");
// extRemoveErrLabel.setText(" ");
// extErrorLabel.setText(" ");
//
// saveMsgLabel.setText("Saved.");
// saveButton.setEnabled(false);
// } else {
// //error
// JOptionPane.showMessageDialog(this, "Writing XML configuration file failed.", "Save Error", JOptionPane.ERROR_MESSAGE);
// }
if (FileExtMismatchXML.getDefault().save(editableMap)) {
mimeErrLabel.setText(" ");
mimeRemoveErrLabel.setText(" ");
extRemoveErrLabel.setText(" ");
extErrorLabel.setText(" ");
saveMsgLabel.setText("Saved.");
saveButton.setEnabled(false);
} else {
//error
JOptionPane.showMessageDialog(this, "Writing XML configuration file failed.", "Save Error", JOptionPane.ERROR_MESSAGE);
}
}
private void setIsModified() {

View File

@ -24,7 +24,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
/**
@ -57,28 +57,28 @@ public class FileExtMismatchDetectorModuleFactory extends IngestModuleFactoryAda
}
@Override
public IngestModuleSettings getDefaultIngestJobOptions() {
public IngestModuleSettings getDefaultModuleSettings() {
return new FileExtMismatchDetectorOptions();
}
@Override
public boolean providesIngestJobOptionsPanels() {
public boolean providesModuleSettingsPanel() {
return true;
}
@Override
public IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestOptions) {
public IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestOptions) {
FileExtMismatchSimpleConfigPanel ingestOptionsPanel = new FileExtMismatchSimpleConfigPanel((FileExtMismatchDetectorOptions) ingestOptions);
return ingestOptionsPanel;
}
@Override
public boolean providesResourcesConfigPanels() {
public boolean providesGlobalSettingsPanel() {
return true;
}
@Override
public IngestModuleGlobalSetttingsPanel getResourcesConfigPanel() {
public IngestModuleGlobalSetttingsPanel getGlobalSettingsPanel() {
FileExtMismatchConfigPanel globalOptionsPanel = new FileExtMismatchConfigPanel();
globalOptionsPanel.load();
return globalOptionsPanel;

View File

@ -61,9 +61,4 @@ public class FileExtMismatchDetectorOptions implements IngestModuleSettings {
boolean getSkipFilesWithTextPlainMimeType() {
return skipFilesWithTextPlainMimeType;
}
@Override
public boolean areValid() {
return true;
}
}

View File

@ -58,7 +58,7 @@ public class FileExtMismatchIngestModule extends IngestModuleAdapter implements
}
@Override
public void startUp(org.sleuthkit.autopsy.ingest.IngestModuleContext context) throws Exception {
public void startUp(org.sleuthkit.autopsy.ingest.IngestJobContext context) throws Exception {
super.startUp(context);
services = IngestServices.getDefault();
FileExtMismatchXML xmlLoader = FileExtMismatchXML.getDefault();
@ -168,15 +168,17 @@ public class FileExtMismatchIngestModule extends IngestModuleAdapter implements
services.postMessage(IngestMessage.createMessage(++messageId, IngestMessage.MessageType.INFO, FileExtMismatchDetectorModuleFactory.getModuleName(), "File Extension Mismatch Results", detailsSb.toString()));
}
// RJCTODO: Ingest options!
// RJCTODO: Ingest setting
public void setSkipKnown(boolean flag) {
skipKnown = flag;
}
// RJCTODO: Ingest setting
public void setSkipNoExt(boolean flag) {
skipNoExt = flag;
}
// RJCTODO: Ingest setting
public void setSkipTextPlain(boolean flag) {
skipTextPlain = flag;
}

View File

@ -19,13 +19,13 @@
package org.sleuthkit.autopsy.fileextmismatch;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
/**
* UI component used to set ingest job options for file extension mismatch
* detector ingest modules.
*/
class FileExtMismatchSimpleConfigPanel extends IngestModuleSettingsPanel {
class FileExtMismatchSimpleConfigPanel extends IngestModuleJobSettingsPanel {
private FileExtMismatchDetectorOptions ingestJobOptions;

View File

@ -105,4 +105,14 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
detailsSb.append("</table>");
IngestServices.getDefault().postMessage(IngestMessage.createMessage(++messageId, IngestMessage.MessageType.INFO, FileTypeIdentifierModuleFactory.getModuleName(), "File Type Id Results", detailsSb.toString()));
}
/**
* Validate if a given mime type is in the detector's registry.
* @param mimeType Full string of mime type, e.g. "text/html"
* @return true if detectable
*/
public static boolean isMimeTypeDetectable(String mimeType) {
FileTypeDetectionInterface detector = new TikaFileTypeDetector();
return detector.isMimeTypeDetectable(mimeType);
}
}

View File

@ -19,13 +19,13 @@
package org.sleuthkit.autopsy.filetypeid;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
/**
* UI component used to set ingest job options for file type identifier ingest
* modules.
*/
class FileTypeIdSimpleConfigPanel extends IngestModuleSettingsPanel {
class FileTypeIdSimpleConfigPanel extends IngestModuleJobSettingsPanel {
private final FileTypeIdentifierIngestJobOptions ingestJobOptions;

View File

@ -41,9 +41,4 @@ public class FileTypeIdentifierIngestJobOptions implements IngestModuleSettings
boolean shouldSkipKnownFiles() {
return skipKnownFiles;
}
@Override
public boolean areValid() {
return true;
}
}

View File

@ -24,7 +24,7 @@ import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
/**
* An factory that creates file ingest modules that determine the types of
@ -56,17 +56,17 @@ public class FileTypeIdentifierModuleFactory extends IngestModuleFactoryAdapter
}
@Override
public IngestModuleSettings getDefaultIngestJobOptions() {
public IngestModuleSettings getDefaultModuleSettings() {
return new FileTypeIdentifierIngestJobOptions();
}
@Override
public boolean providesIngestJobOptionsPanels() {
public boolean providesModuleSettingsPanel() {
return true;
}
@Override
public IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestJobOptions) {
public IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestJobOptions) {
return new FileTypeIdSimpleConfigPanel((FileTypeIdentifierIngestJobOptions) ingestJobOptions);
}

View File

@ -32,11 +32,12 @@ import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.util.Lookup;
import org.openide.util.actions.Presenter;
import org.sleuthkit.autopsy.ingest.IngestConfigurator;
import org.sleuthkit.autopsy.ingest.IngestJobLauncher;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException;
import static org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.ingest.IngestManager;
/**
* Instances of this Action allow users to content to a hash database.
@ -81,8 +82,7 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter
super(SINGLE_SELECTION_NAME);
// Disable the menu if file ingest is in progress.
IngestConfigurator ingestConfigurator = Lookup.getDefault().lookup(IngestConfigurator.class);
if (null != ingestConfigurator && ingestConfigurator.isIngestRunning()) {
if (IngestManager.getDefault().isIngestRunning()) {
setEnabled(false);
return;
}

View File

@ -44,7 +44,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.datamodel.HashInfo;
// RJCTODO: Storeis for a) peristing context-sensitive module settings and b) adapt core modules to use module settings (more important)
// RJCTODO: Create stories for a) peristing context-sensitive module settings and b) adapt core modules to use module settings (more important)
public class HashDbIngestModule extends IngestModuleAdapter implements FileIngestModule {
private static final Logger logger = Logger.getLogger(HashDbIngestModule.class.getName());
private static final int MAX_COMMENT_SIZE = 500;
@ -63,7 +63,7 @@ public class HashDbIngestModule extends IngestModuleAdapter implements FileInges
}
@Override
public void startUp(org.sleuthkit.autopsy.ingest.IngestModuleContext context) throws Exception {
public void startUp(org.sleuthkit.autopsy.ingest.IngestJobContext context) throws Exception {
super.startUp(context);
services = IngestServices.getDefault();
skCase = Case.getCurrentCase().getSleuthkitCase();

View File

@ -33,12 +33,12 @@ import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
/**
* Instances of this class provide a simplified UI for managing the hash sets configuration.
*/
public class HashDbSimpleConfigPanel extends IngestModuleSettingsPanel {
public class HashDbSimpleConfigPanel extends IngestModuleJobSettingsPanel {
private HashDatabasesTableModel knownTableModel;
private HashDatabasesTableModel knownBadTableModel;
@ -77,7 +77,6 @@ public class HashDbSimpleConfigPanel extends IngestModuleSettingsPanel {
@Override
public IngestModuleSettings getIngestJobOptions() {
// RJCTODO: Work out how this works, load() and store(), etc.
HashDbManager hashDbManager = HashDbManager.getInstance();
List<HashDbManager.HashDb> knownFileHashSets = hashDbManager.getKnownFileHashSets();
List<HashDbManager.HashDb> knownBadFileHashSets = hashDbManager.getKnownBadFileHashSets();

View File

@ -25,7 +25,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
/**
@ -54,29 +54,29 @@ public class HashLookupModuleFactory extends IngestModuleFactoryAdapter {
}
@Override
public IngestModuleSettings getDefaultIngestJobOptions() {
public IngestModuleSettings getDefaultModuleSettings() {
return new HashLookupOptions();
}
@Override
public boolean providesIngestJobOptionsPanels() {
public boolean providesModuleSettingsPanel() {
return true;
}
@Override
public IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestOptions) {
public IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestOptions) {
HashDbSimpleConfigPanel ingestOptionsPanel = new HashDbSimpleConfigPanel();
ingestOptionsPanel.load();
return ingestOptionsPanel;
}
@Override
public boolean providesResourcesConfigPanels() {
public boolean providesGlobalSettingsPanel() {
return true;
}
@Override
public IngestModuleGlobalSetttingsPanel getResourcesConfigPanel() {
public IngestModuleGlobalSetttingsPanel getGlobalSettingsPanel() {
HashDbConfigPanel resourcesConfigPanel = new HashDbConfigPanel();
resourcesConfigPanel.load();
return resourcesConfigPanel;

View File

@ -28,6 +28,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
// Note that this class is not yet used as intended.
public class HashLookupOptions implements IngestModuleSettings {
// RJCTODO: These should not be handle objects, but names or files
private boolean shouldCalculateHashes = true;
private ArrayList<HashDbManager.HashDb> knownFileHashSets;
private ArrayList<HashDbManager.HashDb> knownBadFileHashSets;
@ -44,12 +45,6 @@ public class HashLookupOptions implements IngestModuleSettings {
this.knownBadFileHashSets = new ArrayList<>(knownBadFileHashSets);
}
@Override
public boolean areValid() {
// RJCTODO: Verify that hash sets are present in hash db manager
return true;
}
boolean shouldCalculateHashes() {
return shouldCalculateHashes;
}

View File

@ -21,9 +21,6 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.Date;
import java.util.List;
/**
* RJCTODO
*/
public class KeywordList {
private String name;

View File

@ -54,7 +54,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
import org.sleuthkit.datamodel.BlackboardArtifact;
@ -117,8 +117,6 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
private volatile int messageID = 0;
private boolean processedFiles;
private volatile boolean finalSearcherDone = true; //mark as done, until it's inited
private final String hashDBModuleName = NbBundle
.getMessage(this.getClass(), "KeywordSearchIngestModule.hashDbModuleName"); //NOTE this needs to match the HashDB module getName()
private SleuthkitCase caseHandle = null;
private static List<AbstractFileExtract> textExtractors;
private static AbstractFileStringExtract stringExtractor;
@ -161,15 +159,6 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
return ResultCode.OK;
}
// RJCTODO: Resolve this
//check if we should index meta-data only when 1) it is known 2) HashDb module errored on it
// if (services.getAbstractFileModuleResult(hashDBModuleName) == ResultCode.ERROR) {
// indexer.indexFile(abstractFile, false);
// //notify depending module that keyword search (would) encountered error for this file
// ingestStatus.put(abstractFile.getId(), IngestStatus.SKIPPED_ERROR_IO);
// return ResultCode.ERROR;
// }
// else if (KeywordSearchSettings.getSkipKnown() && abstractFile.getKnown().equals(FileKnown.KNOWN)) {
if (KeywordSearchSettings.getSkipKnown() && abstractFile.getKnown().equals(FileKnown.KNOWN)) {
//index meta-data only
indexer.indexFile(abstractFile, false);
@ -298,7 +287,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAdapter impleme
*
*/
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
super.startUp(context);
logger.log(Level.INFO, "init()");
services = IngestServices.getDefault();

View File

@ -28,13 +28,13 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
import org.sleuthkit.autopsy.ingest.NoIngestModuleSettings;
/**
* Ingest job options panel for the keyword search file ingest module.
*/
public class KeywordSearchIngestSimplePanel extends IngestModuleSettingsPanel {
public class KeywordSearchIngestSimplePanel extends IngestModuleJobSettingsPanel {
private final static Logger logger = Logger.getLogger(KeywordSearchIngestSimplePanel.class.getName());
public static final String PROP_OPTIONS = "Keyword Search_Options";

View File

@ -37,9 +37,9 @@ import java.util.logging.Level;
*/
abstract class KeywordSearchListsAbstract {
protected String filePath; // RJCTODO: Doubt this needs to be protected
Map<String, KeywordList> theLists; //the keyword data // RJCTODO: This shuld be used to accumulate the lists read in
static KeywordSearchListsXML currentInstance = null; // RJCTODO: This is inappropriate for a reader
protected String filePath;
Map<String, KeywordList> theLists; //the keyword data
static KeywordSearchListsXML currentInstance = null;
private static final String CUR_LISTS_FILE_NAME = "keywords.xml"; // RJCTODO: This will go to the manager
private static String CUR_LISTS_FILE = PlatformUtil.getUserConfigDirectory() + File.separator + CUR_LISTS_FILE_NAME; // RJCTODO: This will go to the manager
protected static final Logger logger = Logger.getLogger(KeywordSearchListsAbstract.class.getName());

View File

@ -26,7 +26,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleJobSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
/**
@ -55,24 +55,24 @@ public class KeywordSearchModuleFactory extends IngestModuleFactoryAdapter {
}
@Override
public boolean providesIngestJobOptionsPanels() {
public boolean providesModuleSettingsPanel() {
return true;
}
@Override
public IngestModuleSettingsPanel getIngestJobOptionsPanel(IngestModuleSettings ingestJobOptions) {
public IngestModuleJobSettingsPanel getModuleSettingsPanel(IngestModuleSettings ingestJobOptions) {
KeywordSearchIngestSimplePanel ingestOptionsPanel = new KeywordSearchIngestSimplePanel();
ingestOptionsPanel.load();
return ingestOptionsPanel;
}
@Override
public boolean providesResourcesConfigPanels() {
public boolean providesGlobalSettingsPanel() {
return true;
}
@Override
public IngestModuleGlobalSetttingsPanel getResourcesConfigPanel() {
public IngestModuleGlobalSetttingsPanel getGlobalSettingsPanel() {
KeywordSearchConfigurationPanel globalOptionsPanel = new KeywordSearchConfigurationPanel();
globalOptionsPanel.load();
return globalOptionsPanel;

View File

@ -36,7 +36,7 @@ import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.autopsy.ingest.IngestModule.ResultCode;
import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
/**
* Recent activity image ingest module
@ -140,7 +140,7 @@ public final class RAImageIngestModule extends IngestModuleAdapter implements Da
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
services = IngestServices.getDefault();
Extract registry = new ExtractRegistry();
@ -155,7 +155,7 @@ public final class RAImageIngestModule extends IngestModuleAdapter implements Da
extracters.add(iexplore);
extracters.add(recentDocuments);
extracters.add(SEUQA); // this needs to run after the web browser modules
extracters.add(registry); // this runs last because it is slowest // RJCTODO: Why?
extracters.add(registry); // this runs last because it is slowest
browserExtracters.add(chrome);
browserExtracters.add(firefox);

View File

@ -28,7 +28,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
import org.sleuthkit.autopsy.scalpel.jni.ScalpelOutputParser.CarvedFileMeta;
@ -57,7 +57,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
private String configFilePath;
private boolean initialized = false;
private ScalpelCarver carver;
private IngestModuleContext context;
private IngestJobContext context;
ScalpelCarverIngestModule() {
}
@ -189,7 +189,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
this.context = context;
// make sure this is Windows

View File

@ -56,7 +56,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.ingest.IngestModule.ResultCode;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
/**
* 7Zip ingest module Extracts supported archives, adds extracted DerivedFiles,
@ -85,13 +85,13 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
private static final int readHeaderSize = 4;
private final byte[] fileHeaderBuffer = new byte[readHeaderSize];
private static final int ZIP_SIGNATURE_BE = 0x504B0304;
private IngestModuleContext context;
private IngestJobContext context;
SevenZipIngestModule() {
}
@Override
public void startUp(IngestModuleContext context) throws Exception{
public void startUp(IngestJobContext context) throws Exception{
this.context = context;
unpackDir = context.getOutputDirectoryRelativePath();
unpackDirPath = context.getOutputDirectoryAbsolutePath();

View File

@ -37,7 +37,7 @@ public class EwfVerifierModuleFactory extends IngestModuleFactoryAdapter {
}
static String getModuleName() {
return "EWF Verify"; // RJCTODO: Is this what we want here? Also, this class is not in pipeline config
return "EWF Verifier";
}
@Override

View File

@ -34,7 +34,7 @@ import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
/**
* Data source ingest module that verifies the integrity of an Expert Witness
@ -45,11 +45,11 @@ public class EwfVerifyIngestModule extends IngestModuleAdapter implements DataSo
private static final Logger logger = Logger.getLogger(EwfVerifyIngestModule.class.getName());
private static final long DEFAULT_CHUNK_SIZE = 32 * 1024;
private static final IngestServices services = IngestServices.getDefault();
private IngestModuleContext context;
private IngestJobContext context;
private Image img;
private String imgName;
private MessageDigest messageDigest;
private static int messageId = 0; // RJCTODO: Copy-paste synchronized implementation, put in sample also
private static int messageId = 0; // RJCTODO: Not thread safe
private boolean verified = false;
private boolean skipped = false;
private String calculatedHash = "";
@ -59,7 +59,7 @@ public class EwfVerifyIngestModule extends IngestModuleAdapter implements DataSo
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
this.context = context;
verified = false;
skipped = false;
@ -140,7 +140,7 @@ public class EwfVerifyIngestModule extends IngestModuleAdapter implements DataSo
// Read in byte size chunks and update the hash value with the data.
for (int i = 0; i < totalChunks; i++) {
if (statusHelper.isCancelled()) {
return ResultCode.OK; // RJCTODO: Use unknown?
return ResultCode.OK;
}
data = new byte[ (int) chunkSize ];
try {

View File

@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestModule.ResultCode;
import org.sleuthkit.autopsy.ingest.IngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleContext;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
@ -52,10 +52,9 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
private static final Logger logger = Logger.getLogger(ThunderbirdMboxFileIngestModule.class.getName());
private IngestServices services;
private final String hashDBModuleName = "Hash Lookup";
private int messageId = 0; // RJCTODO: Not thread safe
private FileManager fileManager;
private IngestModuleContext context;
private IngestJobContext context;
ThunderbirdMboxFileIngestModule() {
}
@ -248,7 +247,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
}
@Override
public void startUp(IngestModuleContext context) throws Exception {
public void startUp(IngestJobContext context) throws Exception {
this.context = context;
services = IngestServices.getDefault();
fileManager = Case.getCurrentCase().getServices().getFileManager();