mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #496 from raman-bt/develop
Defined IngestModuleException that an ingest module may throw if init() fails.
This commit is contained in:
commit
1ca84d03b1
@ -89,7 +89,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ import org.sleuthkit.datamodel.TskData;
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
/* For this demo, we are going to make a private attribute to post our
|
/* 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
|
* results to the blackbaord with. There are many standard blackboard artifact
|
||||||
* and attribute types and you should first consider using one of those before
|
* and attribute types and you should first consider using one of those before
|
||||||
|
@ -31,6 +31,7 @@ import org.openide.util.Cancellable;
|
|||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent;
|
import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,13 +76,13 @@ import org.sleuthkit.datamodel.Content;
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() throws IngestModuleException{
|
||||||
|
|
||||||
logger.log(Level.INFO, "Initializing module: " + module.getName());
|
logger.log(Level.INFO, "Initializing module: " + module.getName());
|
||||||
try {
|
try {
|
||||||
module.init(init);
|
module.init(init);
|
||||||
inited = true;
|
inited = true;
|
||||||
} catch (Exception e) {
|
} catch (IngestModuleException e) {
|
||||||
logger.log(Level.INFO, "Failed initializing module: " + module.getName() + ", will not run.");
|
logger.log(Level.INFO, "Failed initializing module: " + module.getName() + ", will not run.");
|
||||||
//will not run
|
//will not run
|
||||||
inited = false;
|
inited = false;
|
||||||
|
@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
|||||||
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
import org.sleuthkit.autopsy.coreutils.StopWatch;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestScheduler.FileScheduler.FileTask;
|
import org.sleuthkit.autopsy.ingest.IngestScheduler.FileScheduler.FileTask;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
|
||||||
@ -459,7 +460,7 @@ public class IngestManager {
|
|||||||
IngestModuleInit moduleInit = new IngestModuleInit();
|
IngestModuleInit moduleInit = new IngestModuleInit();
|
||||||
try {
|
try {
|
||||||
s.init(moduleInit);
|
s.init(moduleInit);
|
||||||
} catch (Exception e) {
|
} catch (IngestModuleException e) {
|
||||||
logger.log(Level.SEVERE, "File ingest module failed init(): " + s.getName(), e);
|
logger.log(Level.SEVERE, "File ingest module failed init(): " + s.getName(), e);
|
||||||
allInited = false;
|
allInited = false;
|
||||||
failedModule = s;
|
failedModule = s;
|
||||||
|
@ -23,7 +23,7 @@ package org.sleuthkit.autopsy.ingest;
|
|||||||
/**
|
/**
|
||||||
* Base interface for ingest modules
|
* Base interface for ingest modules
|
||||||
*/
|
*/
|
||||||
abstract class IngestModuleAbstract {
|
public abstract class IngestModuleAbstract {
|
||||||
|
|
||||||
private String args;
|
private String args;
|
||||||
|
|
||||||
@ -42,6 +42,13 @@ package org.sleuthkit.autopsy.ingest;
|
|||||||
AbstractFile
|
AbstractFile
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public class IngestModuleException extends Exception {
|
||||||
|
IngestModuleException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked every time an ingest session is started by the framework.
|
* Invoked every time an ingest session is started by the framework.
|
||||||
* A module should support multiple invocations of init() throughout the application life-cycle.
|
* A module should support multiple invocations of init() throughout the application life-cycle.
|
||||||
@ -55,8 +62,10 @@ package org.sleuthkit.autopsy.ingest;
|
|||||||
* NEVER initialize IngestServices handle in the member declaration, because it might result
|
* NEVER initialize IngestServices handle in the member declaration, because it might result
|
||||||
* in multiple instances of the singleton -- different class loaders are used in different modules.
|
* in multiple instances of the singleton -- different class loaders are used in different modules.
|
||||||
* @param initContext context used to initialize some modules
|
* @param initContext context used to initialize some modules
|
||||||
|
*
|
||||||
|
* @throws IngestModuleException if a critical error occurs in initializing the module.
|
||||||
*/
|
*/
|
||||||
abstract public void init(IngestModuleInit initContext);
|
abstract public void init(IngestModuleInit initContext) throws IngestModuleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when an ingest session completes.
|
* Invoked when an ingest session completes.
|
||||||
|
@ -226,7 +226,7 @@ public final class ExifParserFileIngestModule extends IngestModuleAbstractFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
logger.log(Level.INFO, "init() " + this.toString());
|
logger.log(Level.INFO, "init() " + this.toString());
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class FileExtMismatchIngestModule extends org.sleuthkit.autopsy.ingest.In
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
|
|
||||||
// Load mapping
|
// Load mapping
|
||||||
|
@ -76,7 +76,7 @@ import org.sleuthkit.datamodel.TskException;
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
import org.sleuthkit.datamodel.TskException;
|
import org.sleuthkit.datamodel.TskException;
|
||||||
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
|
||||||
import org.sleuthkit.datamodel.HashInfo;
|
import org.sleuthkit.datamodel.HashInfo;
|
||||||
|
|
||||||
public class HashDbIngestModule extends IngestModuleAbstractFile {
|
public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||||
@ -145,7 +146,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
skCase = Case.getCurrentCase().getSleuthkitCase();
|
skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
logger.log(Level.INFO, "init()");
|
logger.log(Level.INFO, "init()");
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
initialized = false;
|
initialized = false;
|
||||||
|
@ -502,7 +502,7 @@ class Chrome extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ class ExtractIE extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ class ExtractRegistry extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -479,7 +479,7 @@ class Firefox extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
modules = new ArrayList<>();
|
modules = new ArrayList<>();
|
||||||
browserModules = new ArrayList();
|
browserModules = new ArrayList();
|
||||||
logger.log(Level.INFO, "init() {0}", this.toString());
|
logger.log(Level.INFO, "init() {0}", this.toString());
|
||||||
@ -180,7 +180,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
|
|||||||
for (Extract module : modules) {
|
for (Extract module : modules) {
|
||||||
try {
|
try {
|
||||||
module.init(initContext);
|
module.init(initContext);
|
||||||
} catch (Exception ex) {
|
} catch (IngestModuleException ex) {
|
||||||
logger.log(Level.SEVERE, "Exception during init() of " + module.getName(), ex);
|
logger.log(Level.SEVERE, "Exception during init() of " + module.getName(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ class RecentDocumentsByLnk extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ class SearchEngineURLQueryAnalyzer extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
try{
|
try{
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
PlatformUtil.extractResourceToUserConfigDir(SearchEngineURLQueryAnalyzer.class, XMLFILE);
|
PlatformUtil.extractResourceToUserConfigDir(SearchEngineURLQueryAnalyzer.class, XMLFILE);
|
||||||
|
@ -113,7 +113,7 @@ public final class SevenZipIngestModule extends IngestModuleAbstractFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
initialized = false;
|
initialized = false;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class EwfVerifyIngestModule extends IngestModuleDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
skCase = Case.getCurrentCase().getSleuthkitCase();
|
skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -285,7 +285,7 @@ public class ThunderbirdMboxFileIngestModule extends IngestModuleAbstractFile {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IngestModuleInit initContext) {
|
public void init(IngestModuleInit initContext) throws IngestModuleException {
|
||||||
services = IngestServices.getDefault();
|
services = IngestServices.getDefault();
|
||||||
fileManager = Case.getCurrentCase().getServices().getFileManager();
|
fileManager = Case.getCurrentCase().getServices().getFileManager();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user