From 53d91e32183663b0aa70994cc4e1d8ae5eb8c8e4 Mon Sep 17 00:00:00 2001 From: ssense <28709368+ssense1337@users.noreply.github.com> Date: Sun, 28 May 2023 07:59:42 +0700 Subject: [PATCH] feat(scbeasy): add `remove-debugging-detection` patch (#2287) Co-authored-by: oSumAtrIX --- .../RemoveDebuggingDetectionCompatibility.kt | 8 +++++ .../DebuggingDetectionFingerprint.kt | 8 +++++ .../patch/RemoveDebuggingDetectionPatch.kt | 31 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/annotations/RemoveDebuggingDetectionCompatibility.kt create mode 100644 src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt create mode 100644 src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/patch/RemoveDebuggingDetectionPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/annotations/RemoveDebuggingDetectionCompatibility.kt b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/annotations/RemoveDebuggingDetectionCompatibility.kt new file mode 100644 index 000000000..095abdaa3 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/annotations/RemoveDebuggingDetectionCompatibility.kt @@ -0,0 +1,8 @@ +package app.revanced.patches.scbeasy.detection.debugging.annotations + +import app.revanced.patcher.annotation.Compatibility +import app.revanced.patcher.annotation.Package + +@Compatibility([Package("com.scb.phone")]) +@Target(AnnotationTarget.CLASS) +internal annotation class RemoveDebuggingDetectionCompatibility diff --git a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt new file mode 100644 index 000000000..61408b471 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/fingerprints/DebuggingDetectionFingerprint.kt @@ -0,0 +1,8 @@ +package app.revanced.patches.scbeasy.detection.debugging.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object DebuggingDetectionFingerprint : MethodFingerprint( + returnType = "Z", + strings = listOf("adb_enabled") +) diff --git a/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/patch/RemoveDebuggingDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/patch/RemoveDebuggingDetectionPatch.kt new file mode 100644 index 000000000..cc3f1111a --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/scbeasy/detection/debugging/patch/RemoveDebuggingDetectionPatch.kt @@ -0,0 +1,31 @@ +package app.revanced.patches.scbeasy.detection.debugging.patch + +import app.revanced.patcher.annotation.* +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.scbeasy.detection.debugging.annotations.RemoveDebuggingDetectionCompatibility +import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDetectionFingerprint + +@Patch(false) +@Name("remove-debugging-detection") +@Description("Removes the USB and wireless debugging checks.") +@RemoveDebuggingDetectionCompatibility +@Version("0.0.1") +class RemoveDebuggingDetectionPatch : BytecodePatch( + listOf(DebuggingDetectionFingerprint) +) { + override fun execute(context: BytecodeContext): PatchResult { + DebuggingDetectionFingerprint.result!!.mutableMethod.addInstructions( + 0, + """ + const/4 v0, 0x0 + return v0 + """ + ) + return PatchResultSuccess() + } +}