From 7c5bc5a65f3c274ca3bd16a5d236e840a82ad4b6 Mon Sep 17 00:00:00 2001 From: baizhenxuan Date: Thu, 23 Nov 2023 20:27:04 +0800 Subject: [PATCH] fix cannot include the java source code in the detail report. --- .../net/bytedance/security/app/android/AndroidUtils.kt | 9 ++++----- src/main/kotlin/net/bytedance/security/app/ui/util.kt | 4 ---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/net/bytedance/security/app/android/AndroidUtils.kt b/src/main/kotlin/net/bytedance/security/app/android/AndroidUtils.kt index e320013..e8d2e9d 100644 --- a/src/main/kotlin/net/bytedance/security/app/android/AndroidUtils.kt +++ b/src/main/kotlin/net/bytedance/security/app/android/AndroidUtils.kt @@ -51,7 +51,6 @@ import java.io.File import java.io.IOException import java.nio.charset.StandardCharsets import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException import java.util.zip.ZipEntry import java.util.zip.ZipFile import kotlin.system.exitProcess @@ -130,8 +129,7 @@ object ComponentDescriptionDataSerializer : KSerializer { object AndroidUtils { var apkAbsPath: String? = null var JavaSourceDir: String? = null - - var dexToJavaProcess: Process? = null + var resources: ARSCFileParser? = null var isApkParsed = false // @@ -189,7 +187,7 @@ object AndroidUtils { val start = System.currentTimeMillis() Log.logInfo("==========>Start dex to Java") - val doneFile = File(JavaSourceDir,".done") + val doneFile = File(JavaSourceDir, ".done") if (doneFile.exists()) { Log.logInfo("Using jadx cache") @@ -222,7 +220,8 @@ object AndroidUtils { val timeoutMillis = 1800000L // 1800 seconds if (!processBuilder.waitFor(timeoutMillis, TimeUnit.MILLISECONDS)) { processBuilder.destroyForcibly() - processBuilder.waitFor() + val exitCode = processBuilder.waitFor() + Log.logInfo("command ${command.joinToString(" ")} exit with $exitCode") } val exitCode = try { diff --git a/src/main/kotlin/net/bytedance/security/app/ui/util.kt b/src/main/kotlin/net/bytedance/security/app/ui/util.kt index dfa4d83..14b9ff4 100644 --- a/src/main/kotlin/net/bytedance/security/app/ui/util.kt +++ b/src/main/kotlin/net/bytedance/security/app/ui/util.kt @@ -19,7 +19,6 @@ package net.bytedance.security.app.ui import net.bytedance.security.app.Log import net.bytedance.security.app.PLUtils -import net.bytedance.security.app.android.AndroidUtils import net.bytedance.security.app.engineconfig.isLibraryClass import net.bytedance.security.app.util.JavaAST import soot.Scene @@ -33,9 +32,6 @@ import java.nio.file.Files return method's full Java source code, */ internal fun getJavaSource(method: SootMethod): String? { - if (AndroidUtils.dexToJavaProcess == null) { - return null - } val methodSig = method.signature // val anonymousMethodSig: String? = null // val declaringClassName = method.declaringClass.name