mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
AutomatedIngestDataSourceProcessor interface methods throw exception
This commit is contained in:
parent
0fbde22ee0
commit
e0a75cf9fb
@ -160,6 +160,7 @@ GeneralFilter.encaseImageDesc.text=Encase Images (*.e01)
|
|||||||
GeneralFilter.virtualMachineImageDesc.text=Virtual Machines (*.vmdk, *.vhd)
|
GeneralFilter.virtualMachineImageDesc.text=Virtual Machines (*.vmdk, *.vhd)
|
||||||
ImageDSProcessor.dsType.text=Image or VM File
|
ImageDSProcessor.dsType.text=Image or VM File
|
||||||
ImageDSProcessor.allDesc.text=All Supported Types
|
ImageDSProcessor.allDesc.text=All Supported Types
|
||||||
|
ImageDSProcessor.canProcess.exception.text=Exception inside canProcess() method
|
||||||
ImageFilePanel.moduleErr=Module Error
|
ImageFilePanel.moduleErr=Module Error
|
||||||
ImageFilePanel.moduleErr.msg=A module caused an error listening to ImageFilePanel updates. See log to determine which module. Some data could be incomplete.
|
ImageFilePanel.moduleErr.msg=A module caused an error listening to ImageFilePanel updates. See log to determine which module. Some data could be incomplete.
|
||||||
LocalDiskDSProcessor.dsType.text=Local Disk
|
LocalDiskDSProcessor.dsType.text=Local Disk
|
||||||
|
@ -248,7 +248,7 @@ public class ImageDSProcessor implements AutomatedIngestDataSourceProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int canProcess(Path dataSourcePath) {
|
public int canProcess(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException {
|
||||||
|
|
||||||
// check file extension for supported types
|
// check file extension for supported types
|
||||||
if (!isAcceptedByFiler(dataSourcePath.toFile(), filtersList)) {
|
if (!isAcceptedByFiler(dataSourcePath.toFile(), filtersList)) {
|
||||||
@ -262,9 +262,8 @@ public class ImageDSProcessor implements AutomatedIngestDataSourceProcessor {
|
|||||||
// image does not have a file system that TSK can process
|
// image does not have a file system that TSK can process
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ex) {
|
||||||
// ELTODO do we want to have error message here?
|
throw new AutomatedIngestDataSourceProcessorException(NbBundle.getMessage(ImageDSProcessor.class, "ImageDSProcessor.canProcess.exception.text"), ex);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// able to process the data source
|
// able to process the data source
|
||||||
@ -272,8 +271,7 @@ public class ImageDSProcessor implements AutomatedIngestDataSourceProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
|
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutomatedIngestDataSourceProcessorException {
|
||||||
|
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
this.imagePath = dataSourcePath.toString();
|
this.imagePath = dataSourcePath.toString();
|
||||||
this.timeZone = Calendar.getInstance().getTimeZone().getID();
|
this.timeZone = Calendar.getInstance().getTimeZone().getID();
|
||||||
|
@ -205,7 +205,7 @@ public class LocalFilesDSProcessor implements AutomatedIngestDataSourceProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int canProcess(Path dataSourcePath) {
|
public int canProcess(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException {
|
||||||
// Local files DSP can process any file by simply adding it as a logical file.
|
// Local files DSP can process any file by simply adding it as a logical file.
|
||||||
// It should return lowest possible non-zero confidence level and be treated
|
// It should return lowest possible non-zero confidence level and be treated
|
||||||
// as the "option of last resort" for auto ingest purposes
|
// as the "option of last resort" for auto ingest purposes
|
||||||
@ -213,7 +213,7 @@ public class LocalFilesDSProcessor implements AutomatedIngestDataSourceProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
|
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutomatedIngestDataSourceProcessorException {
|
||||||
this.localFilePaths = Arrays.asList(new String[]{dataSourcePath.toString()});
|
this.localFilePaths = Arrays.asList(new String[]{dataSourcePath.toString()});
|
||||||
run(deviceId, AUTO_INGEST_VIRTUAL_DIR_NAME, this.localFilePaths, progressMonitor, callBack);
|
run(deviceId, AUTO_INGEST_VIRTUAL_DIR_NAME, this.localFilePaths, progressMonitor, callBack);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import java.nio.file.Path;
|
|||||||
*
|
*
|
||||||
* @author elivis
|
* @author elivis
|
||||||
*/
|
*/
|
||||||
public interface AutomatedIngestDataSourceProcessor extends DataSourceProcessor{
|
public interface AutomatedIngestDataSourceProcessor extends DataSourceProcessor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the DataSourceProcessor is capable of processing the
|
* Indicates whether the DataSourceProcessor is capable of processing the
|
||||||
@ -38,8 +38,11 @@ public interface AutomatedIngestDataSourceProcessor extends DataSourceProcessor{
|
|||||||
* or less means the data source is not supported by the
|
* or less means the data source is not supported by the
|
||||||
* DataSourceProcessor. Value of 100 indicates high certainty in
|
* DataSourceProcessor. Value of 100 indicates high certainty in
|
||||||
* being able to process the data source.
|
* being able to process the data source.
|
||||||
|
*
|
||||||
|
* @throws
|
||||||
|
* org.sleuthkit.autopsy.corecomponentinterfaces.AutomatedIngestDataSourceProcessor.AutomatedIngestDataSourceProcessorException
|
||||||
*/
|
*/
|
||||||
int canProcess(Path dataSourcePath);
|
int canProcess(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -51,6 +54,25 @@ public interface AutomatedIngestDataSourceProcessor extends DataSourceProcessor{
|
|||||||
* background task to report progress.
|
* background task to report progress.
|
||||||
* @param callBack Callback that will be used by the background task
|
* @param callBack Callback that will be used by the background task
|
||||||
* to return results.
|
* to return results.
|
||||||
|
*
|
||||||
|
* @throws
|
||||||
|
* org.sleuthkit.autopsy.corecomponentinterfaces.AutomatedIngestDataSourceProcessor.AutomatedIngestDataSourceProcessorException
|
||||||
*/
|
*/
|
||||||
void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack);
|
void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutomatedIngestDataSourceProcessorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom exception for the use of AutomatedIngestDataSourceProcessor.
|
||||||
|
*/
|
||||||
|
public class AutomatedIngestDataSourceProcessorException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public AutomatedIngestDataSourceProcessorException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutomatedIngestDataSourceProcessorException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2103,7 +2103,12 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
|||||||
AutomatedIngestDataSourceProcessor selectedProcessor = null;
|
AutomatedIngestDataSourceProcessor selectedProcessor = null;
|
||||||
int selectedProcessorConfidence = 0;
|
int selectedProcessorConfidence = 0;
|
||||||
for (AutomatedIngestDataSourceProcessor processor : processorCandidates) {
|
for (AutomatedIngestDataSourceProcessor processor : processorCandidates) {
|
||||||
int confidence = processor.canProcess(dataSource.getPath());
|
int confidence = 0;
|
||||||
|
try {
|
||||||
|
confidence = processor.canProcess(dataSource.getPath());
|
||||||
|
} catch (AutomatedIngestDataSourceProcessor.AutomatedIngestDataSourceProcessorException ex) {
|
||||||
|
// ELTODO : log and auto-pause
|
||||||
|
}
|
||||||
if (confidence > selectedProcessorConfidence) {
|
if (confidence > selectedProcessorConfidence) {
|
||||||
selectedProcessor = processor;
|
selectedProcessor = processor;
|
||||||
selectedProcessorConfidence = confidence;
|
selectedProcessorConfidence = confidence;
|
||||||
@ -2119,8 +2124,12 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
|||||||
|
|
||||||
synchronized (ingestLock) {
|
synchronized (ingestLock) {
|
||||||
LOGGER.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()});
|
LOGGER.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()});
|
||||||
// ELTODO add sys log and possibly case log entries here
|
try {
|
||||||
selectedProcessor.process(dataSource.getDeviceId(), dataSource.getPath(), progressMonitor, callBack);
|
// ELTODO add sys log and possibly case log entries here
|
||||||
|
selectedProcessor.process(dataSource.getDeviceId(), dataSource.getPath(), progressMonitor, callBack);
|
||||||
|
} catch (AutomatedIngestDataSourceProcessor.AutomatedIngestDataSourceProcessorException ex) {
|
||||||
|
// ELTODO : log and auto-pause
|
||||||
|
}
|
||||||
ingestLock.wait();
|
ingestLock.wait();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -25,3 +25,4 @@ CellebriteLogicalReportPanel.jLabel1.text=Input type:
|
|||||||
CellebriteLogicalReportPanel.jHandsetRadioButton.text=Handset
|
CellebriteLogicalReportPanel.jHandsetRadioButton.text=Handset
|
||||||
CellebriteLogicalReportPanel.browseButton.text=Browse
|
CellebriteLogicalReportPanel.browseButton.text=Browse
|
||||||
CellebriteLogicalReportPanel.pathTextField.text=
|
CellebriteLogicalReportPanel.pathTextField.text=
|
||||||
|
CellebritePhysicalReportProcessor.canProcess.exception.text=Exception inside canProcess() method
|
||||||
|
@ -250,7 +250,7 @@ public class CellebriteLogicalReportProcessor implements AutomatedIngestDataSour
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int canProcess(Path dataSourcePath) {
|
public int canProcess(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException {
|
||||||
ReportType type = parseCellebriteLogicalReportType(dataSourcePath);
|
ReportType type = parseCellebriteLogicalReportType(dataSourcePath);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CELLEBRITE_LOGICAL_HANDSET:
|
case CELLEBRITE_LOGICAL_HANDSET:
|
||||||
@ -263,7 +263,7 @@ public class CellebriteLogicalReportProcessor implements AutomatedIngestDataSour
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
|
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutomatedIngestDataSourceProcessorException {
|
||||||
ReportType type = parseCellebriteLogicalReportType(dataSourcePath);
|
ReportType type = parseCellebriteLogicalReportType(dataSourcePath);
|
||||||
boolean isHandsetFile = false;
|
boolean isHandsetFile = false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -37,7 +37,7 @@ import java.util.zip.ZipFile;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
import org.openide.util.lookup.ServiceProviders;
|
import org.openide.util.lookup.ServiceProviders;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
@ -256,19 +256,7 @@ public class CellebritePhysicalReportProcessor implements AutomatedIngestDataSou
|
|||||||
|
|
||||||
private static boolean isValidDataSource(Path dataSourcePath) {
|
private static boolean isValidDataSource(Path dataSourcePath) {
|
||||||
|
|
||||||
String fileName = dataSourcePath.getFileName().toString();
|
String fileName = dataSourcePath.getFileName().toString();
|
||||||
|
|
||||||
// check whether it's a zip archive file
|
|
||||||
if (isAcceptedByFiler(new File(fileName), archiveFilters)) {
|
|
||||||
try {
|
|
||||||
Case currentCase = Case.getCurrentCase();
|
|
||||||
Path extractedDataSource = extractDataSource(Paths.get(currentCase.getModuleDirectory()), dataSourcePath);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// ELTODO add log here?
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// is it a ".bin" image
|
// is it a ".bin" image
|
||||||
if (!isAcceptedByFiler(new File(fileName), cellebriteImageFiltersList)) {
|
if (!isAcceptedByFiler(new File(fileName), cellebriteImageFiltersList)) {
|
||||||
return false;
|
return false;
|
||||||
@ -298,12 +286,27 @@ public class CellebritePhysicalReportProcessor implements AutomatedIngestDataSou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isArchive(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException {
|
||||||
|
|
||||||
|
String fileName = dataSourcePath.getFileName().toString();
|
||||||
|
// check whether it's a zip archive file
|
||||||
|
if (isAcceptedByFiler(new File(fileName), archiveFilters)) {
|
||||||
|
try {
|
||||||
|
Case currentCase = Case.getCurrentCase();
|
||||||
|
Path extractedDataSource = extractDataSource(Paths.get(currentCase.getModuleDirectory()), dataSourcePath);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new AutomatedIngestDataSourceProcessorException(NbBundle.getMessage(CellebritePhysicalReportProcessor.class, "CellebritePhysicalReportProcessor.canProcess.exception.text"), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int canProcess(Path dataSourcePath) {
|
public int canProcess(Path dataSourcePath) throws AutomatedIngestDataSourceProcessorException {
|
||||||
// check whether this is a ".bin" file
|
// check whether this is an archive or a ".bin" file
|
||||||
if (isValidDataSource(dataSourcePath)) {
|
if (isArchive(dataSourcePath) || isValidDataSource(dataSourcePath)) {
|
||||||
// return "high confidence" value
|
// return "high confidence" value
|
||||||
return 90;
|
return 90;
|
||||||
}
|
}
|
||||||
@ -311,7 +314,7 @@ public class CellebritePhysicalReportProcessor implements AutomatedIngestDataSou
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
|
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutomatedIngestDataSourceProcessorException {
|
||||||
List<String> dataSourcePathList = Arrays.asList(new String[]{dataSourcePath.toString()});
|
List<String> dataSourcePathList = Arrays.asList(new String[]{dataSourcePath.toString()});
|
||||||
// in this particular case we don't want to call run() method as it will try to identify and process all ".bin" files in data source folder
|
// in this particular case we don't want to call run() method as it will try to identify and process all ".bin" files in data source folder
|
||||||
addImagesTask = new AddCellebritePhysicalReportTask(deviceId, dataSourcePathList, "", progressMonitor, callBack);
|
addImagesTask = new AddCellebritePhysicalReportTask(deviceId, dataSourcePathList, "", progressMonitor, callBack);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user