diff --git a/iped-engine/src/main/java/iped/engine/task/leappbridge/ALeappPluginsManager.java b/iped-engine/src/main/java/iped/engine/task/leappbridge/ALeappPluginsManager.java index b33f11f565..ff7bec206c 100644 --- a/iped-engine/src/main/java/iped/engine/task/leappbridge/ALeappPluginsManager.java +++ b/iped-engine/src/main/java/iped/engine/task/leappbridge/ALeappPluginsManager.java @@ -96,11 +96,10 @@ private void loadArtifacts(File scriptFile) { Collection c = e.getValue(); PyCallable p = (PyCallable) c.toArray()[2]; - String methodName = (String) p.getAttr("__name__"); LeapArtifactsPlugin plugin = new LeapArtifactsPlugin(); plugin.setModuleName(moduleName); - plugin.setMethodName(methodName); + plugin.setMethod(p); plugin.setName((String) c.toArray()[0]); Object o = c.toArray()[1]; diff --git a/iped-engine/src/main/java/iped/engine/task/leappbridge/LeapArtifactsPlugin.java b/iped-engine/src/main/java/iped/engine/task/leappbridge/LeapArtifactsPlugin.java index b8820094cd..8cab6811f9 100644 --- a/iped-engine/src/main/java/iped/engine/task/leappbridge/LeapArtifactsPlugin.java +++ b/iped-engine/src/main/java/iped/engine/task/leappbridge/LeapArtifactsPlugin.java @@ -4,9 +4,13 @@ import java.nio.file.PathMatcher; import java.util.HashSet; +import jep.python.PyCallable; + public class LeapArtifactsPlugin { String moduleName; String methodName; + PyCallable method; + String name; HashSet<String> patterns = new HashSet<String>(); HashSet<PathMatcher> compiledPatterns = new HashSet<PathMatcher>(); @@ -23,10 +27,6 @@ public String getMethodName() { return methodName; } - public void setMethodName(String methodName) { - this.methodName = methodName; - } - public String getName() { return name; } @@ -48,4 +48,13 @@ public void addPattern(String pattern) { compiledPatterns.add(FileSystems.getDefault().getPathMatcher("glob:" + pattern)); } + public PyCallable getMethod() { + return method; + } + + public void setMethod(PyCallable method) { + this.method = method; + this.methodName = (String) method.getAttr("__name__"); + } + } diff --git a/iped-engine/src/main/java/iped/engine/task/leappbridge/LeappBridgeTask.java b/iped-engine/src/main/java/iped/engine/task/leappbridge/LeappBridgeTask.java index e56d5a7ef6..c1a7b81a2b 100644 --- a/iped-engine/src/main/java/iped/engine/task/leappbridge/LeappBridgeTask.java +++ b/iped-engine/src/main/java/iped/engine/task/leappbridge/LeappBridgeTask.java @@ -189,7 +189,12 @@ public void executePlugin(IItem evidence, LeapArtifactsPlugin p, List<String> fi jep.eval("import sys"); jep.eval("from java.lang import System"); jep.eval("from iped.engine.task.leappbridge import ArtifactJavaReport"); - jep.eval("from " + p.getModuleName() + " import " + p.getMethodName() + " as parse"); + if (p.getMethodName().contains("lambda")) { + jep.eval("from " + p.getModuleName() + " import *"); + jep.set("parse", p.getMethod()); + } else { + jep.eval("from " + p.getModuleName() + " import " + p.getMethodName() + " as parse"); + } // creates a dumb file seeker. some plugins refers to directory although not