mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-26 20:21:04 +00:00
refactor(photomath): SpoofDeviceIdPatch
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
package app.revanced.patches.photomath.detection.deviceid
|
||||
|
||||
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val getDeviceIdFingerprint = fingerprint {
|
||||
returns("Ljava/lang/String;")
|
||||
parameters()
|
||||
opcodes(
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
internal val BytecodePatchContext.getDeviceIdMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("Ljava/lang/String;")
|
||||
parameterTypes()
|
||||
instructions(
|
||||
Opcode.SGET_OBJECT(),
|
||||
Opcode.IGET_OBJECT(),
|
||||
Opcode.INVOKE_STATIC(),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.IF_NEZ(),
|
||||
Opcode.INVOKE_STATIC(),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.INVOKE_VIRTUAL(),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.INVOKE_VIRTUAL(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.photomath.detection.deviceid
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.photomath.detection.signature.signatureDetectionPatch
|
||||
import app.revanced.util.returnEarly
|
||||
import kotlin.random.Random
|
||||
|
||||
@Suppress("unused")
|
||||
val getDeviceIdPatch = bytecodePatch(
|
||||
name = "Spoof device ID",
|
||||
val `Spoof device ID` by creatingBytecodePatch(
|
||||
description = "Spoofs device ID to mitigate manual bans by developers.",
|
||||
) {
|
||||
dependsOn(signatureDetectionPatch)
|
||||
@@ -15,6 +14,6 @@ val getDeviceIdPatch = bytecodePatch(
|
||||
compatibleWith("com.microblink.photomath")
|
||||
|
||||
apply {
|
||||
getDeviceIdFingerprint.method.returnEarly(Random.nextLong().toString(16))
|
||||
getDeviceIdMethod.returnEarly(Random.nextLong().toString(16))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user