From 41dd1de8f82cd097b2b7fc903673359b765c3c7c Mon Sep 17 00:00:00 2001 From: WhiteChi Date: Sat, 2 Dec 2023 23:55:48 +0800 Subject: [PATCH] `Shamrock`: try fix #120 --- .../java/moe/fuqiuluo/qqinterface/servlet/CardSvc.kt | 2 +- .../fuqiuluo/shamrock/xposed/actions/AntiDetection.kt | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xposed/src/main/java/moe/fuqiuluo/qqinterface/servlet/CardSvc.kt b/xposed/src/main/java/moe/fuqiuluo/qqinterface/servlet/CardSvc.kt index c2f9d44..7f3f91c 100644 --- a/xposed/src/main/java/moe/fuqiuluo/qqinterface/servlet/CardSvc.kt +++ b/xposed/src/main/java/moe/fuqiuluo/qqinterface/servlet/CardSvc.kt @@ -109,7 +109,7 @@ internal object CardSvc: BaseSvc() { val dataService = app .getRuntimeService(IProfileDataService::class.java, "all") val card = refreshCardLock.withLock { - suspendCancellableCoroutine { + suspendCancellableCoroutine { app.addObserver(object: ProfileCardObserver() { override fun onGetProfileCard(success: Boolean, obj: Any) { app.removeObserver(this) diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/xposed/actions/AntiDetection.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/xposed/actions/AntiDetection.kt index 952dd09..a27598c 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/xposed/actions/AntiDetection.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/xposed/actions/AntiDetection.kt @@ -66,6 +66,8 @@ class AntiDetection: IAction { } private fun antiFindPackage(context: Context) { + if (isAntiFindPackage) return + val packageManager = context.packageManager val applicationInfo = packageManager.getApplicationInfo("moe.fuqiuluo.shamrock", 0) val packageInfo = packageManager.getPackageInfo("moe.fuqiuluo.shamrock", 0) @@ -74,7 +76,7 @@ class AntiDetection: IAction { val packageName = it.args[0] as String if(packageName == "moe.fuqiuluo.shamrock") { LogCenter.log("AntiDetection: 检测到对Shamrock的检测,欺骗PackageManager(GA)", Level.WARN) - it.throwable = PackageManager.NameNotFoundException() + it.throwable = PackageManager.NameNotFoundException("Hided") } else if (packageName == "moe.fuqiuluo.shamrock.hided") { it.result = applicationInfo } @@ -100,6 +102,8 @@ class AntiDetection: IAction { } } } + + isAntiFindPackage = true } private fun antiMemoryWalking() { @@ -205,4 +209,9 @@ class AntiDetection: IAction { }.toTypedArray() } } + + companion object { + @JvmStatic + var isAntiFindPackage = false + } } \ No newline at end of file