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.
Kotlin airtagalprandroidandroid-autoanti-surveillancebluetooth-low-energybody-cameracounter-surveillancedrone-detectionflock-safetyimsi-catcher-detectorpolice-detectorpolice-scannerprivacyremote-idrtl-sdrsdrsurveillance-detectiontracker-detectionwifi
Trackability from what was seen, not just the address type
CIS-C058be87323796
diff --git a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt b/app/src/main/java/com/rfsentinel/app/detect/Advert.ktindex 3ad3899..8053dd0 100644--- a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/Advert.kt@@ -88,7 +88,25 @@ enum class AddressType(val label: String, val trackable: String) {LIKELY_NON_RESOLVABLE("Probably non-resolvable private", "Probably rotates - not trackable"),UNKNOWN("Unknown", "This phone's Bluetooth didn't report the address type");+ /**+ * How trackable the device is in practice (after MetaRadar): what its address type says,+ * corrected by what this app saw - the same address on several days, or its new random+ * address linked to the old one by its advert fingerprint.+ */+ fun trackability(firstSeen: Long?, lastSeen: Long?, sessions: Int, rotationLinked: Boolean): String {+ val days = if (firstSeen != null && lastSeen != null) ((lastSeen - firstSeen) / DAY_MS).toInt() else 0+ return when {+ sessions >= 2 && days >= 1 ->+ "Trackable: the same address was heard over ${days + 1} days, in $sessions scans"+ rotationLinked -> "$trackable, but its new address was linked to the old one by its advert, so it can still be followed"+ sessions >= 2 -> "$trackable · same address in $sessions scans within a day"+ else -> trackable+ }+ }+companion object {+ private const val DAY_MS = 24 * 60 * 60_000L+/** Sub-type of a BLE random address from its most significant byte. */fun ofRandom(mac: String): AddressType {val msb = mac.take(2).toIntOrNull(16) ?: return UNKNOWNdiff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.ktindex 55b4c44..72a1121 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt@@ -237,7 +237,8 @@ class DeviceDetailActivity : AppCompatActivity() {}if (s != null) {id += "Address type" to s.addressType.label- id += "Trackability" to s.addressType.trackable+ id += "Trackability" to s.addressType.trackability(known?.firstSeen, known?.lastSeen, known?.sessions ?: 0,+ com.rfsentinel.app.service.DeviceRegistry.linkedFrom(mac) != null)id += "Radio" to s.sources.joinToString(" + ") { if (it == Advert.Source.BLE) "Bluetooth LE" else "WiFi" }}a?.connectable?.let { id += "Connectable" to if (it) "Yes (accepts connections)" else "No (broadcast only)" }diff --git a/app/src/test/java/com/rfsentinel/app/detect/TrackabilityTest.kt b/app/src/test/java/com/rfsentinel/app/detect/TrackabilityTest.ktnew file mode 100644index 0000000..4b04f8e--- /dev/null+++ b/app/src/test/java/com/rfsentinel/app/detect/TrackabilityTest.kt@@ -0,0 +1,27 @@+package com.rfsentinel.app.detect++import org.junit.Assert.assertEquals+import org.junit.Assert.assertTrue+import org.junit.Test++class TrackabilityTest {++ private val day = 24 * 60 * 60_000L++ @Test+ fun theSameAddressOnSeveralDaysIsTrackableWhateverItsType() {+ assertEquals("Trackable: the same address was heard over 3 days, in 4 scans",+ AddressType.LIKELY_RPA.trackability(0, 2 * day + 5, 4, false))+ }++ @Test+ fun aLinkedRotationCanStillBeFollowed() {+ assertTrue(AddressType.RESOLVABLE_PRIVATE.trackability(null, null, 0, true).contains("can still be followed"))+ }++ @Test+ fun withoutHistoryItIsTheAddressType() {+ assertEquals(AddressType.PUBLIC.trackable, AddressType.PUBLIC.trackability(null, null, 0, false))+ assertTrue(AddressType.RANDOM_STATIC.trackability(0, 3_600_000, 2, false).endsWith("2 scans within a day"))+ }+}