Frida动态加载Dex
原创
©著作权归作者所有:来自51CTO博客作者小龙在山东的原创作品,请联系作者获取转载授权,否则将追究法律责任
Frida加载Dex用Java.openClassFile
方法。
使用dex方法之前,需要加载一下:load()
。
创建实例($new()
),需要在主线程里运行:Java.scheduleOnMainThread
。
function load_dex() {
var DecodeUtilsDex = Java.openClassFile("/data/local/tmp/DecodeUtils.dex");
console.log("DecodeUtilsDex:", DecodeUtilsDex);
Java.perform(function() {
DecodeUtilsDex.load();
var DecodeUtils = Java.use("com.example.androiddemo.DecodeUtils");
console.log(DecodeUtils);
var FridaActivity = Java.use("com.github.androiddemo.Activity.FridaActivity");
Java.scheduleOnMainThread(function() {
console.log(DecodeUtils.$new().decode(FridaActivity.$new().password.value));
})
});
}
参考:https://frida.re/docs/javascript-api/
Java.openClassFile(filePath): open the .dex file at filePath,
returning an object with the following methods:
load(): load the contained classes into the VM.
getClassNames(): obtain an array of available class names.