Skip to content
This repository was archived by the owner on Sep 25, 2022. It is now read-only.

Commit 3c94e8e

Browse files
committed
update dexkit version, bump to 1.2.0
1 parent a54ccb2 commit 3c94e8e

File tree

5 files changed

+39
-143
lines changed

5 files changed

+39
-143
lines changed

README.md

Lines changed: 19 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@
1010

1111
A high performance dex deobfuscator library(NDK).
1212

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+
1315
## API introduction
1416

1517
These two APIs can meet most of your usage scenarios:
1618

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$"}
1924
2025
And there are many other APIs:
2126

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).
2736

2837
## Integration
2938

@@ -60,70 +69,9 @@ target_link_libraries(mylib dexkit::dex_kit_static z)
6069
At the same time, we also provide [DexKitJniHelper.h](https://github.com/LuckyPray/DexKit/blob/master/include/DexKitJniHelper.h)
6170
for the conversion of complex objects between java and c++. For example: `HashMap<String, HashSet<String>>` -> `std::map<std::string, std::set<std::string>>`
6271

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)
12775

12876
## Example
12977

README_zh.md

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,30 @@
1010

1111
一个高性能的 dex 反混淆工具(NDK版本)。
1212

13+
> **Warning**: 当前项目已经进行重构,`1.1.0`及以下的API全被弃用,请参考最新的文档进行使用。
14+
1315
## API说明
1416

1517
这两个 API 可以满足你大部分的使用场景:
1618

17-
- **`DexKit::LocationClasses`**
18-
- **`DexKit::LocationMethods`**
19+
- **`DexKit::BatchFindClassesUsedStrings`**
20+
- **`DexKit::BatchFindMethodsUsedStrings`**
21+
22+
> **Note**:无论什么情况都应当避免搜索关键词包含重复内容, 例如:{"key_word", "word"},因为这样会导致标记被覆盖,从而导致搜索结果不准确。
23+
> 如果真的有这样的需求,尽可能打开高级搜索模式,同时使用字符串完全匹配内容,例如修改成这样:{"^key_word$", "^word$"}
1924
2025
以及其他 API:
2126

22-
- `DexKit::FindMethodInvoked`: 查找指定方法的调用者(invoke-kind类别的opcode)
23-
- `DexKit::FindMethodUsedString`: 查找指定字符串的调用者(`const-string``const-string/jumbo`)
27+
- `DexKit::FindMethodBeInvoked`: 查找指定方法的调用者
28+
- `DexKit::FindMethodInvoking`: 查找指定方法调用的方法
29+
- `DexKit::FindFieldBeUsed`: 查找指定的属性被什么方法调用,可通过参数 `be_used_flags` 限制访问类型(put/get)
30+
- `DexKit::FindMethodUsedString`: 查找指定字符串的调用者
2431
- `DexKit::FindMethod`: 多条件查找方法
2532
- `DexKit::FindSubClasses`: 查找直系子类
2633
- `DexKit::FindMethodOpPrefixSeq`: 查找满足特定op前缀序列的方法(使用`0x00`-`0xff`)
2734

35+
更详细的API说明请参考 [dex_kit.h](https://github.com/LuckyPray/DexKit/blob/master/include/dex_kit.h).
36+
2837
## 集成
2938

3039
Gradle:
@@ -55,75 +64,14 @@ find_package(dexkit REQUIRED CONFIG)
5564
target_link_libraries(mylib dexkit::dex_kit_static z)
5665
```
5766

58-
> 注意:此头文件从 `1.1.0` 开始加入
67+
> 注意:此头文件从 `1.1.0` 版本开始加入
5968
6069
同时,我们提供了 [DexKitJniHelper.h](https://github.com/LuckyPray/DexKit/blob/master/include/DexKitJniHelper.h)
6170
用于java与c++之间复杂对象的转换,例如:`HashMap<String, HashSet<String>>` -> `std::map<std::string, std::set<std::string>>`
6271

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-
// 该方法定义于 DexKitJniHelper.h
92-
// 获取更多辅助方法请参阅源码:https://github.com/LuckyPray/DexKit/blob/master/include/DexKitJniHelper.h
93-
return LocationClasses(env, token, map, advanced_match);
94-
}
95-
96-
// 省略...
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-
* 释放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-
// 省略...
125-
}
126-
```
72+
JNI 使用示例:
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)
12775

12876
## 使用示例
12977

dexkit/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ afterEvaluate {
5252
// You can then customize attributes of the publication as shown below.
5353
groupId = 'io.luckypray'
5454
artifactId = 'dexkit'
55-
version = '1.0'
55+
version = '1.2.0'
5656
}
5757
}
5858
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="me.teble.dexkit">
3+
package="io.luckypray.dexkit">
44

55
</manifest>

0 commit comments

Comments
 (0)