Merge pull request #5982 from gdicristofaro/6290-jythonModuleLoaderScanner

6290 jython module loader scanner
This commit is contained in:
Richard Cordovano 2020-06-16 19:24:45 -04:00 committed by GitHub
commit ef00fe959b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,8 @@ 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 java.io.BufferedReader;
import java.io.FileReader;
/** /**
* Finds and loads Autopsy modules written using the Jython variant of the * Finds and loads Autopsy modules written using the Jython variant of the
@ -97,7 +99,7 @@ public final class JythonModuleLoader {
if (file.isDirectory()) { if (file.isDirectory()) {
File[] pythonScripts = file.listFiles(new PythonScriptFileFilter()); File[] pythonScripts = file.listFiles(new PythonScriptFileFilter());
for (File script : pythonScripts) { for (File script : pythonScripts) {
try (Scanner fileScanner = new Scanner(script)) { try (Scanner fileScanner = new Scanner(new BufferedReader(new FileReader(script)))) {
while (fileScanner.hasNextLine()) { while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine(); String line = fileScanner.nextLine();
if (line.startsWith("class ") && filter.accept(line)) { //NON-NLS if (line.startsWith("class ") && filter.accept(line)) { //NON-NLS