Shamrock: try fix #120

This commit is contained in:
WhiteChi 2023-12-02 23:55:48 +08:00
parent 6201d12f5f
commit 41dd1de8f8
2 changed files with 11 additions and 2 deletions

View File

@ -109,7 +109,7 @@ internal object CardSvc: BaseSvc() {
val dataService = app
.getRuntimeService(IProfileDataService::class.java, "all")
val card = refreshCardLock.withLock {
suspendCancellableCoroutine<Card?> {
suspendCancellableCoroutine {
app.addObserver(object: ProfileCardObserver() {
override fun onGetProfileCard(success: Boolean, obj: Any) {
app.removeObserver(this)

View File

@ -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
}
}