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
Report unknown device: share a privacy-safe signature; v2.10.0
CIS-C019ea39c3bc97
diff --git a/README.md b/README.mdindex e7fe6f8..2063036 100644--- a/README.md+++ b/README.md@@ -93,7 +93,10 @@ publicly.- OpenStreetMap map with recorded GPS traces and the devices heard along them- **History map & timeline:** a heatmap of where flagged equipment showed up, and when (hour of day, day of week)- Alerts with sound, vibration patterns and spoken announcements, plus a discreet mode-- Android Auto app, Quick Settings tile and home-screen widget+- **Floating threat bubble** over Waze, Google Maps or any other app while scanning+- **Starts by itself in the car** (your car's Bluetooth or Android Auto) and stops when you leave+- Android Auto app with a map of nearby plate cameras and drones, Quick Settings tile and home-screen widget+- **Report unknown device:** share a privacy-safe signature (no full address, serials, location or times) so new equipment can be added- 12 themes, each styled theme with its own animated header**Data**@@ -130,7 +133,16 @@ permission is optional; without it, alerts still play and show in the app.- **Filters and search:** All, Flagged, Trackers, Drones, New, Favorites,Bluetooth, WiFi. Search matches name, address, vendor and type.- **Tap** a device for details. **Long-press** for quick actions: watchlist,- whitelist, favorite, copy.+ whitelist, favorite, copy, and **Report unknown device** for devices with no+ match. The report shows exactly what is shared (vendor prefix, name pattern+ with serial digits hidden, service and manufacturer IDs) before you send it;+ paste it into a [new issue](https://github.com/CIS-C0/RFSentinel/issues/new).+- **Floating bubble** (Settings, needs *Display over other apps*): green when+ clear, orange for a probable match, red for a strong match or a follower,+ with the number of flagged devices. Tap to open the app, drag to move.+- **In the car** (Settings → *Start scanning automatically in the car*): pick+ your car's Bluetooth; scanning starts when the phone connects to it or to+ Android Auto, and stops when you leave if the car started it.### Device details@@ -176,6 +188,9 @@ RF Sentinel runs in Android Auto as a driver-safe, template-based app:- **Device lists** (flagged, drones & trackers, all nearby) and **device details**with Whitelist, Watch and Favorite actions. **Navigate** opens your car'snavigation app for drones with a known position.+- **Plate cameras & drones map:** the closest known plate cameras (downloaded+ on the phone from OpenStreetMap) and Remote ID drones, on the car's map+ with distances.- **Alerts** appear as a heads-up on the car screen. While connected, they playthrough the car speakers as navigation-guidance audio, briefly lowering yourmusic.@@ -230,7 +245,10 @@ Pick a theme in the setup wizard or under **Settings → Appearance**.only when you tap *Download known plate cameras*, the camera list for the area onscreen. Those servers see your IP address and that area, never your scans. Map data© OpenStreetMap contributors (ODbL).-- **Data leaves the phone only when you export it.**+- **Data leaves the phone only when you export or share it.**+- **Optional permissions:** *Nearby devices → connect* is asked only to read the+ names of your paired Bluetooth devices when you pick your car; *Display over+ other apps* only for the floating bubble.## Limitationsdiff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex eaac8e5..31e2883 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -6,8 +6,8 @@ plugins {}// Bump both for every release. versionName ends up in the APK file name.-val appVersionCode = 21-val appVersionName = "2.9.1"+val appVersionCode = 22+val appVersionName = "2.10.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/detect/SignatureReport.kt b/app/src/main/java/com/rfsentinel/app/detect/SignatureReport.ktnew file mode 100644index 0000000..ecbf3a9--- /dev/null+++ b/app/src/main/java/com/rfsentinel/app/detect/SignatureReport.kt@@ -0,0 +1,102 @@+package com.rfsentinel.app.detect++import com.google.gson.GsonBuilder+import com.google.gson.JsonArray+import com.google.gson.JsonObject+import java.util.Locale++/**+ * A shareable "please add this device" report for devices RF Sentinel doesn't+ * recognise yet. It keeps only what a signature is built from (vendor prefix,+ * name pattern, service UUIDs, manufacturer IDs, WiFi security / vendor IEs)+ * and leaves out everything that could identify the device or you: no full+ * address, no serial numbers (digit runs in names become '#'), no payload+ * bytes beyond a short type header, no location and no times.+ */+object SignatureReport {++ const val ISSUE_URL = "https://github.com/CIS-C0/RFSentinel/issues/new"++ /** Payload bytes kept per manufacturer / service-data entry (enough for a type byte, not a serial). */+ private const val HEADER_BYTES = 2++ private val gson = GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create()++ /** Serial-looking digit runs (4+ digits) become '#' per digit; model numbers (e.g. "Forerunner 265") stay. */+ fun namePattern(name: String): String =+ Regex("\\d{4,}").replace(name.trim()) { "#".repeat(it.value.length) }++ fun build(+ advert: Advert,+ vendor: String?,+ deviceType: String?,+ randomized: Boolean,+ userNote: String?,+ appVersion: String+ ): String {+ val o = JsonObject()+ o.addProperty("format", "rfsentinel-signature-report/1")+ o.addProperty("app", appVersion)+ o.addProperty("radio", advert.source.name)+ // Only a real vendor prefix; a randomized address's prefix means nothing.+ if (!randomized) o.addProperty("oui", advert.mac.take(8).uppercase(Locale.US))+ vendor?.takeIf { it.isNotBlank() }?.let { o.addProperty("vendor", it) }+ deviceType?.takeIf { it.isNotBlank() }?.let { o.addProperty("guessedType", it) }+ o.addProperty("addressType", advert.addressType.name)+ advert.name?.takeIf { it.isNotBlank() }?.let { o.addProperty("namePattern", namePattern(it)) }+ advert.connectable?.let { o.addProperty("connectable", it) }+ advert.txPower?.let { o.addProperty("txPower", it) }+ advert.phy?.let { o.addProperty("phy", it) }++ if (advert.serviceUuids.isNotEmpty()) {+ o.add("serviceUuids", JsonArray().apply { advert.serviceUuids.map { uuidText(it) }.distinct().sorted().forEach { add(it) } })+ }+ if (advert.manufacturerData.isNotEmpty()) {+ o.add("manufacturerData", JsonArray().apply {+ advert.manufacturerData.toSortedMap().forEach { (id, bytes) ->+ add(JsonObject().apply {+ addProperty("companyId", String.format(Locale.US, "0x%04X", id))+ addProperty("length", bytes.size)+ addProperty("header", hex(bytes.take(HEADER_BYTES)))+ })+ }+ })+ }+ if (advert.serviceData.isNotEmpty()) {+ o.add("serviceData", JsonArray().apply {+ advert.serviceData.entries.sortedBy { it.key.toString() }.forEach { (uuid, bytes) ->+ add(JsonObject().apply {+ addProperty("uuid", uuidText(uuid))+ addProperty("length", bytes.size)+ addProperty("header", hex(bytes.take(HEADER_BYTES)))+ })+ }+ })+ }+ advert.wifi?.let { w ->+ o.add("wifi", JsonObject().apply {+ addProperty("band", when {+ w.frequencyMhz >= 5925 -> "6 GHz"+ w.frequencyMhz >= 4900 -> "5 GHz"+ else -> "2.4 GHz"+ })+ addProperty("security", w.capabilities)+ w.standard?.let { addProperty("standard", it) }+ if (advert.name.isNullOrBlank()) addProperty("hidden", true)+ // Vendor-specific IEs (221): the OUI says which chipset / maker built the AP.+ val vendorIes = w.infoElements.filter { it.first == 221 && it.second.size >= 3 }+ .map { hex(it.second.take(3), ":") }.distinct().sorted()+ if (vendorIes.isNotEmpty()) add("vendorIeOuis", JsonArray().apply { vendorIes.forEach { add(it) } })+ })+ }+ userNote?.trim()?.takeIf { it.isNotEmpty() }?.let { o.addProperty("whatIThinkItIs", it.take(300)) }+ return gson.toJson(o)+ }++ /** Short form for SIG 16-bit UUIDs, full form for vendor 128-bit ones. */+ private fun uuidText(u: java.util.UUID): String =+ Advert.shortOf(u)?.let { String.format(Locale.US, "0x%04X", it) } ?: u.toString()++ private fun hex(bytes: List<Byte>, sep: String = ""): String =+ bytes.joinToString(sep) { String.format(Locale.US, "%02X", it.toInt() and 0xFF) }+}diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceActions.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceActions.ktindex e300502..de0824e 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceActions.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceActions.kt@@ -3,16 +3,23 @@ package com.rfsentinel.app.uiimport android.content.ClipDataimport android.content.ClipboardManagerimport android.content.Intent+import android.graphics.Typefaceimport android.view.View+import android.widget.EditText+import android.widget.LinearLayout+import android.widget.ScrollView+import android.widget.TextViewimport android.widget.Toastimport androidx.appcompat.app.AlertDialogimport androidx.appcompat.app.AppCompatActivityimport androidx.lifecycle.lifecycleScope+import com.rfsentinel.app.BuildConfigimport com.rfsentinel.app.data.AppDatabaseimport com.rfsentinel.app.data.Favoritesimport com.rfsentinel.app.data.WhitelistCacheimport com.rfsentinel.app.data.WhitelistEntityimport com.rfsentinel.app.databinding.DialogAddWatchlistBinding+import com.rfsentinel.app.detect.SignatureReportimport com.rfsentinel.app.oui.OuiEntryimport com.rfsentinel.app.oui.OuiWatchlistimport com.rfsentinel.app.service.DeviceRegistry@@ -53,6 +60,9 @@ object DeviceActions {toast(activity, if (favorite) "Removed from favorites" else "Added to favorites")}}+ if (snap?.advert != null && snap.best == null) {+ items += "Report unknown device..." to { reportUnknown(activity, mac) }+ }items += "Copy address" to { copy(activity, mac) }AlertDialog.Builder(activity)@@ -94,6 +104,51 @@ object DeviceActions {.show()}+ /**+ * Shares a signature report (see [SignatureReport]) so a device RF Sentinel+ * doesn't know can be added. The user sees exactly what is shared first.+ */+ fun reportUnknown(activity: AppCompatActivity, mac: String) {+ val snap = DeviceRegistry.get(mac)+ val advert = snap?.advert ?: run { toast(activity, "Device no longer in range"); return }+ val d = activity.resources.displayMetrics.density+ val note = EditText(activity).apply { hint = "What do you think it is? (optional)"; setSingleLine(false) }+ val preview = TextView(activity).apply {+ typeface = Typeface.MONOSPACE+ textSize = 11f+ setTextIsSelectable(true)+ }+ fun report() = SignatureReport.build(advert, snap.vendor, snap.deviceType, MacUtil.isRandomized(mac),+ note.text.toString(), BuildConfig.VERSION_NAME)+ preview.text = report()+ val box = LinearLayout(activity).apply {+ orientation = LinearLayout.VERTICAL+ val p = (20 * d).toInt()+ setPadding(p, (8 * d).toInt(), p, 0)+ addView(TextView(activity).apply {+ text = "Shares only what a signature needs: vendor prefix, name pattern (serial digits hidden), " ++ "service and manufacturer IDs. No full address, location or times."+ })+ addView(note)+ addView(preview)+ }+ AlertDialog.Builder(activity)+ .setTitle("Report unknown device")+ .setView(ScrollView(activity).apply { addView(box) })+ .setPositiveButton("Share") { _, _ ->+ val text = "RF Sentinel signature report - please open an issue at\n" ++ SignatureReport.ISSUE_URL + "\n\n" + report()+ activity.startActivity(Intent.createChooser(Intent(Intent.ACTION_SEND).apply {+ type = "text/plain"+ putExtra(Intent.EXTRA_SUBJECT, "New device signature")+ putExtra(Intent.EXTRA_TEXT, text)+ }, "Share signature report"))+ }+ .setNeutralButton("Copy") { _, _ -> copy(activity, report()) }+ .setNegativeButton("Cancel", null)+ .show()+ }+fun whitelist(activity: AppCompatActivity, mac: String, label: String) {AlertDialog.Builder(activity).setTitle("Whitelist this device?")diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.ktindex bc1e78e..575c5ff 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt@@ -364,6 +364,19 @@ class DeviceDetailActivity : AppCompatActivity() {private fun share() {val s = DeviceRegistry.get(mac)+ if (s?.advert != null && s.best == null) {+ androidx.appcompat.app.AlertDialog.Builder(this)+ .setTitle("Share")+ .setItems(arrayOf("Full device report", "Report unknown device (signature only)")) { _, which ->+ if (which == 0) shareFull(s) else DeviceActions.reportUnknown(this, mac)+ }+ .show()+ return+ }+ shareFull(s)+ }++ private fun shareFull(s: DeviceRegistry.Snapshot?) {val text = buildString {appendLine("RF Sentinel device report")appendLine(binding.titleText.text)diff --git a/app/src/test/java/com/rfsentinel/app/detect/SignatureReportTest.kt b/app/src/test/java/com/rfsentinel/app/detect/SignatureReportTest.ktnew file mode 100644index 0000000..ee25c21--- /dev/null+++ b/app/src/test/java/com/rfsentinel/app/detect/SignatureReportTest.kt@@ -0,0 +1,45 @@+package com.rfsentinel.app.detect++import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Test++class SignatureReportTest {++ private fun ble(mac: String, name: String?) = Advert(+ mac = mac, source = Advert.Source.BLE, rssi = -60, name = name,+ manufacturerData = mapOf(0x0A12 to byteArrayOf(0x01, 0x02, 0x33, 0x44, 0x55, 0x66)),+ serviceUuids = listOf(Advert.uuid16(0x180F)),+ addressType = AddressType.PUBLIC, connectable = true+ )++ @Test+ fun namePatternHidesSerialsButKeepsModelDigits() {+ assertEquals("ABCDE#########", SignatureReport.namePattern("ABCDE123456789"))+ assertEquals("Forerunner 265", SignatureReport.namePattern("Forerunner 265"))+ }++ @Test+ fun keepsSignatureFieldsAndDropsIdentifyingOnes() {+ val r = SignatureReport.build(ble("10:20:30:AB:CD:EF", "UNIT-0042"), "Acme", "Printer",+ randomized = false, userNote = "ticket printer", appVersion = "test")+ assertTrue(r.contains("\"oui\": \"10:20:30\""))+ assertTrue(r.contains("UNIT-####"))+ assertTrue(r.contains("0x0A12"))+ assertTrue(r.contains("\"header\": \"0102\""))+ assertTrue(r.contains("0x180F"))+ assertTrue(r.contains("ticket printer"))+ assertFalse("full address leaked", r.contains("AB:CD:EF"))+ assertFalse("serial leaked", r.contains("0042"))+ assertFalse("payload beyond header leaked", r.contains("3344"))+ }++ @Test+ fun randomizedAddressHasNoPrefix() {+ val r = SignatureReport.build(ble("DA:20:30:AB:CD:EF", null), null, null,+ randomized = true, userNote = null, appVersion = "test")+ assertFalse(r.contains("\"oui\""))+ assertFalse(r.contains("DA:20:30"))+ }+}