Как подключить динамически загружаемые dex и libs упаковщиком к frida? - PullRequest
0 голосов
/ 04 августа 2020

Я пытаюсь подключить java класс, который динамически загружается упаковщиком.

Я использовал frida-DexDump, чтобы получить исходный dex, но как я могу подключить его функции? функция, которую я пытаюсь перехватить, это нативная функция (объявленная таким образом "publi c stati c 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, я вижу, что приложение загружает собственные библиотеки из папки ресурсов, но физически папка или файлы не хранятся в папке ресурсов. так где я могу найти эти файлы? Что я могу сделать ? попытался сбросить приложение с помощью 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();
    }
}
...