Skip to content

Commit 4271b11

Browse files
authored
Merge pull request #1 from wukaicheng/main
beta version
2 parents 488133a + b7549d2 commit 4271b11

File tree

30 files changed

+917
-1
lines changed

30 files changed

+917
-1
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@
2121

2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
24+
25+
/build/
26+
*/build/
27+
/.gradle/
28+
.idea
29+
dex-tools

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
# BlackObfuscator-GUI
1+
# BlackObfuscator-GUI
2+
3+
> BlackObfuscator GUI 工具
4+
5+
需要打包成jar包,然后将BlackObfuscator下载到本地,然后重命名成dex-tools
6+
7+
1.前往BlackObfuscator Release界面下载最新的工具
8+
> https://github.com/CodingGay/BlackObfuscator/releases
9+
10+
2.解压,并重命名为dex-tools
11+
12+
3.使用Gradle-compose desktop - packageUberJarForCurrentOS 任务生成本地jar包
13+
14+
4.移动dex-tools到jar同一目录
15+
16+
>dex-tools
17+
> > lib
18+
>
19+
> > bin
20+
>
21+
> BlackObfuscator.jar

android/build.gradle.kts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
plugins {
2+
id("org.jetbrains.compose") version "1.0.0-alpha3"
3+
id("com.android.application")
4+
kotlin("android")
5+
}
6+
7+
group = "cn.kaicity"
8+
version = "1.0"
9+
10+
repositories {
11+
jcenter()
12+
}
13+
14+
dependencies {
15+
implementation(project(":common"))
16+
implementation("androidx.activity:activity-compose:1.4.0")
17+
}
18+
19+
android {
20+
compileSdkVersion(30)
21+
defaultConfig {
22+
applicationId = "cn.kaicity.android"
23+
minSdkVersion(24)
24+
targetSdkVersion(30)
25+
versionCode = 1
26+
versionName = "1.0"
27+
}
28+
compileOptions {
29+
sourceCompatibility = JavaVersion.VERSION_1_8
30+
targetCompatibility = JavaVersion.VERSION_1_8
31+
}
32+
buildTypes {
33+
getByName("release") {
34+
isMinifyEnabled = false
35+
}
36+
}
37+
}

android/src/main/AndroidManifest.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cn.kaicity.android">
3+
<application
4+
android:allowBackup="false"
5+
android:supportsRtl="true"
6+
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
7+
<activity android:name=".MainActivity">
8+
<intent-filter>
9+
<action android:name="android.intent.action.MAIN"/>
10+
<category android:name="android.intent.category.LAUNCHER"/>
11+
</intent-filter>
12+
</activity>
13+
</application>
14+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cn.kaicity.android
2+
3+
import cn.kaicity.common.App
4+
import android.os.Bundle
5+
import androidx.activity.compose.setContent
6+
import androidx.appcompat.app.AppCompatActivity
7+
import androidx.compose.material.MaterialTheme
8+
9+
class MainActivity : AppCompatActivity() {
10+
override fun onCreate(savedInstanceState: Bundle?) {
11+
super.onCreate(savedInstanceState)
12+
setContent {
13+
MaterialTheme {
14+
App()
15+
}
16+
}
17+
}
18+
}

build.gradle.kts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
buildscript {
2+
repositories {
3+
gradlePluginPortal()
4+
jcenter()
5+
google()
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
10+
classpath("com.android.tools.build:gradle:4.0.2")
11+
}
12+
}
13+
14+
group = "cn.kaicity"
15+
version = "1.0"
16+
17+
allprojects {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
22+
}
23+
}

common/build.gradle.kts

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import org.jetbrains.compose.compose
2+
3+
plugins {
4+
kotlin("multiplatform")
5+
id("org.jetbrains.compose") version "1.0.0-alpha3"
6+
id("com.android.library")
7+
}
8+
9+
group = "cn.kaicity"
10+
version = "1.0"
11+
12+
kotlin {
13+
android()
14+
jvm("desktop") {
15+
compilations.all {
16+
kotlinOptions.jvmTarget = "11"
17+
}
18+
}
19+
sourceSets {
20+
val commonMain by getting {
21+
dependencies {
22+
api(compose.runtime)
23+
api(compose.foundation)
24+
api(compose.material)
25+
api(compose.preview)
26+
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
27+
}
28+
}
29+
val commonTest by getting {
30+
dependencies {
31+
implementation(kotlin("test"))
32+
}
33+
}
34+
val androidMain by getting {
35+
dependencies {
36+
api("androidx.appcompat:appcompat:1.2.0")
37+
api("androidx.core:core-ktx:1.3.1")
38+
}
39+
}
40+
val androidTest by getting {
41+
dependencies {
42+
implementation("junit:junit:4.13")
43+
}
44+
}
45+
val desktopMain by getting
46+
47+
val desktopTest by getting
48+
}
49+
}
50+
51+
android {
52+
compileSdkVersion(30)
53+
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
54+
defaultConfig {
55+
minSdkVersion(24)
56+
targetSdkVersion(30)
57+
}
58+
compileOptions {
59+
sourceCompatibility = JavaVersion.VERSION_1_8
60+
targetCompatibility = JavaVersion.VERSION_1_8
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cn.kaicity.common"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package cn.kaicity.common
2+
3+
actual fun getPlatformName(): String {
4+
return "Android"
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package cn.kaicity.common.repository
2+
3+
import kotlinx.coroutines.flow.FlowCollector
4+
5+
6+
actual class IObfuscator actual constructor(private var flow: FlowCollector<String>) {
7+
8+
actual suspend fun doObfuscator(vararg arg: String){
9+
close()
10+
}
11+
12+
suspend fun close(){
13+
}
14+
}
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package cn.kaicity.common.bean
2+
3+
data class InputBean(
4+
val input:String,
5+
val output:String,
6+
val depth:String,
7+
val rule:String
8+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package cn.kaicity.common
2+
3+
expect fun getPlatformName(): String
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package cn.kaicity.common.platform
2+
3+
expect fun chooseFile(): String
4+
5+
expect fun saveFile(): String
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package cn.kaicity.common.platform
2+
3+
import kotlinx.coroutines.flow.FlowCollector
4+
5+
6+
expect class IObfuscator(flow: FlowCollector<String>) {
7+
suspend fun doObfuscator(args: Array<String>)
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package cn.kaicity.common.repository
2+
3+
import cn.kaicity.common.bean.InputBean
4+
import cn.kaicity.common.platform.IObfuscator
5+
import kotlinx.coroutines.DelicateCoroutinesApi
6+
import kotlinx.coroutines.Dispatchers
7+
import kotlinx.coroutines.GlobalScope
8+
import kotlinx.coroutines.Job
9+
import kotlinx.coroutines.flow.catch
10+
import kotlinx.coroutines.flow.collect
11+
import kotlinx.coroutines.flow.flow
12+
import kotlinx.coroutines.flow.flowOn
13+
import kotlinx.coroutines.flow.onCompletion
14+
import kotlinx.coroutines.launch
15+
import java.io.File
16+
import kotlin.math.log
17+
18+
object DexObf {
19+
20+
private var obfuscatorImpl: IObfuscator? = null
21+
22+
private var job: Job? = null
23+
24+
@OptIn(DelicateCoroutinesApi::class)
25+
fun run(inputBean: InputBean, logCallback: (log: String) -> Unit) {
26+
job?.cancel()
27+
28+
job = GlobalScope.launch(Dispatchers.IO) {
29+
val params = arrayListOf<String>()
30+
params.add("-i")
31+
params.add(inputBean.input)
32+
33+
params.add("-o")
34+
params.add(inputBean.output)
35+
36+
params.add("-d")
37+
params.add(inputBean.depth)
38+
39+
params.add("-a")
40+
41+
val filterFile = File(File(inputBean.output).parentFile, "filter.txt")
42+
filterFile.writeText(inputBean.rule)
43+
params.add(filterFile.absolutePath)
44+
45+
46+
flow<String> { }.flowOn(Dispatchers.IO)
47+
.collect()
48+
flow {
49+
obfuscatorImpl = IObfuscator(this)
50+
obfuscatorImpl?.doObfuscator(params.toTypedArray())
51+
}.catch {
52+
logCallback.invoke("Error")
53+
}.onCompletion {
54+
filterFile.delete()
55+
logCallback.invoke("Finish")
56+
}.flowOn(Dispatchers.IO)
57+
.collect {
58+
logCallback.invoke(it)
59+
}
60+
}
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package cn.kaicity.common.widget
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxWidth
6+
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.foundation.layout.requiredHeightIn
8+
import androidx.compose.foundation.rememberScrollState
9+
import androidx.compose.foundation.verticalScroll
10+
import androidx.compose.material.Text
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.graphics.Color
14+
import androidx.compose.ui.unit.dp
15+
16+
/**
17+
* 日志
18+
*
19+
* @param modifier
20+
*/
21+
@Composable
22+
fun LogView(modifier: Modifier,text:String) {
23+
Box(
24+
modifier = modifier.then(
25+
Modifier.padding(12.dp).verticalScroll(rememberScrollState()).background(color = Color(0xffeef0f4)).requiredHeightIn(300.dp, 900.dp)
26+
.fillMaxWidth()
27+
)
28+
) {
29+
Text(
30+
text=text, color = Color(0xff555666),
31+
modifier = Modifier.padding(8.dp)
32+
)
33+
}
34+
}

0 commit comments

Comments
 (0)