mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-29 14:14:28 +02:00
fix(Spotify): Fix login by replacing Spoof signature
patch with new Spoof package info
patch (#4794)
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
parent
36e25966c8
commit
d639151641
@ -842,6 +842,10 @@ public final class app/revanced/patches/spotify/misc/extension/ExtensionPatchKt
|
||||
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatchKt {
|
||||
public static final fun getSpoofPackageInfoPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/misc/fix/SpoofSignaturePatchKt {
|
||||
public static final fun getSpoofSignaturePatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
@ -2,4 +2,16 @@ package app.revanced.patches.spotify.misc.fix
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val getAppSignatureFingerprint = fingerprint { strings("Failed to get the application signatures") }
|
||||
internal val getPackageInfoFingerprint = fingerprint {
|
||||
strings(
|
||||
"Failed to get the application signatures",
|
||||
"Failed to get installer package"
|
||||
)
|
||||
}
|
||||
|
||||
internal val getPackageInfoLegacyFingerprint = fingerprint {
|
||||
strings(
|
||||
"Failed to get the application signatures"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,72 @@
|
||||
package app.revanced.patches.spotify.misc.fix
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.spotify.misc.extension.IS_SPOTIFY_LEGACY_APP_TARGET
|
||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Suppress("unused")
|
||||
val spoofPackageInfoPatch = bytecodePatch(
|
||||
name = "Spoof package info",
|
||||
description = "Spoofs the package info of the app to fix various functions of the app.",
|
||||
) {
|
||||
compatibleWith("com.spotify.music")
|
||||
|
||||
execute {
|
||||
val getPackageInfoFingerprint = if (IS_SPOTIFY_LEGACY_APP_TARGET) {
|
||||
getPackageInfoLegacyFingerprint
|
||||
} else {
|
||||
getPackageInfoFingerprint
|
||||
}
|
||||
|
||||
getPackageInfoFingerprint.method.apply {
|
||||
val stringMatches = getPackageInfoFingerprint.stringMatches!!
|
||||
|
||||
// region Spoof signature.
|
||||
|
||||
val failedToGetSignaturesStringIndex = stringMatches.first().index
|
||||
|
||||
val concatSignaturesIndex = indexOfFirstInstructionReversedOrThrow(
|
||||
failedToGetSignaturesStringIndex,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
)
|
||||
|
||||
val signatureRegister = getInstruction<OneRegisterInstruction>(concatSignaturesIndex).registerA
|
||||
val expectedSignature = "d6a6dced4a85f24204bf9505ccc1fce114cadb32"
|
||||
|
||||
replaceInstruction(concatSignaturesIndex, "const-string v$signatureRegister, \"$expectedSignature\"")
|
||||
|
||||
// endregion
|
||||
|
||||
// region Spoof installer name.
|
||||
|
||||
if (IS_SPOTIFY_LEGACY_APP_TARGET) {
|
||||
// Installer name is not used in the legacy app target.
|
||||
return@execute
|
||||
}
|
||||
|
||||
val expectedInstallerName = "com.android.vending"
|
||||
|
||||
val returnInstallerNameIndex = indexOfFirstInstructionOrThrow(
|
||||
stringMatches.last().index,
|
||||
Opcode.RETURN_OBJECT
|
||||
)
|
||||
|
||||
val installerNameRegister = getInstruction<OneRegisterInstruction>(
|
||||
returnInstallerNameIndex
|
||||
).registerA
|
||||
|
||||
addInstructionsAtControlFlowLabel(
|
||||
returnInstallerNameIndex,
|
||||
"const-string v$installerNameRegister, \"$expectedInstallerName\""
|
||||
)
|
||||
|
||||
// endregion
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +1,13 @@
|
||||
package app.revanced.patches.spotify.misc.fix
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Deprecated("Superseded by spoofPackageInfoPatch", ReplaceWith("spoofPackageInfoPatch"))
|
||||
@Suppress("unused")
|
||||
val spoofSignaturePatch = bytecodePatch(
|
||||
name = "Spoof signature",
|
||||
description = "Spoofs the signature of the app to fix various functions of the app.",
|
||||
description = "Spoofs the signature of the app fix various functions of the app.",
|
||||
) {
|
||||
compatibleWith("com.spotify.music")
|
||||
|
||||
execute {
|
||||
getAppSignatureFingerprint.method.apply {
|
||||
val failedToGetSignaturesStringMatch = getAppSignatureFingerprint.stringMatches!!.first()
|
||||
|
||||
val concatSignaturesIndex = indexOfFirstInstructionReversedOrThrow(
|
||||
failedToGetSignaturesStringMatch.index,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
)
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(concatSignaturesIndex).registerA
|
||||
|
||||
val expectedSignature = "d6a6dced4a85f24204bf9505ccc1fce114cadb32"
|
||||
|
||||
replaceInstruction(concatSignaturesIndex, "const-string v$register, \"$expectedSignature\"")
|
||||
}
|
||||
}
|
||||
dependsOn(spoofPackageInfoPatch)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user