From 20cfa8a5cdebc7e81128c820a2aa01415a068320 Mon Sep 17 00:00:00 2001 From: Gioele Pannetto Date: Thu, 12 Oct 2023 20:05:27 +0200 Subject: [PATCH] feat(CieID): Add `bypass root check` patch (#3011) Co-authored-by: oSumAtrIX --- .../root/BypassRootChecksPatch.kt | 23 +++++++++++++++++++ .../root/fingerprints/CheckRootFingerprint.kt | 9 ++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt create mode 100644 src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt new file mode 100644 index 00000000..c1ae8dfa --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.cieid.restrictions.root + +import app.revanced.extensions.exception +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.cieid.restrictions.root.fingerprints.CheckRootFingerprint + +@Patch( + name = "Bypass root checks", + description = "Removes the restriction to use the app with root permissions or on a custom ROM.", + compatiblePackages = [CompatiblePackage("it.ipzs.cieid")] +) +class BypassRootChecksPatch : BytecodePatch( + setOf(CheckRootFingerprint) +) { + override fun execute(context: BytecodeContext) { + CheckRootFingerprint.result?.mutableMethod?.addInstruction(1, "return-void") + ?: throw CheckRootFingerprint.exception + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt new file mode 100644 index 00000000..c8da85d6 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/fingerprints/CheckRootFingerprint.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.cieid.restrictions.root.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object CheckRootFingerprint : MethodFingerprint( + customFingerprint = { methodDef, _ -> + methodDef.definingClass == "Lit/ipzs/cieid/BaseActivity;" && methodDef.name == "onResume" + } +) \ No newline at end of file