Skip to content

RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.

2.36.0: mesh node positions and names off the air are checked before they reach the map

CIS-C0fd63a71d7629
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 474b02e..be3f6a0 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -7,8 +7,8 @@ plugins {
}
// Bump both for every release. versionName ends up in the APK file name.
-val appVersionCode = 68
-val appVersionName = "2.35.0"
+val appVersionCode = 69
+val appVersionName = "2.36.0"
// Release signing credentials live in keystore.properties (git-ignored).
// Without that file, release builds are produced unsigned.
diff --git a/app/src/main/java/com/rfsentinel/app/esp/MeshRadio.kt b/app/src/main/java/com/rfsentinel/app/esp/MeshRadio.kt
index 83ff678..9585176 100644
--- a/app/src/main/java/com/rfsentinel/app/esp/MeshRadio.kt
+++ b/app/src/main/java/com/rfsentinel/app/esp/MeshRadio.kt
@@ -77,7 +77,7 @@ class MeshCoreLog(private val nowMs: () -> Long = System::currentTimeMillis) {
val b = ByteBuffer.wrap(f).order(ByteOrder.LITTLE_ENDIAN)
val end = (100 until 132).firstOrNull { f[it].toInt() == 0 } ?: 132
val lat = b.getInt(136); val lon = b.getInt(140)
- return Contact(String(f, 100, end - 100, Charsets.UTF_8), if (lat == 0 && lon == 0) null else lat / 1e6 to lon / 1e6)
+ return Contact(MeshProto.cleanName(String(f, 100, end - 100, Charsets.UTF_8)), MeshProto.spot(lat / 1e6, lon / 1e6))
}
private fun sighting(f: ByteArray): EspSighting {
diff --git a/app/src/main/java/com/rfsentinel/app/link/MeshProto.kt b/app/src/main/java/com/rfsentinel/app/link/MeshProto.kt
index e3b3d63..1c55615 100644
--- a/app/src/main/java/com/rfsentinel/app/link/MeshProto.kt
+++ b/app/src/main/java/com/rfsentinel/app/link/MeshProto.kt
@@ -144,9 +144,16 @@ object MeshProto {
else -> false
}
}
- return long.ifEmpty { short }
+ return cleanName(long.ifEmpty { short })
}
+ /** Node names come off the air: no control characters, and no longer than the firmware allows. */
+ fun cleanName(s: String) = s.filter { !it.isISOControl() }.take(40)
+
+ /** A position off the air, or null when there is no fix or it isn't a place on Earth (the map would refuse it). */
+ fun spot(lat: Double, lon: Double): Pair<Double, Double>? =
+ if ((lat == 0.0 && lon == 0.0) || lat !in -90.0..90.0 || lon !in -180.0..180.0) null else lat to lon
+
/** A Position message as latitude to longitude, or null without a fix. */
fun position(b: ByteArray): Pair<Double, Double>? {
var lat = 0; var lon = 0
@@ -158,7 +165,7 @@ object MeshProto {
else -> false
}
}
- return if (lat == 0 && lon == 0) null else lat / 1e7 to lon / 1e7
+ return spot(lat / 1e7, lon / 1e7)
}
private fun readMyInfo(b: ByteArray): From {
diff --git a/app/src/main/java/com/rfsentinel/app/usb/NOTICE.md b/app/src/main/java/com/rfsentinel/app/usb/NOTICE.md
index 765ec99..36d18d2 100644
--- a/app/src/main/java/com/rfsentinel/app/usb/NOTICE.md
+++ b/app/src/main/java/com/rfsentinel/app/usb/NOTICE.md
@@ -31,6 +31,7 @@ These drivers run USB WiFi adapters in receive-only monitor mode from userspace.
| RTL8814AU register tables | Realtek 8814au driver, as used by Wardrive Go | GPL-2.0 |
| AR9271 register tables | Linux `ath9k` (`ar9002_initvals.h`), as used by Wardrive Go | ISC |
| MT7610U bring-up, channel tuning and calibration; register tables in `Mt7610uTables.kt` | Linux `mt76x0` (`initvals.h`, `initvals_init.h`, `initvals_phy.h`, `phy.c`, `init.c`, `usb.c`, `usb_mcu.c`; Ralink Technology, Felix Fietkau, Jakub Kicinski, Stanislaw Gruszka, Lorenzo Bianconi) | GPL-2.0 |
+| MeshCore companion radio protocol in `esp/MeshRadio.kt` (written from the protocol, no code copied) | [MeshCore](https://meshcore.co.uk) | MIT |
| MT7610U firmware `mt7610u.bin` (unmodified, from linux-firmware) | Ralink, a MediaTek company | Redistributable binary, see `assets/usbwifi/LICENCE.ralink_a_mediatek_company_firmware` |
| MT7612U firmware `mt7662.bin` and ROM patch `mt7662_rom_patch.bin` (unmodified, from linux-firmware) | Ralink, a MediaTek company | Redistributable binary, see `assets/usbwifi/LICENCE.ralink_a_mediatek_company_firmware` |
| MT7921AU userspace USB driver (WFSYS reset, USB / WFDMA setup, ROM patch and firmware download, MCU command framing, efuse calibration push, monitor filters and sniffer mode, channel switching, RX descriptor parsing) | [mt76-usb-macos](https://github.com/Network-Weather/mt76-usb-macos) by Network Weather (Copyright (c) 2026 Primatech Paper Co LLC d/b/a Network Weather), a transcription of the MT7921 path of the Linux mt76 driver ([openwrt/mt76](https://github.com/openwrt/mt76): Copyright (C) 2020-2023 MediaTek Inc., (C) 2018 Lorenzo Bianconi, (C) 2016 Felix Fietkau) | BSD-3-Clause-Clear |
diff --git a/app/src/test/java/com/rfsentinel/app/esp/MeshRadioTest.kt b/app/src/test/java/com/rfsentinel/app/esp/MeshRadioTest.kt
index f67a6d4..5aedd3f 100644
--- a/app/src/test/java/com/rfsentinel/app/esp/MeshRadioTest.kt
+++ b/app/src/test/java/com/rfsentinel/app/esp/MeshRadioTest.kt
@@ -80,6 +80,19 @@ class MeshRadioTest {
assertEquals(listOf<Byte>(5, 9), c.feed(reply, reply.size).single().toList())
}
+ @Test
+ fun offTheAirValuesAreChecked() {
+ assertNull(MeshProto.spot(214.7, 10.0))
+ assertNull(MeshProto.spot(10.0, -214.7))
+ assertNull(MeshProto.spot(0.0, 0.0))
+ assertEquals(10.5 to -20.5, MeshProto.spot(10.5, -20.5))
+ assertEquals("ab", MeshProto.cleanName("a
+b"))
+ assertEquals(40, MeshProto.cleanName("x".repeat(200)).length)
+ val log = MeshCoreLog { 0 }
+ assertNull(log.feed(contact(0x8A, "Bad", 2_000_000_000, 5))!!.position)
+ }
+
@Test
fun selfInfoAndStartCommand() {
assertTrue(MeshCoreLog.isSelfInfo(ByteArray(58).also { it[0] = 5 }))