mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
Merge pull request #1811 from BasisOlivers/custom_artifact_addition-1851
Custom artifact addition 1851
This commit is contained in:
2
Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties
Executable file
2
Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties
Executable file
@@ -0,0 +1,2 @@
|
||||
UserArtifactIngestModuleFactory.moduleName=Custom Artifact Adder
|
||||
UserArtifactIngestModuleFactory.moduleDescription=Adds custom artifact types
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.modules.UserArtifacts;
|
||||
|
||||
import com.sun.media.jfxmedia.logging.Logger;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
|
||||
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
|
||||
import org.sleuthkit.autopsy.ingest.IngestJobContext;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author oliver
|
||||
*/
|
||||
public class UserArtifactIngestModule implements DataSourceIngestModule {
|
||||
|
||||
private IngestJobContext context = null;
|
||||
private BlackboardArtifact.Type type1, type2;
|
||||
int type1ID, type2ID;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
|
||||
progressBar.switchToDeterminate(2);
|
||||
try {
|
||||
dataSource.newArtifact(type1ID);
|
||||
progressBar.progress(1);
|
||||
dataSource.newArtifact(type2ID);
|
||||
progressBar.progress(1);
|
||||
return ProcessResult.OK;
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
return ProcessResult.ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startUp(IngestJobContext context) throws IngestModuleException {
|
||||
this.context = context;
|
||||
type1 = new BlackboardArtifact.Type(39, "TSK_TEST1", "Test 1");
|
||||
type2 = new BlackboardArtifact.Type(40, "TSK_TEST2", "Test 2");
|
||||
try {
|
||||
type1ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type1.getTypeName(), type1.getDisplayName());
|
||||
type2ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type2.getTypeName(), type2.getDisplayName());
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.logMsg(Logger.ERROR, "Startup failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.modules.UserArtifacts;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.python.apache.xmlcommons.Version;
|
||||
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author oliver
|
||||
*/
|
||||
@ServiceProvider(service = IngestModuleFactory.class)
|
||||
public class UserArtifactIngestModuleFactory extends IngestModuleFactoryAdapter {
|
||||
|
||||
static String getModuleName() {
|
||||
return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModuleDisplayName() {
|
||||
return getModuleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModuleDescription() {
|
||||
return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleDescription");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModuleVersionNumber() {
|
||||
return Version.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings ingestOptions) {
|
||||
return new UserArtifactIngestModule();
|
||||
}
|
||||
@Override
|
||||
public boolean isDataSourceIngestModuleFactory() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user