mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #6027 from rubnogueira/data-source-processor-jython
Add DataSourceProcessor Jython support
This commit is contained in:
commit
577bfd41ea
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2011-2020 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -33,6 +33,7 @@ import org.openide.util.Lookup;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.python.JythonModuleLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* visual component for the first panel of add image wizard. Allows the user to
|
* visual component for the first panel of add image wizard. Allows the user to
|
||||||
@ -76,6 +77,14 @@ final class AddImageWizardDataSourceSettingsVisual extends JPanel {
|
|||||||
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (DataSourceProcessor dsProcessor : JythonModuleLoader.getDataSourceProcessorModules()) {
|
||||||
|
if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType())) {
|
||||||
|
datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2011-2020 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.datasourceprocessors.RawDSProcessor;
|
import org.sleuthkit.autopsy.datasourceprocessors.RawDSProcessor;
|
||||||
import org.sleuthkit.autopsy.logicalimager.dsp.LogicalImagerDSProcessor;
|
import org.sleuthkit.autopsy.logicalimager.dsp.LogicalImagerDSProcessor;
|
||||||
|
import org.sleuthkit.autopsy.python.JythonModuleLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel which displays the available DataSourceProcessors and allows selection
|
* Panel which displays the available DataSourceProcessors and allows selection
|
||||||
@ -196,6 +197,15 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
|||||||
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (DataSourceProcessor dsProcessor : JythonModuleLoader.getDataSourceProcessorModules()) {
|
||||||
|
if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType())) {
|
||||||
|
datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType()); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dspList.add(ImageDSProcessor.getType());
|
dspList.add(ImageDSProcessor.getType());
|
||||||
dspList.add(LocalDiskDSProcessor.getType());
|
dspList.add(LocalDiskDSProcessor.getType());
|
||||||
dspList.add(LocalFilesDSProcessor.getType());
|
dspList.add(LocalFilesDSProcessor.getType());
|
||||||
|
@ -407,6 +407,7 @@ public class Installer extends ModuleInstall {
|
|||||||
try {
|
try {
|
||||||
JythonModuleLoader.getIngestModuleFactories();
|
JythonModuleLoader.getIngestModuleFactories();
|
||||||
JythonModuleLoader.getGeneralReportModules();
|
JythonModuleLoader.getGeneralReportModules();
|
||||||
|
JythonModuleLoader.getDataSourceProcessorModules();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// This is a firewall exception to ensure that any possible exception caused
|
// This is a firewall exception to ensure that any possible exception caused
|
||||||
// by this initial load of the Jython modules are caught and logged.
|
// by this initial load of the Jython modules are caught and logged.
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2014-2022 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.datasourceprocessors;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
|
||||||
|
|
||||||
|
import org.sleuthkit.datamodel.Host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An adapter that provides no-op implementations of various DataSourceProcessor
|
||||||
|
* methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class DataSourceProcessorAdapter implements DataSourceProcessor {
|
||||||
|
@Override
|
||||||
|
public abstract String getDataSourceType();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JPanel getPanel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPanelValid() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2014 Basis Technology Corp.
|
* Copyright 2014-2020 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -41,6 +41,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
|
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
|
||||||
import org.sleuthkit.autopsy.report.GeneralReportModule;
|
import org.sleuthkit.autopsy.report.GeneralReportModule;
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -72,6 +73,17 @@ public final class JythonModuleLoader {
|
|||||||
public static synchronized List<GeneralReportModule> getGeneralReportModules() {
|
public static synchronized List<GeneralReportModule> getGeneralReportModules() {
|
||||||
return getInterfaceImplementations(new GeneralReportModuleDefFilter(), GeneralReportModule.class);
|
return getInterfaceImplementations(new GeneralReportModuleDefFilter(), GeneralReportModule.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data source processors modules implemented using Jython.
|
||||||
|
*
|
||||||
|
* @return A list of objects that implement the DataSourceProcessor
|
||||||
|
* interface.
|
||||||
|
*/
|
||||||
|
public static synchronized List<DataSourceProcessor> getDataSourceProcessorModules() {
|
||||||
|
return getInterfaceImplementations(new DataSourceProcessorDefFilter(), DataSourceProcessor.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Messages({"JythonModuleLoader.pythonInterpreterError.title=Python Modules",
|
@Messages({"JythonModuleLoader.pythonInterpreterError.title=Python Modules",
|
||||||
"JythonModuleLoader.pythonInterpreterError.msg=Failed to load python modules, See log for more details"})
|
"JythonModuleLoader.pythonInterpreterError.msg=Failed to load python modules, See log for more details"})
|
||||||
private static <T> List<T> getInterfaceImplementations(LineFilter filter, Class<T> interfaceClass) {
|
private static <T> List<T> getInterfaceImplementations(LineFilter filter, Class<T> interfaceClass) {
|
||||||
@ -169,6 +181,9 @@ public final class JythonModuleLoader {
|
|||||||
boolean accept(String line);
|
boolean accept(String line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter IngestModule interface implementations
|
||||||
|
*/
|
||||||
private static class IngestModuleFactoryDefFilter implements LineFilter {
|
private static class IngestModuleFactoryDefFilter implements LineFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -177,6 +192,9 @@ public final class JythonModuleLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter GeneralReportModule interface implementations
|
||||||
|
*/
|
||||||
private static class GeneralReportModuleDefFilter implements LineFilter {
|
private static class GeneralReportModuleDefFilter implements LineFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -184,4 +202,15 @@ public final class JythonModuleLoader {
|
|||||||
return (line.contains("GeneralReportModuleAdapter") || line.contains("GeneralReportModule")); //NON-NLS
|
return (line.contains("GeneralReportModuleAdapter") || line.contains("GeneralReportModule")); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter DataSourceProcessor interface implementations
|
||||||
|
*/
|
||||||
|
private static class DataSourceProcessorDefFilter implements LineFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accept(String line) {
|
||||||
|
return (line.contains("DataSourceProcessorAdapter") || line.contains("DataSourceProcessor")); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user