Skip to content

Commit

Permalink
fix(tasker/unlock-license): resolve fingerprint correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Dec 30, 2022
1 parent 4993302 commit 92d7857
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package app.revanced.patches.tasker.license.unlock.fingerprints

import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

object CheckLicenseFingerprint : MethodFingerprint(
strings = listOf("just(IsLicensedResult(true))"),
opcodes = listOf(
Opcode.GOTO,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL
)
strings = listOf("Can't check license")
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tasker.license.unlock.annotations.UnlockLicenseCompatibility
import app.revanced.patches.tasker.license.unlock.fingerprints.CheckLicenseFingerprint
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.MethodReference
import org.jf.dexlib2.immutable.instruction.ImmutableInstruction35c

@Patch
@Name("unlock-license")
Expand All @@ -26,21 +22,11 @@ class UnlockLicensePatch : BytecodePatch(
CheckLicenseFingerprint
)
) {
override fun execute(context: BytecodeContext) = CheckLicenseFingerprint.result?.let { result ->
val patchIndex = result.scanResult.patternScanResult!!.endIndex

with(result.mutableMethod.instruction(patchIndex) as FiveRegisterInstruction) {
ImmutableInstruction35c(
opcode,
registerCount,
registerC,
0, // registerE is 1, registerD is now 0 instead of 1 bypassing the license verification
registerE,
registerF,
registerG,
(this as ReferenceInstruction).reference as MethodReference
)
}
PatchResultSuccess()
} ?: CheckLicenseFingerprint.toErrorResult()
override fun execute(context: BytecodeContext) = CheckLicenseFingerprint
.result
?.mutableMethod
// Return the method early, which prompts the user with a non dismissible dialog, when the trial period is over.
?.addInstruction(0, "return-void")
?.let { PatchResultSuccess() }
?: CheckLicenseFingerprint.toErrorResult()
}

0 comments on commit 92d7857

Please sign in to comment.