JS Engine Compatibility
Probably not needed, more testing is required
This commit is contained in:
parent
18e1c101fd
commit
ce86445ad3
2 changed files with 7 additions and 4 deletions
|
@ -5,8 +5,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.plugin.strategies.JavascriptPluginLaunchStrategy;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||||
|
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
||||||
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
|
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy
|
||||||
bindings.put("polyglot.js.allowHostAccess", true);
|
bindings.put("polyglot.js.allowHostAccess", true);
|
||||||
bindings.put("polyglot.js.allowAllAccess", true);
|
bindings.put("polyglot.js.allowAllAccess", true);
|
||||||
bindings.put("polyglot.js.allowHostClassLookup", true);
|
bindings.put("polyglot.js.allowHostClassLookup", true);
|
||||||
bindings.put("activeContainer", activeContainer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader reader = new FileReader(file);
|
Reader reader = new FileReader(file);
|
||||||
|
@ -63,13 +62,16 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy
|
||||||
|
|
||||||
ScriptEngine finalEngine = engine;
|
ScriptEngine finalEngine = engine;
|
||||||
|
|
||||||
Plugin plugin = new Plugin()
|
return new Plugin()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(ArrayList<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//add the active container as a global variable to the JS script
|
||||||
|
finalEngine.put("activeContainer", activeContainer);
|
||||||
|
|
||||||
//invoke the JS function
|
//invoke the JS function
|
||||||
((Invocable) finalEngine).invokeFunction("execute", classNodeList);
|
((Invocable) finalEngine).invokeFunction("execute", classNodeList);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +81,5 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.setupJSContainer(finalEngine);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue