Skip to content

Commit

Permalink
refactored to work with newer version
Browse files Browse the repository at this point in the history
  • Loading branch information
Slenderman00 committed Sep 1, 2023
1 parent b3a2027 commit bfa7ac6
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 64 deletions.
8 changes: 8 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Aug 20 19:15:15 CEST 2023
sdk.dir=/home/joar/Android/Sdk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.grindr.fingerprints.GetMessagingCertFingerprint
import app.revanced.patches.grindr.fingerprints.GetReqistrationCertFingerprint
import app.revanced.patches.grindr.Constants.SPOOFED_PACKAGE_SIGNATURE
Expand All @@ -27,7 +26,8 @@ class FirebaseGetCertPatch : BytecodePatch(
GetMessagingCertFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {

val spoofedInstruction =
"""
const-string v0, "$SPOOFED_PACKAGE_SIGNATURE"
Expand All @@ -46,6 +46,5 @@ class FirebaseGetCertPatch : BytecodePatch(
spoofedInstruction
)

return PatchResultSuccess()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

//a

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

//b

Expand All @@ -28,18 +28,3 @@ object InnaccessibleProfileManagerbFingerprint : MethodFingerprint(
Opcode.RETURN
),
)

@FuzzyPatternScanMethod(2)
object InnaccessibleProfileManagerdFingerprint : MethodFingerprint(
"Z",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.XOR_INT_LIT8,
Opcode.RETURN,
),
customFingerprint = { methodDef, _ ->
methodDef.name.contains("d")
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app.revanced.patches.grindr.unlimited.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

//d

object InnaccessibleProfileManagerdFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.name == "d" && methodDef.definingClass.contains("InaccessibleProfileManager")
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

object IsFreeFingerprint : MethodFingerprint(
"Z",
accessFlags = AccessFlags.PUBLIC.value,
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT,
Opcode.RETURN
),
customFingerprint = { methodDef, _ ->
methodDef.name.contains("r")
methodDef.name == "r" && methodDef.definingClass.endsWith("storage/s0;")
}

)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

//A

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

object IsNoXtraUpsellFingerprint : MethodFingerprint(
"Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

object IsPlusFingerprint : MethodFingerprint(
"Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

object IsUnlimitedFingerprint : MethodFingerprint(
"Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

object IsXtraFingerprint : MethodFingerprint(
"Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app.revanced.patches.grindr.unlimited.fingerprints
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
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

//A

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package app.revanced.patches.grindr.unlimited.patch

import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.extensions.exception

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.grindr.unlimited.annotations.UnlockUnlimitedCompatibility
import app.revanced.patches.grindr.unlimited.fingerprints.*
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction

import app.revanced.patches.grindr.patch.bytecode.FirebaseGetCertPatch
Expand All @@ -37,7 +37,7 @@ class UnlockUnlimitedPatch : BytecodePatch(
InnaccessibleProfileManagerdFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {

val _true = """
const/4 v0, 0x1
Expand All @@ -58,67 +58,66 @@ class UnlockUnlimitedPatch : BytecodePatch(
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return HasFeatureFingerprint.toErrorResult()
} ?: throw HasFeatureFingerprint.exception

IsFreeFingerprint.result?.let { result ->
println("Found IsFreeFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _false)
addInstruction(3, """
xor-int/lit8 v0, v0, 0x1
""".trimIndent())
}
} ?: return IsFreeFingerprint.toErrorResult()
} ?: throw IsFreeFingerprint.exception

IsNoPlusUpsellFingerprint.result?.let { result ->
println("Found IsNoPlusUpsellFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return IsNoPlusUpsellFingerprint.toErrorResult()
} ?: throw IsNoPlusUpsellFingerprint.exception

IsNoXtraUpsellFingerprint.result?.let { result ->
println("Found IsNoXtraUpsellFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return IsNoXtraUpsellFingerprint.toErrorResult()
} ?: throw IsNoXtraUpsellFingerprint.exception

IsPlusFingerprint.result?.let { result ->
println("Found IsPlusFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return IsPlusFingerprint.toErrorResult()
} ?: throw IsPlusFingerprint.exception

IsUnlimitedFingerprint.result?.let { result ->
println("Found IsUnlimitedFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return IsUnlimitedFingerprint.toErrorResult()
} ?: throw IsUnlimitedFingerprint.exception

IsXtraFingerprint.result?.let { result ->
println("Found IsXtraFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return IsXtraFingerprint.toErrorResult()
} ?: throw IsXtraFingerprint.exception

//this must always be true
InnaccessibleProfileManagerbFingerprint.result?.let { result ->
println("Found InnaccessibleProfileManagerbFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _true)
}
} ?: return InnaccessibleProfileManagerbFingerprint.toErrorResult()
} ?: throw InnaccessibleProfileManagerbFingerprint.exception

//this must always be false (the opposite of InnaccessibleProfileManagerbFingerprint)
InnaccessibleProfileManagerdFingerprint.result?.let { result ->
println("Found InnaccessibleProfileManagerdFingerprint!")
result.mutableMethod.apply {
replaceInstructions(0, _false)
replaceInstructions(2, _false)
}
} ?: return InnaccessibleProfileManagerdFingerprint.toErrorResult()


return PatchResultSuccess()
} ?: throw InnaccessibleProfileManagerdFingerprint.exception
}
}

0 comments on commit bfa7ac6

Please sign in to comment.