generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(memegenerator):
unlock-pro
patch (#1902)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
Showing
7 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...anced/patches/memegenerator/detection/license/fingerprint/LicenseValidationFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
) |
31 changes: 31 additions & 0 deletions
31
...tlin/app/revanced/patches/memegenerator/detection/license/patch/LicenseValidationPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...anced/patches/memegenerator/detection/signature/fingerprint/VerifySignatureFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
), | ||
) |
31 changes: 31 additions & 0 deletions
31
...pp/revanced/patches/memegenerator/detection/signature/patch/SignatureVerificationPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
.../kotlin/app/revanced/patches/memegenerator/misc/pro/annotations/UnlockProCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
22 changes: 22 additions & 0 deletions
22
...otlin/app/revanced/patches/memegenerator/misc/pro/fingerprint/IsFreeVersionFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
) |
45 changes: 45 additions & 0 deletions
45
src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/patch/UnlockProVersionPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |