Merge branch 'develop' of github.com:sleuthkit/autopsy into 7276_hostPersonEvents

This commit is contained in:
Greg DiCristofaro 2021-03-03 19:08:38 -05:00
commit cde9ab3d5a
7 changed files with 153 additions and 242 deletions

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2018 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -51,8 +51,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* independently of the wizard.
*/
@ServiceProviders(value = {
@ServiceProvider(service = DataSourceProcessor.class)
,
@ServiceProvider(service = DataSourceProcessor.class),
@ServiceProvider(service = AutoIngestDataSourceProcessor.class)}
)
public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSourceProcessor {
@ -83,7 +82,6 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
private String sha1;
private String sha256;
private Host host = null;
private boolean setDataSourceOptionsCalled;
static {
filtersList.add(allFilter);
@ -223,19 +221,19 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
/**
* Adds a data source to the case database using a background task in a
* separate thread and the settings provided by the selection and
* configuration panel. Files found during ingest will be sent directly to the
* IngestStream provided. Returns as soon as the background task is started.
* The background task uses a callback object to signal task completion and
* return results.
* configuration panel. Files found during ingest will be sent directly to
* the IngestStream provided. Returns as soon as the background task is
* started. The background task uses a callback object to signal task
* completion and return results.
*
* This method should not be called unless isPanelValid returns true, and
* should only be called for DSPs that support ingest streams.
*
* @param settings The ingest job settings.
* @param progress Progress monitor that will be used by the
* background task to report progress.
* @param callBack Callback that will be used by the background task
* to return results.
* @param progress Progress monitor that will be used by the background task
* to report progress.
* @param callBack Callback that will be used by the background task to
* return results.
*/
@Override
public void runWithIngestStream(IngestJobSettings settings, DataSourceProcessorProgressMonitor progress,
@ -246,20 +244,20 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
/**
* Adds a data source to the case database using a background task in a
* separate thread and the settings provided by the selection and
* configuration panel. Files found during ingest will be sent directly to the
* IngestStream provided. Returns as soon as the background task is started.
* The background task uses a callback object to signal task completion and
* return results.
* configuration panel. Files found during ingest will be sent directly to
* the IngestStream provided. Returns as soon as the background task is
* started. The background task uses a callback object to signal task
* completion and return results.
*
* This method should not be called unless isPanelValid returns true, and
* should only be called for DSPs that support ingest streams.
*
* @param host The host for this data source.
* @param settings The ingest job settings.
* @param progress Progress monitor that will be used by the
* background task to report progress.
* @param callBack Callback that will be used by the background task
* to return results.
* @param progress Progress monitor that will be used by the background task
* to report progress.
* @param callBack Callback that will be used by the background task to
* return results.
*/
@Override
public void runWithIngestStream(Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progress,
@ -292,7 +290,6 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
return;
}
doAddImageProcess(deviceId, imagePath, sectorSize, timeZone, ignoreFatOrphanFiles, md5, sha1, sha256, progress, callBack);
}
@ -300,7 +297,6 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
* Store the options from the config panel.
*/
private void readConfigSettings() {
if (!setDataSourceOptionsCalled) {
configPanel.storeSettings();
deviceId = UUID.randomUUID().toString();
imagePath = configPanel.getContentPaths();
@ -320,7 +316,6 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
sha256 = null;
}
}
}
/**
* Check if this DSP supports ingest streams.
@ -376,8 +371,8 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
* is started and uses the callback object to signal task completion and
* return results.
*
* The image should be loaded in the database and stored in "image"
* before calling this method. Additionally, an ingest stream should be initialized
* The image should be loaded in the database and stored in "image" before
* calling this method. Additionally, an ingest stream should be initialized
* and stored in "ingestStream".
*
* @param deviceId An ASCII-printable identifier for the device
@ -455,7 +450,6 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
ignoreFatOrphanFiles = false;
host = null;
configPanel.reset();
setDataSourceOptionsCalled = false;
}
private static boolean isAcceptedByFiler(File file, List<FileFilter> filters) {
@ -496,13 +490,13 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
@Override
public void process(String deviceId, Path dataSourcePath, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
// this method does not use the config panel
this.deviceId = deviceId;
this.imagePath = dataSourcePath.toString();
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.host = host;
this.ignoreFatOrphanFiles = false;
setDataSourceOptionsCalled = true;
ingestStream = new DefaultIngestStream();
try {
@ -526,13 +520,13 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
@Override
public IngestStream processWithIngestStream(String deviceId, Path dataSourcePath, Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) {
// this method does not use the config panel
this.deviceId = deviceId;
this.imagePath = dataSourcePath.toString();
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.host = host;
this.ignoreFatOrphanFiles = false;
setDataSourceOptionsCalled = true;
// Set up the data source before creating the ingest stream
try {
@ -558,31 +552,7 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
}
doAddImageProcess(deviceId, dataSourcePath.toString(), sectorSize, timeZone, ignoreFatOrphanFiles, null, null, null, progressMonitor, callBack);
return ingestStream;
}
/**
* Sets the configuration of the data source processor without using the
* selection and configuration panel.
*
* @param imagePath Path to the image file.
* @param timeZone The time zone to use when processing dates
* and times for the image, obtained from
* java.util.TimeZone.getID.
* @param ignoreFatOrphanFiles Whether to parse orphans if the image has a
* FAT filesystem.
*
* @deprecated Use the provided overload of the run method instead.
*/
@Deprecated
public void setDataSourceOptions(String imagePath, String timeZone, boolean ignoreFatOrphanFiles) {
this.deviceId = UUID.randomUUID().toString();
this.imagePath = imagePath;
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.ignoreFatOrphanFiles = ignoreFatOrphanFiles;
this.host = null;
setDataSourceOptionsCalled = true;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2018 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.casemodule;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
@ -60,7 +59,6 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
private Host host;
private ImageWriterSettings imageWriterSettings;
private boolean ignoreFatOrphanFiles;
private boolean setDataSourceOptionsCalled;
/**
* Constructs a local drive data source processor that implements the
@ -157,7 +155,6 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
*/
@Override
public void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
if (!setDataSourceOptionsCalled) {
deviceId = UUID.randomUUID().toString();
drivePath = configPanel.getContentPath();
sectorSize = configPanel.getSectorSize();
@ -168,7 +165,6 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
} else {
imageWriterSettings = null;
}
}
this.host = host;
@ -285,30 +281,5 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
drivePath = null;
timeZone = null;
ignoreFatOrphanFiles = false;
setDataSourceOptionsCalled = false;
}
/**
* Sets the configuration of the data source processor without using the
* configuration panel.
*
* @param drivePath Path to the local drive.
* @param timeZone The time zone to use when processing dates
* and times for the local drive, obtained from
* java.util.TimeZone.getID.
* @param ignoreFatOrphanFiles Whether to parse orphans if the image has a
* FAT filesystem.
*
* @deprecated Use the provided overload of the run method instead.
*/
@Deprecated
public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) {
this.deviceId = UUID.randomUUID().toString();
this.drivePath = drivePath;
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.ignoreFatOrphanFiles = ignoreFatOrphanFiles;
setDataSourceOptionsCalled = true;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -78,7 +78,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
* when the deprecated method setDataSourceOptions is removed.
*/
private List<String> localFilePaths;
private boolean setDataSourceOptionsCalled;
/**
* Constructs a local/logical files and/or directories data source processor
@ -175,7 +174,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
*/
@Override
public void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
if (!setDataSourceOptionsCalled) {
localFilePaths = configPanel.getContentPaths();
if (configPanel.subTypeIsLogicalEvidencePanel()) {
@ -193,7 +191,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
return;
}
}
}
run(UUID.randomUUID().toString(), configPanel.getFileSetName(), localFilePaths, host, progressMonitor, callback);
}
@ -385,7 +382,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
public void reset() {
configPanel.select();
localFilePaths = null;
setDataSourceOptionsCalled = false;
}
@Override
@ -428,27 +424,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
run(deviceId, "", filePaths, host, progressMonitor, callBack);
}
/**
* Sets the configuration of the data source processor without using the
* configuration panel. The data source processor will assign a UUID to the
* data source and will use the time zone of the machine executing this code
* when when processing dates and times for the image.
*
* @param paths A list of local/logical file and/or directory
* localFilePaths.
*
* @deprecated Use the provided overload of the run method instead.
*/
@Deprecated
public void setDataSourceOptions(String paths) {
// The LocalFilesPanel used to separate file paths with a comma and pass
// them as a string, but because file names are allowed to contain
// commas, this approach was buggy and replaced. We now pass a list of
// String paths.
this.localFilePaths = Arrays.asList(paths.split(","));
setDataSourceOptionsCalled = true;
}
/**
* A custom exception for the L01 processing.
*/

View File

@ -29,7 +29,6 @@ import javax.swing.filechooser.FileFilter;
import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.ServiceProvider;
import org.openide.util.lookup.ServiceProviders;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;

View File

@ -93,17 +93,13 @@ public class DomainSummaryViewer extends javax.swing.JPanel {
* reflect the currently selected domain. Will populate the list with
* nothing when a domain is not used.
*
* @param useDomain If the currently selected domain should be used to
* retrieve a list.
*/
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
void sendPopulateEvent(boolean useDomain) {
void sendPopulateEvent() {
String domain = "";
if (useDomain) {
if (domainList.getSelectedIndex() != -1) {
domain = domainListModel.getElementAt(domainList.getSelectedIndex()).getResultDomain().getDomain();
}
}
//send populateMesage
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateDomainTabsEvent(domain));
}

View File

@ -128,8 +128,8 @@ final class ResultsPanel extends javax.swing.JPanel {
}
});
domainSummaryViewer.addListSelectionListener((e) -> {
if (resultType == SearchData.Type.DOMAIN) {
domainSummaryViewer.sendPopulateEvent(!e.getValueIsAdjusting());
if (resultType == SearchData.Type.DOMAIN && !e.getValueIsAdjusting()) {
domainSummaryViewer.sendPopulateEvent();
}
});
}

View File

@ -34,7 +34,7 @@ public class DomainSearchTestUtils {
long totalVisits, long visits, long filesDownloaded, long dataSourceId) {
Content dataSource = TskMockUtils.getDataSource(dataSourceId);
return new ResultDomain(domain, start, end, totalVisits,
visits, filesDownloaded, 0L, dataSource);
visits, filesDownloaded, 0L, "", dataSource);
}
public static ResultDomain mockDomainResult(String domain) {