mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
2229: Part 22: Use getOpenCase() instead of getCurrentCase() in ingest and modules.
This commit is contained in:
parent
4b640fea92
commit
d409ddeda1
@ -34,6 +34,7 @@ import org.openide.util.Cancellable;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
@ -254,12 +255,12 @@ final class DataSourceIngestJob {
|
||||
*/
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getOpenCase().getSleuthkitCase();
|
||||
this.addIngestModules(firstStageDataSourceModuleTemplates, IngestModuleType.DATA_SOURCE_LEVEL, skCase);
|
||||
this.addIngestModules(fileIngestModuleTemplates, IngestModuleType.FILE_LEVEL, skCase);
|
||||
this.addIngestModules(secondStageDataSourceModuleTemplates, IngestModuleType.DATA_SOURCE_LEVEL, skCase);
|
||||
} catch (TskCoreException ex) {
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to add ingest modules to database.", ex);
|
||||
}
|
||||
}
|
||||
@ -400,8 +401,8 @@ final class DataSourceIngestJob {
|
||||
this.startSecondStage();
|
||||
}
|
||||
try {
|
||||
this.ingestJob = Case.getCurrentCase().getSleuthkitCase().addIngestJob(dataSource, NetworkUtils.getLocalHostName(), ingestModules, new Date(this.createTime), new Date(0), IngestJobStatusType.STARTED, "");
|
||||
} catch (TskCoreException ex) {
|
||||
this.ingestJob = Case.getOpenCase().getSleuthkitCase().addIngestJob(dataSource, NetworkUtils.getLocalHostName(), ingestModules, new Date(this.createTime), new Date(0), IngestJobStatusType.STARTED, "");
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to add ingest job to database.", ex);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2015 Basis Technology Corp.
|
||||
* Copyright 2015-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.ingest.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
@ -96,9 +97,9 @@ public abstract class DataSourceAnalysisEvent extends AutopsyEvent implements Se
|
||||
}
|
||||
try {
|
||||
long id = (Long) super.getNewValue();
|
||||
dataSource = Case.getCurrentCase().getSleuthkitCase().getContentById(id);
|
||||
dataSource = Case.getOpenCase().getSleuthkitCase().getContentById(id);
|
||||
return dataSource;
|
||||
} catch (IllegalStateException | TskCoreException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS
|
||||
return null;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Copyright 2011-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
@ -108,7 +109,12 @@ public class FileExtMismatchIngestModule implements FileIngestModule {
|
||||
@Override
|
||||
@Messages({"FileExtMismatchIngestModule.indexError.message=Failed to index file extension mismatch artifact for keyword search."})
|
||||
public ProcessResult process(AbstractFile abstractFile) {
|
||||
blackboard = Case.getCurrentCase().getServices().getBlackboard();
|
||||
try {
|
||||
blackboard = Case.getOpenCase().getServices().getBlackboard();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.WARNING, "Exception while getting open case.", ex); //NON-NLS
|
||||
return ProcessResult.ERROR;
|
||||
}
|
||||
if (this.settings.skipKnownFiles() && (abstractFile.getKnown() == FileKnown.KNOWN)) {
|
||||
return ProcessResult.OK;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2014 Basis Technology Corp.
|
||||
* Copyright 2014-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -34,6 +34,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
@ -59,19 +60,25 @@ class ContactAnalyzer {
|
||||
private Blackboard blackboard;
|
||||
|
||||
public void findContacts(IngestJobContext context) {
|
||||
|
||||
blackboard = Case.getCurrentCase().getServices().getBlackboard();
|
||||
Case openCase;
|
||||
try {
|
||||
openCase = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
|
||||
return;
|
||||
}
|
||||
|
||||
blackboard = openCase.getServices().getBlackboard();
|
||||
List<AbstractFile> absFiles;
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
SleuthkitCase skCase = openCase.getSleuthkitCase();
|
||||
absFiles = skCase.findAllFilesWhere("LOWER(name) LIKE LOWER('%call_history%') "); //NON-NLS //get exact file names
|
||||
if (absFiles.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (AbstractFile AF : absFiles) {
|
||||
try {
|
||||
jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), AF.getName().replaceAll("[<>%|\"/:*\\\\]", ""));
|
||||
//jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), i+".txt");
|
||||
jFile = new java.io.File(openCase.getTempDirectory(), AF.getName().replaceAll("[<>%|\"/:*\\\\]", ""));
|
||||
ContentUtils.writeToFile(AF, jFile, context::dataSourceIngestIsCancelled);
|
||||
//copyFileUsingStreams(AF,jFile);
|
||||
//copyFileUsingStream(AF,jFile);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -30,6 +30,7 @@ import org.mitre.cybox.common_2.ConditionApplicationEnum;
|
||||
import org.mitre.cybox.common_2.ConditionTypeEnum;
|
||||
|
||||
import org.mitre.cybox.objects.Address;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -54,6 +55,14 @@ class EvalAddressObj extends EvaluatableObject {
|
||||
spacing, ObservableResult.ObservableState.INDETERMINATE, null);
|
||||
}
|
||||
|
||||
Case case1;
|
||||
try {
|
||||
case1 = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
return new ObservableResult(id, "Exception while getting open case.", //NON-NLS
|
||||
spacing, ObservableResult.ObservableState.FALSE, null);
|
||||
}
|
||||
|
||||
String origAddressStr = obj.getAddressValue().getValue().toString();
|
||||
|
||||
// For now, we don't support "NONE" because it honestly doesn't seem like it
|
||||
@ -67,7 +76,6 @@ class EvalAddressObj extends EvaluatableObject {
|
||||
// Set warnings for any unsupported fields
|
||||
setUnsupportedFieldWarnings();
|
||||
|
||||
Case case1 = Case.getCurrentCase();
|
||||
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
|
||||
|
||||
try {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -27,6 +27,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
@ -52,7 +53,14 @@ class EvalDomainObj extends EvaluatableObject {
|
||||
spacing, ObservableResult.ObservableState.INDETERMINATE, null);
|
||||
}
|
||||
|
||||
// Since we have single URL artifacts, ALL and NONE conditions probably don't make sense to test
|
||||
Case case1;
|
||||
try {
|
||||
case1 = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
return new ObservableResult(id, "Exception while getting open case.", //NON-NLS
|
||||
spacing, ObservableResult.ObservableState.FALSE, null);
|
||||
}
|
||||
// Since we have single URL artifacts, ALL and NONE conditions probably don't make sense to test
|
||||
if (!((obj.getValue().getApplyCondition() == null)
|
||||
|| (obj.getValue().getApplyCondition() == ConditionApplicationEnum.ANY))) {
|
||||
return new ObservableResult(id, "DomainObject: Can not process apply condition " + obj.getValue().getApplyCondition().toString() //NON-NLS
|
||||
@ -66,7 +74,6 @@ class EvalDomainObj extends EvaluatableObject {
|
||||
+ " on DomainName - using substring comparison"); //NON-NLS
|
||||
}
|
||||
|
||||
Case case1 = Case.getCurrentCase();
|
||||
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
|
||||
|
||||
try {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||
import org.mitre.cybox.common_2.ConditionApplicationEnum;
|
||||
|
||||
import org.mitre.cybox.objects.URIObjectType;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -52,6 +53,15 @@ class EvalURIObj extends EvaluatableObject {
|
||||
return new ObservableResult(id, "URIObject: No URI value field found", //NON-NLS
|
||||
spacing, ObservableResult.ObservableState.INDETERMINATE, null);
|
||||
}
|
||||
|
||||
Case case1;
|
||||
try {
|
||||
case1 = Case.getOpenCase();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
return new ObservableResult(id, "Exception while getting open case: " + ex.getLocalizedMessage(), //NON-NLS
|
||||
spacing, ObservableResult.ObservableState.FALSE, null);
|
||||
}
|
||||
|
||||
String addressStr = obj.getValue().getValue().toString();
|
||||
|
||||
// Strip off http:// or https://
|
||||
@ -65,7 +75,6 @@ class EvalURIObj extends EvaluatableObject {
|
||||
+ " on URI object", spacing, ObservableResult.ObservableState.INDETERMINATE, null); //NON-NLS
|
||||
}
|
||||
|
||||
Case case1 = Case.getCurrentCase();
|
||||
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user