-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
137 additions
and
60 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
org.gradle.parallel = true | ||
org.gradle.caching = true | ||
kotlin.code.style = official | ||
version = 2.189.0 | ||
version = 2.190.0-dev.3 |
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
.../app/revanced/patches/photomath/detection/deviceid/fingerprints/GetDeviceIdFingerprint.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,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() | ||
) |
32 changes: 32 additions & 0 deletions
32
...main/kotlin/app/revanced/patches/photomath/detection/deviceid/patch/SpoofDeviceIdPatch.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,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 | ||
} |
10 changes: 1 addition & 9 deletions
10
.../revanced/patches/photomath/detection/signature/fingerprints/CheckSignatureFingerprint.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
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
17 changes: 17 additions & 0 deletions
17
...p/revanced/patches/photomath/misc/bookpoint/fingerprints/IsBookpointEnabledFingerprint.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,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" | ||
) | ||
) |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/app/revanced/patches/photomath/misc/bookpoint/patch/EnableBookpointPatch.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,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 | ||
} |
8 changes: 0 additions & 8 deletions
8
...tlin/app/revanced/patches/photomath/misc/unlockplus/annotations/UnlockPlusCompatibilty.kt
This file was deleted.
Oops, something went wrong.
33 changes: 13 additions & 20 deletions
33
src/main/kotlin/app/revanced/patches/photomath/misc/unlockplus/patch/UnlockPlusPatch.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 |
---|---|---|
@@ -1,37 +1,30 @@ | ||
package app.revanced.patches.photomath.misc.unlockplus.patch | ||
|
||
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.Package | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
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.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 | ||
|
||
@Patch | ||
@Name("Unlock plus") | ||
@DependsOn([SignatureDetectionPatch::class]) | ||
@Description("Unlocks plus features.") | ||
@UnlockPlusCompatibilty | ||
@DependsOn([SignatureDetectionPatch::class, EnableBookpointPatch::class]) | ||
@Compatibility([Package("com.microblink.photomath")]) | ||
class UnlockPlusPatch : BytecodePatch( | ||
listOf( | ||
IsPlusUnlockedFingerprint | ||
) | ||
listOf(IsPlusUnlockedFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
IsPlusUnlockedFingerprint.result?.mutableMethod?.apply { | ||
addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
) | ||
} ?: throw IsPlusUnlockedFingerprint.exception | ||
} | ||
|
||
override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
) ?: throw IsPlusUnlockedFingerprint.exception | ||
} |
21 changes: 13 additions & 8 deletions
21
...es/reddit/customclients/infinityforreddit/api/fingerprints/AbstractClientIdFingerprint.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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.iface.ClassDef | ||
import com.android.tools.smali.dexlib2.iface.Method | ||
|
||
abstract class AbstractClientIdFingerprint(classTypeSuffix: String, methodName: String) : MethodFingerprint( | ||
strings = listOf("NOe2iKrPPzwscA"), | ||
customFingerprint = custom@{ methodDef, classDef -> | ||
if (!classDef.type.endsWith(classTypeSuffix)) return@custom false | ||
|
||
methodDef.name == methodName | ||
} | ||
) | ||
/** | ||
* Fingerprint for a method that has the client id hardcoded in it. | ||
* The first string in the fingerprint is the client id. | ||
* | ||
* @param customFingerprint A custom fingerprint. | ||
* @param additionalStrings Additional strings to add to the fingerprint. | ||
*/ | ||
abstract class AbstractClientIdFingerprint( | ||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null, | ||
vararg additionalStrings: String | ||
) : MethodFingerprint(strings = listOf("NOe2iKrPPzwscA", *additionalStrings), customFingerprint = customFingerprint) |
5 changes: 1 addition & 4 deletions
5
...dit/customclients/infinityforreddit/api/fingerprints/GetHttpBasicAuthHeaderFingerprint.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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints | ||
|
||
object GetHttpBasicAuthHeaderFingerprint : AbstractClientIdFingerprint( | ||
"APIUtils;", | ||
"getHttpBasicAuthHeader" | ||
) | ||
object GetHttpBasicAuthHeaderFingerprint : AbstractClientIdFingerprint(additionalStrings = arrayOf("Authorization")) |
7 changes: 3 additions & 4 deletions
7
...ddit/customclients/infinityforreddit/api/fingerprints/LoginActivityOnCreateFingerprint.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints | ||
|
||
object LoginActivityOnCreateFingerprint : AbstractClientIdFingerprint( | ||
"LoginActivity;", | ||
"onCreate" | ||
) | ||
object LoginActivityOnCreateFingerprint : AbstractClientIdFingerprint(custom@{ methodDef, classDef -> | ||
methodDef.name == "onCreate" && classDef.type.endsWith("LoginActivity;") | ||
}) |
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
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
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
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
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