From 90ccf96621fc69f1cb0b1767325de4a4fff75990 Mon Sep 17 00:00:00 2001 From: TinyHai <34483077+TinyHai@users.noreply.github.com> Date: Sun, 29 Dec 2024 21:55:33 +0800 Subject: [PATCH] fix: found wrong hookinfo of okhttp (#1591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复okhttp的hookinfo --- app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt index 5bd0853038..d9064ea477 100644 --- a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -519,9 +519,11 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex null, null, null, - true - ).asSequence().firstNotNullOfOrNull { + false + ).asSequence().mapNotNull { dexHelper.decodeMethodIndex(it) + }.firstOrNull { + it.declaringClass?.name?.startsWith("okhttp3") == true }?.declaringClass ?: return@okHttp responseBodyClass ?: return@okHttp val getMethod = dexHelper.findMethodUsingString( @@ -562,7 +564,7 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex }?.name ?: return@method } string = method { - name = responseBodyClass.methods.find { + name = responseBodyClass.declaredMethods.find { it.parameterTypes.isEmpty() && it.returnType == String::class.java }?.name ?: return@method }