Ser*_*gio 5 android bytecode dalvik bytecode-manipulation
我想在运行时在android应用程序中注入代码.我曾尝试使用dx工具在sdcard中生成dexfile,但是当我想要实例化时,它会失败.是否有任何工具可以注入生成新dalvik字节码的代码?我正在研究一些库,aspecjt或guice for android.使用脚本语言更好吗?
谢谢人们:)
Dexmaker是新的,专为此而设计.以下是项目网站示例的一部分:
DexMaker dexMaker = new DexMaker();
// Generate a HelloWorld class.
TypeId<?> helloWorld = TypeId.get("LHelloWorld;");
dexMaker.declare(helloWorld, "HelloWorld.generated", Modifier.PUBLIC, TypeId.OBJECT);
generateHelloMethod(dexMaker, helloWorld);
// Create the dex file and load it.
File outputDir = new File(".");
ClassLoader loader = dexMaker.generateAndLoad(HelloWorldMaker.class.getClassLoader(),
outputDir, outputDir);
Class<?> helloWorldClass = loader.loadClass("HelloWorld");
// Execute our newly-generated code in-process.
helloWorldClass.getMethod("hello").invoke(null);
Run Code Online (Sandbox Code Playgroud)
Juh*_*ani -15
不,这是不可能的。如果可能的话,Android 应用程序权限将不起作用。
| 归档时间: |
|
| 查看次数: |
6584 次 |
| 最近记录: |