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:
oSumAtrIX 2025-04-15 12:53:26 +02:00 committed by GitHub
parent 36e25966c8
commit d639151641
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 92 additions and 24 deletions

View File

@ -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;
}

View File

@ -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"
)
}

View File

@ -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
}
}
}

View File

@ -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)
}