mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-25 11:41:04 +00:00
refactor(nunl): SpoofCertificatePatch
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
package app.revanced.patches.nunl.firebase
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patcher.BytecodePatchContextMethodMatching.firstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.definingClass
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val getFingerprintHashForPackageFingerprints = arrayOf(
|
||||
internal val firebaseClasses = arrayOf(
|
||||
"Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;",
|
||||
"Lcom/google/firebase/remoteconfig/internal/ConfigFetchHttpClient;",
|
||||
"Lcom/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient;"
|
||||
).map { className ->
|
||||
fingerprint {
|
||||
accessFlags(AccessFlags.PRIVATE)
|
||||
parameters()
|
||||
returns("Ljava/lang/String;")
|
||||
)
|
||||
|
||||
custom { methodDef, classDef ->
|
||||
classDef.type == className && methodDef.name == "getFingerprintHashForPackage"
|
||||
}
|
||||
}
|
||||
internal fun BytecodePatchContext.getFingerprintHashForPackageMethod(className: String) = firstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PRIVATE)
|
||||
definingClass(className)
|
||||
name("getFingerprintHashForPackage")
|
||||
returnType("Ljava/lang/String;")
|
||||
parameterTypes()
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package app.revanced.patches.nunl.firebase
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
@Suppress("unused")
|
||||
val spoofCertificatePatch = bytecodePatch(
|
||||
name = "Spoof certificate",
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Spoof certificate` by creatingBytecodePatch(
|
||||
description = "Spoofs the X-Android-Cert header to allow push messages.",
|
||||
) {
|
||||
compatibleWith("nl.sanomamedia.android.nu")
|
||||
|
||||
apply {
|
||||
getFingerprintHashForPackageFingerprints.forEach { fingerprint ->
|
||||
fingerprint.method.returnEarly("eae41fc018df2731a9b6ae1ac327da44a288667b")
|
||||
firebaseClasses.forEach { className ->
|
||||
getFingerprintHashForPackageMethod(className).returnEarly("eae41fc018df2731a9b6ae1ac327da44a288667b")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user