javascript - 如何用 frida 挂钩动态加载的 dex 和 libs?
问题描述
我正在尝试挂钩由打包程序动态加载的 java 类。
我使用 frida-DexDump 来获取原始的 dex,但我怎样才能挂钩它的功能?我试图挂钩的函数是一个本机函数(以这种方式声明“public static native void Init(String str, String str2);
”)。
这是我尝试过的方式,但没有任何结果
Java.perform(function() {
Java.openClassFile('/data/data/com.malware.android/6644448.dex').load();
// Printing all available classes
var iterator = Java.openClassFile('/data/data/com.malware.android/6984300.dex').getClassNames();
// Here all the elements of the array is being printed.
for (var j = 0; j < iterator.length; j++) {
console.log(iterator[j]);
}
var my_class = Java.use("com.lib.connect");
//replace the original implmenetation of the function `Init` with our custom function
//Init is a native function that it's being affected to Integer variable
my_class.Init.implementation = function(x, y) {
//print the original arguments
console.log("original call: Init(" + x + ", " + y + ")");
//call the original implementation of `Init` with args (2,5)
this.Init("2", "5");
}
});
问题 2:通过将转储的 dex 加载到 Jadx 中,我可以看到该应用程序正在从 assets 文件夹中加载 Native 库,但该文件夹或文件实际上并未存储在 assets 文件夹中。那么我在哪里可以找到这些文件?我能做些什么 ?尝试使用 gameguardian 转储应用程序,但没有任何显示创建了一个脚本,该脚本在创建后尝试从所需文件夹中提取文件,但我在那里看不到任何文件(尝试了这种方法,因为一个库已加载到正在删除的应用程序中)这里它是如何被调用的
private void Config(Context context) {
AssetManager assets = context.getAssets();
new File(context.getFilesDir().getPath() + "/vseh").mkdirs();
new File(context.getFilesDir().getPath() + "/vseh/mtx").mkdirs();
String str = context.getFilesDir().getPath() + "/vseh/mtx/global-mtx.dat";
String str2 = context.getFilesDir().getPath() + "/vseh/mtx/base.apk";
if (!new File(str2).exists()) {
try {
copyFile(assets.open("__ainfo.tsa"), new FileOutputStream(str2));
} catch (IOException e) {
e.printStackTrace();
}
try {
Runtime.getRuntime().exec("chmod -R 644 " + str2);
} catch (IOException e2) {
e2.printStackTrace();
}
}
try {
copyFile(assets.open("__info.tsa"), new FileOutputStream(str));
System.load(str);
FuckLeecher();
new File(str).delete();
} catch (IOException e3) {
e3.printStackTrace();
}
}
解决方案
推荐阅读
- php - 为什么我在结果集中获得了两次列值?
- java - 在 Ejb 2.1 中调用 finder 方法时 Jboss 中 postgres 的类型转换错误
- pandas - Python DF2Gspread 库无法将 DF 保存到 Google 工作表
- get - 使用 httpconnection 发送 HTTP GET 请求失败
- gitlab - Gitlab 管道结账访问
- arrays - 在perl中检查一行中重复列的最快方法
- node.js - 尝试连接到 URL 并在视图中获取图像作为响应时出现问题 - Node.js 和 Express
- javascript - 当我使用导航栏时,所有 PHP 都变为未定义
- java - 如何将不可变对象与公共构造函数一起使用但不序列化为元组样式?
- c# - 填充字符串并将其显示在gridview c#中