mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 17:17:47 +01:00
feat(memegenerator): unlock-pro
patch (#1902)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
5b987e14e8
commit
7d30541781
7 changed files with 196 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
package app.revanced.patches.memegenerator.detection.license.fingerprint
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object LicenseValidationFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
parameters = listOf("Landroid/content/Context;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_WIDE,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_WIDE,
|
||||||
|
Opcode.CMP_LONG,
|
||||||
|
Opcode.IF_GEZ,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.RETURN,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.RETURN
|
||||||
|
)
|
||||||
|
)
|
|
@ -0,0 +1,31 @@
|
||||||
|
package app.revanced.patches.memegenerator.detection.license.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.memegenerator.detection.license.fingerprint.LicenseValidationFingerprint
|
||||||
|
|
||||||
|
@Description("Disables Firebase license validation.")
|
||||||
|
@Version("0.0.1")
|
||||||
|
class LicenseValidationPatch : BytecodePatch(
|
||||||
|
listOf(LicenseValidationFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
LicenseValidationFingerprint.result?.apply {
|
||||||
|
mutableMethod.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 p0, 0x1
|
||||||
|
return p0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: throw LicenseValidationFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package app.revanced.patches.memegenerator.detection.signature.fingerprint
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@FuzzyPatternScanMethod(2)
|
||||||
|
object VerifySignatureFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
parameters = listOf("Landroid/app/Activity;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.ARRAY_LENGTH,
|
||||||
|
Opcode.IF_GE,
|
||||||
|
Opcode.AGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.RETURN,
|
||||||
|
Opcode.ADD_INT_LIT8
|
||||||
|
),
|
||||||
|
)
|
|
@ -0,0 +1,31 @@
|
||||||
|
package app.revanced.patches.memegenerator.detection.signature.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.memegenerator.detection.signature.fingerprint.VerifySignatureFingerprint
|
||||||
|
|
||||||
|
@Description("Disables detection of incorrect signature.")
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SignatureVerificationPatch : BytecodePatch(
|
||||||
|
listOf(VerifySignatureFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
VerifySignatureFingerprint.result?.apply {
|
||||||
|
mutableMethod.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 p0, 0x1
|
||||||
|
return p0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: throw VerifySignatureFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package app.revanced.patches.memegenerator.misc.pro.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.zombodroid.MemeGenerator", arrayOf("4.6364"))])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class UnlockProCompatibility
|
|
@ -0,0 +1,22 @@
|
||||||
|
package app.revanced.patches.memegenerator.misc.pro.fingerprint
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object IsFreeVersionFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Ljava/lang/Boolean;",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
strings = listOf("free"),
|
||||||
|
parameters = listOf("Landroid/content/Context;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.SGET,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ
|
||||||
|
)
|
||||||
|
)
|
|
@ -0,0 +1,45 @@
|
||||||
|
package app.revanced.patches.memegenerator.misc.pro.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
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.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.memegenerator.detection.license.patch.LicenseValidationPatch
|
||||||
|
import app.revanced.patches.memegenerator.detection.signature.patch.SignatureVerificationPatch
|
||||||
|
import app.revanced.patches.memegenerator.misc.pro.annotations.UnlockProCompatibility
|
||||||
|
import app.revanced.patches.memegenerator.misc.pro.fingerprint.IsFreeVersionFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("unlock-pro")
|
||||||
|
@Description("Unlocks pro features.")
|
||||||
|
@DependsOn([
|
||||||
|
SignatureVerificationPatch::class,
|
||||||
|
LicenseValidationPatch::class
|
||||||
|
])
|
||||||
|
@UnlockProCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class UnlockProVersionPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
IsFreeVersionFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
IsFreeVersionFingerprint.result?.apply {
|
||||||
|
mutableMethod.replaceInstructions(0,
|
||||||
|
"""
|
||||||
|
sget-object p0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
|
||||||
|
return-object p0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: throw IsFreeVersionFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue