From 481bf583afbf954bef1c4e5349a62ea1c623115a Mon Sep 17 00:00:00 2001 From: David Gnedt Date: Sat, 30 Sep 2023 19:22:03 +0200 Subject: [PATCH] feat(SPB Serviceportal Bund): Add `Remove root detection` patch (#3049) --- .../detection/root/RootDetectionPatch.kt | 21 +++++++++++++++++++ .../fingerprints/RootDetectionFingerprint.kt | 12 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt create mode 100644 src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt new file mode 100644 index 000000000..7414ef176 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt @@ -0,0 +1,21 @@ +package app.revanced.patches.serviceportalbund.detection.root + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.serviceportalbund.detection.root.fingerprints.RootDetectionFingerprint + +@Patch( + name = "Remove root detection", + description = "Removes the check for root permissions and unlocked bootloader.", + compatiblePackages = [CompatiblePackage("at.gv.bka.serviceportal")] +) +@Suppress("unused") +object RootDetectionPatch : BytecodePatch( + setOf(RootDetectionFingerprint) +) { + override fun execute(context: BytecodeContext) = + RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void") +} diff --git a/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt new file mode 100644 index 000000000..4feed493a --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/fingerprints/RootDetectionFingerprint.kt @@ -0,0 +1,12 @@ +package app.revanced.patches.serviceportalbund.detection.root.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +object RootDetectionFingerprint : MethodFingerprint( + "V", + accessFlags = AccessFlags.PUBLIC.value, + customFingerprint = { methodDef, _ -> + methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") + } +)