|
10 | 10 |
|
11 | 11 | A high performance dex deobfuscator library(NDK). |
12 | 12 |
|
| 13 | +> **Warning**: The current project has been refactored, `1.1.0` and earlier APIs are deprecated. Please refer to the latest documentation for use. |
| 14 | +
|
13 | 15 | ## API introduction |
14 | 16 |
|
15 | 17 | These two APIs can meet most of your usage scenarios: |
16 | 18 |
|
17 | | -- **`DexKit::LocationClasses`** |
18 | | -- **`DexKit::LocationMethods`** |
| 19 | +- **`DexKit::BatchFindClassesUsedStrings`** |
| 20 | +- **`DexKit::BatchFindMethodsUsedStrings`** |
| 21 | + |
| 22 | +> **Note**: In all cases you should avoid searching for keywords that contain duplicate content, eg: {"key_word", "word"}, as this will cause tags to be overwritten, resulting in inaccurate search results. |
| 23 | +> If there is such a need, open the advanced search mode as much as possible, and use the string to match the content exactly, for example, modify it to this: {"^key_word$", "^word$"} |
19 | 24 |
|
20 | 25 | And there are many other APIs: |
21 | 26 |
|
22 | | -- `DexKit::FindMethodInvoked`: Find caller for specified method. |
23 | | -- `DexKit::FindMethodUsedString` |
24 | | -- `DexKit::FindMethod`: Find method with various conditions |
25 | | -- `DexKit::FindSubClasses`: Find sub class of specified class |
26 | | -- `DexKit::FindMethodOpPrefixSeq`: Find method with op prefix |
| 27 | +- `DexKit::FindMethodBeInvoked`: find caller for specified method. |
| 28 | +- `DexKit::FindMethodInvoking`: find the called method |
| 29 | +- `DexKit::FindFieldBeUsed`: find method getting specified field, access types(put/get) can be limited by setting `be_used_flags` |
| 30 | +- `DexKit::FindMethodUsedString`: find method used utf8 string |
| 31 | +- `DexKit::FindMethod`: find method by multiple conditions |
| 32 | +- `DexKit::FindSubClasses`: find all direct subclasses of the specified class |
| 33 | +- `DexKit::FindMethodOpPrefixSeq`: find all method used opcode prefix sequence |
| 34 | + |
| 35 | +For more detailed instructions, please refer to [dex_kit.h](https://github.com/LuckyPray/DexKit/blob/master/include/dex_kit.h). |
27 | 36 |
|
28 | 37 | ## Integration |
29 | 38 |
|
@@ -60,70 +69,9 @@ target_link_libraries(mylib dexkit::dex_kit_static z) |
60 | 69 | At the same time, we also provide [DexKitJniHelper.h](https://github.com/LuckyPray/DexKit/blob/master/include/DexKitJniHelper.h) |
61 | 70 | for the conversion of complex objects between java and c++. For example: `HashMap<String, HashSet<String>>` -> `std::map<std::string, std::set<std::string>>` |
62 | 71 |
|
63 | | -dexkit.cpp |
64 | | -```c++ |
65 | | -#include<DexKitJniHelper.h> |
66 | | - |
67 | | -extern "C" |
68 | | -JNIEXPORT jlong JNICALL |
69 | | -Java_me_xxx_dexkit_DexKitHelper_initDexKit(JNIEnv *env, jobject thiz, |
70 | | - jstring apkPath) { |
71 | | - const char *cStr = env->GetStringUTFChars(apkPath, nullptr); |
72 | | - std::string filePathStr(cStr); |
73 | | - auto dexkit = new dexkit::DexKit(hostApkPath); |
74 | | - env->ReleaseStringUTFChars(apkPath, cStr); |
75 | | - return (jlong) dexkit; |
76 | | -} |
77 | | - |
78 | | -extern "C" |
79 | | -JNIEXPORT void JNICALL |
80 | | -Java_me_xxx_dexkit_DexKitHelper_release(JNIEnv *env, jobject thiz, jlong token) { |
81 | | - ReleaseDexKitInstance(env, token); |
82 | | -} |
83 | | - |
84 | | -extern "C" |
85 | | -JNIEXPORT jobject JNICALL |
86 | | -Java_me_xxx_dexkit_DexKitHelper_batchFindClassUsedString(JNIEnv *env, |
87 | | - jobject thiz, |
88 | | - jlong token, |
89 | | - jobject map, |
90 | | - jboolean advanced_match) { |
91 | | - // this function is declared in DexKitJniHelper.h |
92 | | - // For more help methods, please check the source code: https://github.com/LuckyPray/DexKit/blob/master/include/DexKitJniHelper.h |
93 | | - return LocationClasses(env, token, map, advanced_match); |
94 | | -} |
95 | | - |
96 | | -// omit... |
97 | | -``` |
98 | | -
|
99 | | -DexKitHelper.kt |
100 | | -```kotlin |
101 | | -class DexKitHelper( |
102 | | - apkPath: String |
103 | | -) { |
104 | | - |
105 | | - private var token: Long = 0 |
106 | | -
|
107 | | - init { |
108 | | - token = initDexKit(apkPath) |
109 | | - } |
110 | | -
|
111 | | - private external fun initDexKit(apkPath: String): Long |
112 | | -
|
113 | | - /** |
114 | | - * free space allocated by c++ |
115 | | - */ |
116 | | - private external fun release(token: Long) |
117 | | -
|
118 | | - private external fun batchFindClassUsedString( |
119 | | - token: Long, |
120 | | - map: Map<String, Set<String>>, |
121 | | - advancedMatch: Boolean = false, |
122 | | - ): Map<String, Array<String>> |
123 | | - |
124 | | - // omit... |
125 | | -} |
126 | | -``` |
| 72 | +JNI used example : |
| 73 | +- [dexkit.cpp](https://github.com/LuckyPray/XAutoDaily/blob/master/app/src/main/cpp/dexkit.cpp) |
| 74 | +- [DexKitHelper.kt](https://github.com/LuckyPray/XAutoDaily/blob/master/app/src/main/java/me/teble/xposed/autodaily/dexkit/DexKitHelper.kt) |
127 | 75 |
|
128 | 76 | ## Example |
129 | 77 |
|
|
0 commit comments