mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
feat(Photomath): Support latest version
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
0eb51f7302
commit
5a2cad077f
8 changed files with 92 additions and 38 deletions
|
@ -0,0 +1,9 @@
|
||||||
|
package app.revanced.patches.photomath.detection.deviceid.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object GetDeviceIdFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Ljava/lang/String;",
|
||||||
|
strings = listOf("androidId", "android_id"),
|
||||||
|
parameters = listOf()
|
||||||
|
)
|
|
@ -0,0 +1,32 @@
|
||||||
|
package app.revanced.patches.photomath.detection.deviceid.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.photomath.detection.deviceid.fingerprints.GetDeviceIdFingerprint
|
||||||
|
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([SignatureDetectionPatch::class])
|
||||||
|
@Name("Spoof device ID")
|
||||||
|
@Description("Spoofs device ID to mitigate manual bans by developers.")
|
||||||
|
@Compatibility([Package("com.microblink.photomath")])
|
||||||
|
class SpoofDeviceIdPatch : BytecodePatch(
|
||||||
|
listOf(GetDeviceIdFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) = GetDeviceIdFingerprint.result?.mutableMethod?.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const-string v0, "${Random.nextLong().toString(16)}"
|
||||||
|
return-object v0
|
||||||
|
"""
|
||||||
|
) ?: throw GetDeviceIdFingerprint.exception
|
||||||
|
}
|
|
@ -1,19 +1,11 @@
|
||||||
package app.revanced.patches.photomath.detection.signature.fingerprints
|
package app.revanced.patches.photomath.detection.signature.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
object CheckSignatureFingerprint : MethodFingerprint(
|
object CheckSignatureFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
(methodDef.definingClass == "Lcom/microblink/photomath/main/activity/LauncherActivity;" ||
|
|
||||||
methodDef.definingClass == "Lcom/microblink/photomath/PhotoMath;") &&
|
|
||||||
methodDef.name == "onCreate"
|
|
||||||
},
|
|
||||||
strings = listOf(
|
strings = listOf(
|
||||||
|
"packageInfo.signatures",
|
||||||
"currentSignature"
|
"currentSignature"
|
||||||
),
|
),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
|
|
|
@ -23,5 +23,4 @@ class SignatureDetectionPatch : BytecodePatch(
|
||||||
mutableMethod.replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
|
mutableMethod.replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
|
||||||
} ?: throw CheckSignatureFingerprint.exception
|
} ?: throw CheckSignatureFingerprint.exception
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package app.revanced.patches.photomath.misc.bookpoint.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object IsBookpointEnabledFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(),
|
||||||
|
strings = listOf(
|
||||||
|
"NoGeoData",
|
||||||
|
"NoCountryInGeo",
|
||||||
|
"RemoteConfig",
|
||||||
|
"GeoRCMismatch"
|
||||||
|
)
|
||||||
|
)
|
|
@ -0,0 +1,20 @@
|
||||||
|
package app.revanced.patches.photomath.misc.bookpoint.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patches.photomath.misc.bookpoint.fingerprints.IsBookpointEnabledFingerprint
|
||||||
|
|
||||||
|
@Description("Enables textbook access")
|
||||||
|
class EnableBookpointPatch : BytecodePatch(listOf(IsBookpointEnabledFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext) =
|
||||||
|
IsBookpointEnabledFingerprint.result?.mutableMethod?.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
) ?: throw IsBookpointEnabledFingerprint.exception
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
package app.revanced.patches.photomath.misc.unlockplus.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.microblink.photomath", arrayOf("8.20.0"))])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
internal annotation class UnlockPlusCompatibilty
|
|
|
@ -1,37 +1,30 @@
|
||||||
package app.revanced.patches.photomath.misc.unlockplus.patch
|
package app.revanced.patches.photomath.misc.unlockplus.patch
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
|
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
|
||||||
import app.revanced.patches.photomath.misc.unlockplus.annotations.UnlockPlusCompatibilty
|
import app.revanced.patches.photomath.misc.bookpoint.patch.EnableBookpointPatch
|
||||||
import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint
|
import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Unlock plus")
|
@Name("Unlock plus")
|
||||||
@DependsOn([SignatureDetectionPatch::class])
|
@DependsOn([SignatureDetectionPatch::class, EnableBookpointPatch::class])
|
||||||
@Description("Unlocks plus features.")
|
@Compatibility([Package("com.microblink.photomath")])
|
||||||
@UnlockPlusCompatibilty
|
|
||||||
class UnlockPlusPatch : BytecodePatch(
|
class UnlockPlusPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(IsPlusUnlockedFingerprint)
|
||||||
IsPlusUnlockedFingerprint
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
IsPlusUnlockedFingerprint.result?.mutableMethod?.apply {
|
0,
|
||||||
addInstructions(
|
"""
|
||||||
0,
|
const/4 v0, 0x1
|
||||||
"""
|
return v0
|
||||||
const/4 v0, 0x1
|
"""
|
||||||
return v0
|
) ?: throw IsPlusUnlockedFingerprint.exception
|
||||||
"""
|
|
||||||
)
|
|
||||||
} ?: throw IsPlusUnlockedFingerprint.exception
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue