Skip to content

Commit ed7333b

Browse files
committed
update README.md
1 parent b30e30a commit ed7333b

File tree

7 files changed

+50
-27
lines changed

7 files changed

+50
-27
lines changed

README.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,36 @@
22

33
> BlackObfuscator GUI 工具
44
5-
需要打包成jar包,然后将BlackObfuscator下载到本地,然后重命名成dex-tools
6-
> 可直接在release界面下载解压运行
7-
> 虽然目前只提供了Windows的Release包
8-
9-
10-
1.前往BlackObfuscator Release界面下载最新的工具
11-
> https://github.com/CodingGay/BlackObfuscator/releases
12-
13-
2.解压,并重命名为dex-tools
14-
15-
3.使用Gradle-compose desktop - packageUberJarForCurrentOS 任务生成本地jar包
16-
17-
4.移动dex-tools到jar同一目录
18-
5+
#### 环境说明
6+
1. JDK11或以上
7+
2. 前往BlackObfuscator的Release界面下载打包好的工具
8+
3. 解压到jar同级目录,并重命名为dex-tools
199
>dex-tools
2010
> > lib
2111
>
2212
> > bin
2313
>
2414
> BlackObfuscator.jar
15+
16+
17+
#### 运行说明
18+
1. 可直接双击clickme.bat(Windows)或者clickme.sh(Macos/Linux)
19+
2. 可对照BlackObfuscator的参数说明
20+
21+
#### 参数说明
22+
1. Input 要混淆的apk或者dex的路径,可点击右侧图标跳转选择
23+
2. Output 输出保存的apk或者dex的路径,可点击右侧图标跳转选择
24+
3. Depth 混淆深度
25+
4. Rules 要混淆的包名,可换行输入多行
26+
27+
#### 运行效果
28+
29+
30+
31+
![](images/image1.png)
32+
33+
![](images/image2.png)
34+
35+
36+
37+
![](images/image3.png)

common/src/commonMain/kotlin/cn/kaicity/common/widget/MainView.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import cn.kaicity.common.bean.InputBean
2424
import cn.kaicity.common.platform.chooseFile
2525
import cn.kaicity.common.platform.saveFile
2626

27+
2728
/**
2829
* 首页
2930
*
@@ -52,7 +53,7 @@ fun MainView(modifier: Modifier, btnClick: (InputBean) -> Unit) {
5253
trailingIcon = {
5354
Icon(Icons.Default.Search, "Menu", modifier = Modifier.clickable {
5455
chooseFile {
55-
if(it.isNotEmpty()){
56+
if (it.isNotEmpty()) {
5657
input = it
5758
}
5859
}
@@ -74,7 +75,7 @@ fun MainView(modifier: Modifier, btnClick: (InputBean) -> Unit) {
7475
}, trailingIcon = {
7576
Icon(Icons.Default.Search, "Menu", modifier = Modifier.clickable {
7677
saveFile {
77-
if(it.isNotEmpty()){
78+
if (it.isNotEmpty()) {
7879
output = it
7980
}
8081
}
@@ -119,7 +120,7 @@ fun MainView(modifier: Modifier, btnClick: (InputBean) -> Unit) {
119120
}
120121

121122
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
122-
Button(modifier = Modifier.padding(12.dp), onClick = {
123+
Button(modifier = Modifier.padding(12.dp), onClick = {
123124
inputIsError = input.isEmpty()
124125
outputIsError = output.isEmpty()
125126
depthIsError = depth.isEmpty()

common/src/desktopMain/kotlin/cn/kaicity/common/DesktopApp.kt

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package cn.kaicity.common
22

3-
import androidx.compose.desktop.ui.tooling.preview.Preview
43
import androidx.compose.foundation.background
54
import androidx.compose.foundation.layout.Row
65
import androidx.compose.foundation.layout.fillMaxWidth
@@ -19,14 +18,9 @@ import cn.kaicity.common.widget.MainView
1918
import kotlinx.coroutines.Dispatchers
2019
import kotlinx.coroutines.GlobalScope
2120
import kotlinx.coroutines.launch
22-
import kotlin.math.log
2321

24-
@Preview
25-
@Composable
26-
fun AppPreview() {
27-
AppMain()
28-
}
2922

23+
var enableObfuscator = true
3024

3125
@Composable
3226
fun AppMain() {
@@ -39,6 +33,12 @@ fun AppMain() {
3933

4034
Row(modifier = Modifier.fillMaxWidth().background(Color.White)) {
4135
MainView(modifier = Modifier.weight(0.5F)) {
36+
37+
if (!enableObfuscator) {
38+
log += "\nThere are tasks running"
39+
return@MainView
40+
}
41+
4242
if (it.input.endsWith(".dex")) {
4343
log = "Start Obfuscator Dex"
4444
obfDex(it, logCallback)
@@ -58,18 +58,28 @@ fun AppMain() {
5858
private fun obfDex(inputBean: InputBean, logCallback: (log: String) -> Unit) {
5959
GlobalScope.launch(Dispatchers.IO) {
6060
try {
61-
61+
enableObfuscator = false
6262
DexObf.run(inputBean, logCallback)
6363
} catch (e: Throwable) {
6464
e.printStackTrace()
6565
logCallback.invoke("Obfuscator Dex Fail")
6666
logCallback.invoke(e.message ?: "")
67+
} finally {
68+
enableObfuscator = true
6769
}
6870
}
6971
}
7072

7173
private fun obfApk(inputBean: InputBean, logCallback: (log: String) -> Unit) {
7274
GlobalScope.launch(Dispatchers.IO) {
73-
ApkObf.run(inputBean, logCallback)
75+
try {
76+
enableObfuscator = false
77+
ApkObf.run(inputBean, logCallback)
78+
} catch (e: Throwable) {
79+
e.printStackTrace()
80+
} finally {
81+
enableObfuscator = true
82+
83+
}
7484
}
7585
}

common/src/desktopMain/kotlin/cn/kaicity/common/platform/IObfuscator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ actual class IObfuscator actual constructor(private var flow: FlowCollector<Stri
1717

1818
val rawPath = "dex-tools/black-obfuscator"
1919
val absolutePath = File(rawPath).absolutePath
20-
println(absolutePath)
2120

2221
val shell = if (os.contains("windows")) {
2322
"$absolutePath.bat d2j-black-obfuscator $param \n"

images/image1.png

21.8 KB
Loading

images/image2.png

36.6 KB
Loading

images/image3.png

135 KB
Loading

0 commit comments

Comments
 (0)