[Xposed General] teble:
Library: DexKit

Project Link: https://github.com/LuckyPray/DexKit

About: An easy-to-use, high-performance dex deobfuscation library. Easy to use your CMAKE/Android projects.

Highlight:

JNI multi-threaded processing Dex bytecode, more efficient than JVM implementation.

It single search is ms level, You can even inject the host application at runtime without causing an ANR, to the extent permitted.

You can use it to handle reinforced apps(use ClassLoader cookies).

API introduction​

There are two APIs can meet most of your usage scenarios:

DexKit::BatchFindClassesUsingStrings

DexKit::BatchFindMethodsUsingStrings

And there are many other APIs:

DexKit::FindMethodCaller: find caller for specified method.

DexKit::FindMethodInvoking: find the called method

DexKit::FindMethodUsingField: Find method to get/set specified field

DexKit::FindMethodUsingString: find method used utf8 string

DexKit::FindMethod: find method by multiple conditions

DexKit::FindSubClasses: find all direct subclasses of the specified class

DexKit::FindMethodUsingOpPrefixSeq: find all method using opcode prefix sequence(op range: 0x00-0xFF)

DexKit::FindMethodUsingOpCodeSeq: find all method using opcode sequence(op range: 0x00-0xFF)

DexKit::GetMethodOpCodeSeq: get method opcode sequence(op range: 0x00-0xFF)

For more detailed instructions, please refer to dex_kit.h.

Quick start​

However, this approach will import an extra so file. If you don't want to import an extra so file, please use the second/third method.

build.gradle:

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

app/build.gradle:

dependencies {
implementation 'com.github.LuckyPray:DexKit:<version>'
}

​

JAVA Example​

DexKitBridge provides 2 factory methods to create Dexkit instances:

DexKitBridge.create(apkPath): normally, please use it.

DexKitBridge.create(classLoader, true): for reinforced apps, used classLoader and set option useCookieDexFile to true.

PS: DexKitBridge.create(classLoader, useCookieDexFile = false) ≈ DexKitBridge.create(apkPath), but the former may contain part of the system dex.

import io.luckypry.dexkit.DexKitBridge;
// ...

public class DexUtil {

static {
System.loadLibrary("dexkit");
}

public static void findMethod() {
// for no-reinforced apps please use apkpath to load, because of the exist of dex2oat and CompactDex(cdex),
// dexkit currently only handles StandardDex.
String apkPath = application.applicationInfo.sourceDir
// try-with-resources, auto close DexKitBridge, no need to call DexKitBridge.close()
// if you don't use try-with-resources, be sure to manually call DexKitBridge.close() to release the jni memory
try (DexKitBridge dexKitBridge = DexKitBridge.create(apkPath)) {
if (dexKitBridge == null) {
Log.e("DexUtil", "DexKitBridge create failed");
return;
}
List<DexClassDescriptor> classes = dexKitBridge.findSubClasses("android.app.Activity", null);
for (DexClassDescriptor clazz : classes) {
String name = clazz.getName();
String simpleName = clazz.getSimpleName();
Class<?> clz = clazz.getClassInstance(hostClassLoader);
Log.i("DexUtil", "findSubClasses: " + clz);
}
} catch (Throwable e) {
Log.e("DexUtil", Log.getStackTraceString(e));
}
}
}

If you have problems using it, please create an issue on the github repo.