19package org.sleuthkit.autopsy.casemodule;
22import java.nio.file.Path;
23import javax.swing.JPanel;
24import java.util.ArrayList;
25import java.util.Calendar;
27import java.util.logging.Level;
29import java.util.Objects;
30import javax.swing.filechooser.FileFilter;
31import org.openide.util.NbBundle;
32import org.openide.util.lookup.ServiceProvider;
33import org.openide.util.lookup.ServiceProviders;
34import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
35import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
36import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
37import org.sleuthkit.autopsy.coreutils.DataSourceUtils;
38import org.sleuthkit.autopsy.coreutils.Logger;
39import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
40import org.sleuthkit.autopsy.ingest.IngestJobSettings;
41import org.sleuthkit.autopsy.ingest.IngestManager;
42import org.sleuthkit.autopsy.ingest.IngestStream;
43import org.sleuthkit.datamodel.Host;
44import org.sleuthkit.datamodel.Image;
45import org.sleuthkit.datamodel.SleuthkitJNI;
46import org.sleuthkit.datamodel.TskCoreException;
54@ServiceProviders(value = {
62 private static final List<String>
allExt =
new ArrayList<>();
68 private static final List<FileFilter>
filtersList =
new ArrayList<>();
113 static List<FileFilter> getFileFiltersList() {
186 run(
null,
null, progressMonitor, callback);
206 run(
null,
host, progressMonitor, callback);
215 this.password = Objects.toString(
password, this.password);
219 }
catch (TskCoreException ex) {
220 logger.log(Level.SEVERE,
"Error adding data source with path " +
imagePath +
" to database", ex);
221 final List<String> errors =
new ArrayList<>();
222 errors.add(ex.getMessage());
227 doAddImageProcess(
deviceId,
imagePath,
sectorSize,
timeZone,
ignoreFatOrphanFiles,
md5,
sha1,
sha256, this.password, progressMonitor, callback);
257 }
catch (TskCoreException ex) {
258 logger.log(Level.SEVERE,
"Error adding data source with path " +
imagePath +
" to database", ex);
259 final List<String> errors =
new ArrayList<>();
260 errors.add(ex.getMessage());
265 doAddImageProcess(
deviceId,
imagePath, 0,
timeZone,
ignoreFatOrphanFiles,
null,
null,
null, this.password, progressMonitor, callback);
325 this.password = Objects.toString(
password, this.password);
331 }
catch (TskCoreException ex) {
332 logger.log(Level.SEVERE,
"Error adding data source with path " +
imagePath +
" to database", ex);
333 final List<String> errors =
new ArrayList<>();
334 errors.add(ex.getMessage());
342 }
catch (TskCoreException ex) {
343 logger.log(Level.SEVERE,
"Error starting ingest modules", ex);
350 doAddImageProcess(
deviceId,
imagePath,
sectorSize,
timeZone,
ignoreFatOrphanFiles,
md5,
sha1,
sha256, this.password,
progress, callBack);
359 deviceId = UUID.randomUUID().toString();
369 if (
sha1.isEmpty()) {
377 if (this.password.isEmpty()) {
423 private void doAddImageProcess(String
deviceId, String
imagePath,
int sectorSize, String
timeZone,
boolean ignoreFatOrphanFiles, String
md5, String
sha1, String
sha256, String
password,
DataSourceProcessorProgressMonitor progressMonitor,
DataSourceProcessorCallback callback) {
427 String message =
"Ingest stream was not initialized before running the add image process on " +
imagePath;
428 logger.log(Level.SEVERE, message);
429 final List<String> errors =
new ArrayList<>();
435 String message =
"Image was not added to database before running the add image process on " +
imagePath;
436 logger.log(Level.SEVERE, message);
437 final List<String> errors =
new ArrayList<>();
447 new StreamingAddImageTaskCallback(
ingestStream, callback));
484 for (FileFilter filter : filters) {
485 if (filter.accept(file)) {
523 }
catch (Exception ex) {
533 process(
deviceId, dataSourcePath,
null,
null, progressMonitor, callBack);
545 this.imagePath = dataSourcePath.toString();
547 this.timeZone = Calendar.getInstance().getTimeZone().getID();
548 this.password = Objects.toString(
password, this.password);
550 this.ignoreFatOrphanFiles =
false;
556 }
catch (TskCoreException ex) {
557 logger.log(Level.SEVERE,
"Error adding data source with path " +
imagePath +
" to database", ex);
558 final List<String> errors =
new ArrayList<>();
559 errors.add(ex.getMessage());
564 doAddImageProcess(
deviceId, dataSourcePath.toString(),
sectorSize,
timeZone,
ignoreFatOrphanFiles,
null,
null,
null,
this.password, progressMonitor, callBack);
583 this.imagePath = dataSourcePath.toString();
585 this.timeZone = Calendar.getInstance().getTimeZone().getID();
587 this.password = Objects.toString(
password, this.password);
588 this.ignoreFatOrphanFiles =
false;
594 }
catch (TskCoreException ex) {
595 logger.log(Level.SEVERE,
"Error adding data source with path " +
imagePath +
" to database", ex);
596 final List<String> errors =
new ArrayList<>();
597 errors.add(ex.getMessage());
605 }
catch (TskCoreException ex) {
606 logger.log(Level.SEVERE,
"Error starting ingest modules", ex);
607 final List<String> errors =
new ArrayList<>();
608 errors.add(ex.getMessage());
613 doAddImageProcess(
deviceId, dataSourcePath.toString(),
sectorSize,
timeZone,
ignoreFatOrphanFiles,
null,
null,
null,
password, progressMonitor, callBack);
SleuthkitCase getSleuthkitCase()
static Case getCurrentCase()
static final List< String > RAW_IMAGE_EXTS
static final List< String > VIRTUAL_MACHINE_EXTS
static final String VIRTUAL_MACHINE_DESC
static final List< String > ENCASE_IMAGE_EXTS
static final String ENCASE_IMAGE_DESC
static final String RAW_IMAGE_DESC
static final GeneralFilter rawFilter
void run(String password, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
int canProcess(Path dataSourcePath)
String getDataSourceType()
static final GeneralFilter virtualMachineFilter
int canProcess(Path dataSourcePath, String password)
static final GeneralFilter encaseFilter
IngestStream ingestStream
void readConfigSettings()
void process(String deviceId, Path dataSourcePath, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
void runWithIngestStream(IngestJobSettings settings, DataSourceProcessorProgressMonitor progress, DataSourceProcessorCallback callBack)
static final List< String > allExt
boolean ignoreFatOrphanFiles
IngestStream processWithIngestStream(String deviceId, Path dataSourcePath, IngestJobSettings settings, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
static final String ALL_DESC
void doAddImageProcess(String deviceId, String imagePath, int sectorSize, String timeZone, boolean ignoreFatOrphanFiles, String md5, String sha1, String sha256, String password, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void run(String deviceId, String imagePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
boolean supportsIngestStream()
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void runWithIngestStream(String password, Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progress, DataSourceProcessorCallback callBack)
void process(String deviceId, Path dataSourcePath, String password, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
void runWithIngestStream(Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progress, DataSourceProcessorCallback callBack)
static final List< FileFilter > filtersList
IngestStream processWithIngestStream(String deviceId, Path dataSourcePath, Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
static final GeneralFilter allFilter
AddImageTask addImageTask
void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
static final String DATA_SOURCE_TYPE
final ImageFilePanel configPanel
static boolean isAcceptedByFiler(File file, List< FileFilter > filters)
IngestStream processWithIngestStream(String deviceId, Path dataSourcePath, String password, Host host, IngestJobSettings settings, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
static synchronized ImageFilePanel createInstance(String context, List< FileFilter > fileChooserFilters)
void done(DataSourceProcessorResult result, List< String > errList, List< Content > newDataSources)
static boolean imageHasFileSystem(Path dataSourcePath)
synchronized static Logger getLogger(String name)
static synchronized IngestManager getInstance()
IngestStream openIngestStream(DataSource dataSource, IngestJobSettings settings)