communicate: WhatsApp registration - send official no-Play device fingerprint (network/sim_operator_name, airplane_mode_on, device_ram) from F4L decompile; integrity stays off (no gpia/aid/_gi in no-Play path)
- Commit
ef3f35747de6cd4335750fc88c208da6d38162cb- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-16 20:02 UTC (3 months ago)
- Parents
3734d09
Diff
communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.ktindex 0c75bbda12..fae90576ce 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt@@ -2,6 +2,7 @@ package com.vayunmathur.communicate.data.whatsapp.registration import android.content.Context import android.os.Build+import android.provider.Settings import android.telephony.TelephonyManager import android.util.Log import com.vayunmathur.communicate.data.whatsapp.WhatsAppAuthData@@ -408,9 +409,12 @@ class RegistrationHttpClient( /** * Common/device params added by the APK's `F4L` layer (merged via `A06(map)`). Confirmed- * against the native param-key table in libwhatsappmerged.so: WhatsApp does NOT send a- * `platform` form param — the server derives platform from the User-Agent — so we must not- * send one. These device fields are the real F4L set; values are URL-safe.+ * against the native param-key table in libwhatsappmerged.so AND by decompiling `LX/F4L;`+ * (A0I/A0M/A0P/A0G) from the installed com.whatsapp 2.26.29.73: WhatsApp does NOT send a+ * `platform` form param — the server derives platform from the User-Agent — and it does NOT+ * send any `gpia`/`aid`/`_gi`/`_gp`/`_ge`/`_ga`/`_gs`/`t`/`db` params in the no-Play path+ * (`gpia` is added only when Play Integrity is available; see [SEND_INTEGRITY_SIGNALS]). The+ * fields below are the real F4L device fingerprint the official no-Play request carries. */ fun addDevice() { val tm = runCatching { context.getSystemService(TelephonyManager::class.java) }.getOrNull()@@ -425,8 +429,25 @@ class RegistrationHttpClient( a01("hasinrc", "0") a01("pid", android.os.Process.myPid().toString()) a01("rc", "0")+ // Honest device fingerprint the official no-Play /v2 request includes (RE of LX/F4L;+ // A0G/A0M/A0P). All standard, non-Play, non-attestation signals.+ a01("network_operator_name", tm?.networkOperatorName.orEmpty())+ a01("sim_operator_name", tm?.simOperatorName.orEmpty())+ a01("airplane_mode_on", airplaneModeOn())+ a01("device_ram", deviceRamBytes()) } + private fun airplaneModeOn(): String = runCatching {+ if (Settings.Global.getInt(context.contentResolver, Settings.Global.AIRPLANE_MODE_ON, 0) != 0) "1" else "0"+ }.getOrDefault("0")++ private fun deviceRamBytes(): String = runCatching {+ val am = context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager+ val mi = android.app.ActivityManager.MemoryInfo()+ am.getMemoryInfo(mi)+ mi.totalMem.toString()+ }.getOrDefault("0")+ fun query(): String = map.entries.joinToString("&") { (k, v) -> val encoded = if (k in raw) v else URLEncoder.encode(v, "UTF-8") "$k=$encoded"
communicate/src/test/java/com/vayunmathur/communicate/whatsapp/WhatsAppRegistrationBadParamRegressionTest.kt
diff --git a/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/WhatsAppRegistrationBadParamRegressionTest.kt b/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/WhatsAppRegistrationBadParamRegressionTest.ktindex c436c611bc..862e8d8a22 100644--- a/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/WhatsAppRegistrationBadParamRegressionTest.kt+++ b/communicate/src/test/java/com/vayunmathur/communicate/whatsapp/WhatsAppRegistrationBadParamRegressionTest.kt@@ -446,6 +446,24 @@ class WhatsAppRegistrationBadParamRegressionTest { assertEquals("com.whatsapp", WhatsAppRegistrationConstants.PACKAGE_NAME) } + @Test+ fun addDevice_includesOfficialNoPlayFingerprint() {+ // The official no-Play /v2 request (RE of LX/F4L; A0I/A0M/A0P/A0G) carries these honest+ // device signals; we must send them (none are Play/attestation signals).+ val src = tryReadSource("communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt")+ ?: tryReadSource("src/main/java/com/vayunmathur/communicate/data/whatsapp/registration/RegistrationHttpClient.kt")+ if (src != null) {+ val idx = src.indexOf("fun addDevice")+ assertTrue(idx >= 0, "addDevice must exist")+ val snip = src.substring(idx, minOf(src.length, idx + 1800))+ for (p in listOf("mcc", "mnc", "sim_mcc", "sim_mnc", "network_radio_type", "simnum",+ "hasinrc", "pid", "rc", "network_operator_name", "sim_operator_name",+ "airplane_mode_on", "device_ram")) {+ assertTrue(snip.contains("\"$p\""), "addDevice must send device param $p")+ }+ }+ }+ @Test fun eKeytype_constants_matchSpec() { assertEquals(0x05.toByte(), WhatsAppRegistrationConstants.KEY_TYPE_CURVE25519)