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
Probe shape: FlipDeFlock's probe-request skeleton hash
CIS-C0ee08ebed80b5
diff --git a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt b/app/src/main/java/com/rfsentinel/app/detect/Advert.ktindex 6463c7f..3ad3899 100644--- a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/Advert.kt@@ -45,7 +45,9 @@ class Advert(/** The client sent a wildcard probe request (asks every network to answer, names none). */val wildcardProbe: Boolean = false,/** Its probe request carried the Wi-Fi Alliance element 50:6F:9A:16 03 01 03 Flock cameras send. */- val flockProbeIe: Boolean = false+ val flockProbeIe: Boolean = false,+ /** FlipDeFlock's probe skeleton hash of a client's probe requests (USB adapter). */+ val probeSkeleton: Long? = null)val isBle get() = source == Source.BLEdiff --git a/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt b/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.ktindex b485bb5..91dd09d 100644--- a/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt@@ -30,6 +30,20 @@ object SignatureEngine {private const val IEEE = "IEEE registry"private const val ASTM = "ASTM F3411 Remote ID (opendroneid-core-c, Apache-2.0)"private const val SIGNALSWEEP = "SignalSweep research (GPL-3.0; facts only, no code)"+ private const val FLIPDEFLOCK = "FlipDeFlock (GPL-3.0) probe IE fingerprints"++ /** FlipDeFlock's candidate Flock probe shapes ([com.rfsentinel.app.usb.ProbeIntel.skeletonHash]), single-report. */+ private val FLOCK_PROBE_SHAPES = mapOf(+ 0x42D75CD1L to "seen on a Flock camera's 70:C9:4E module",+ 0xD0BBEC4CL to "seen on Flock 24:B2:B9 and 70:08:94 modules"+ )++ /** Probe shapes FlipDeFlock found on ordinary phones and ESP32 boards: never a camera sign. */+ private val COMMON_PROBE_SHAPES = setOf(0x96FCD1B2L, 0x173D7A70L, 0x7C923B53L, 0x89C3DEBFL, 0xC59C341FL, 0xBA9FAFA0L)++ /** What a probe shape is known as, for the detail screen. */+ fun probeShapeNote(shape: Long): String? = FLOCK_PROBE_SHAPES[shape]?.let { "same as a Flock camera's ($it), unconfirmed" }+ ?: if (shape in COMMON_PROBE_SHAPES) "common to phones and ESP32 boards" else null// --- Bluetooth SIG company IDs (manufacturer data, AD 0xFF) ---------------private const val CID_APPLE = 0x004C@@ -491,6 +505,17 @@ object SignatureEngine {"11 of 12 cameras with 2 false alarms; ordinary devices with the same chip can match - verify","$SIGNALSWEEP; DeFlock / flock-you research")}+ // FlipDeFlock's candidate probe shapes: how a Flock camera lays out its probe requests,+ // which stays the same when it randomizes its address. Single-report, so weak.+ val shape = w?.probeSkeleton+ if (w != null && w.client && shape != null && shape in FLOCK_PROBE_SHAPES) {+ val prefix = a.mac.replace(":", "").uppercase().take(6)+ val onFlockModule = !isLocallyAdministered(a.mac) && prefix in FLOCK_PROBE_PREFIXES+ hits += Hit(Category.ALPR, "Possible Flock camera (probe shape)", if (onFlockModule) 50 else 35,+ "Its probe requests are built exactly like a Flock camera's (shape ${"%08x".format(shape)}, " ++ "${FLOCK_PROBE_SHAPES[shape]})" + (if (onFlockModule) " on a module Flock cameras use (${fmtPrefix(prefix)})" else "") ++ ". One report so far, and other devices can share a shape - verify", FLIPDEFLOCK)+ }// Axon body cameras open their own network while pairing (Axon's admin documentation).if (a.wifi?.client != true) axonPairingSsid(ssid)?.let { hits += it }if (ssid.startsWith("ARLO_VMB_") || ssid.startsWith("NTGR_VMB_")) {diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.ktindex 54880b7..6e1b348 100644--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt@@ -639,8 +639,9 @@ class ScanForegroundService : Service() {* its WPS maker / model / name and its probe fingerprint. All checked against the watchlist.*/private fun noteProbes(mac: String, ssids: List<String>, rssi: Int, now: Long,- wps: com.rfsentinel.app.usb.ProbeIntel.Wps? = null, fingerprint: String? = null, hidden: Boolean = false) {- com.rfsentinel.app.usb.ProbeIntel.note(mac, wps, fingerprint, ssids, hidden)+ wps: com.rfsentinel.app.usb.ProbeIntel.Wps? = null, fingerprint: String? = null, hidden: Boolean = false,+ skeleton: Long? = null) {+ com.rfsentinel.app.usb.ProbeIntel.note(mac, wps, fingerprint, ssids, hidden, skeleton)// Kept in the requested-networks list when that's on, and always while a trace records.if (ssids.isNotEmpty()) com.rfsentinel.app.data.ProbeLog.record(this, mac, ssids, rssi, now, force = TripRecorder.isRecording)val hits = OuiWatchlist.probeHits(ssids) + OuiWatchlist.fingerprintHits(fingerprint) + OuiWatchlist.wpsHits(wps)@@ -655,13 +656,13 @@ class ScanForegroundService : Service() {val now = System.currentTimeMillis()val mac = com.rfsentinel.app.util.MacUtil.normalize(m.mac)com.rfsentinel.app.esp.HeardBy.usb.mark(mac, now)- noteProbes(mac, m.probedSsids, m.rssi, now, m.wps, m.fingerprint, m.hiddenNetwork)+ noteProbes(mac, m.probedSsids, m.rssi, now, m.wps, m.fingerprint, m.hiddenNetwork, m.probeSkeleton)process(Advert(// A client has no network name; its WPS device name or model says what it is.mac = mac, source = Advert.Source.WIFI, rssi = m.rssi, name = m.ssid ?: m.wps?.label,addressType = com.rfsentinel.app.detect.AddressType.ofWifi(mac),wifi = Advert.WifiInfo(m.frequencyMhz, "", null, emptyList(), client = !m.isAccessPoint,- wildcardProbe = m.wildcardProbe, flockProbeIe = m.flockProbeIe),+ wildcardProbe = m.wildcardProbe, flockProbeIe = m.flockProbeIe, probeSkeleton = m.probeSkeleton),timestamp = now), null)}diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.ktindex 0cdd3d8..55b4c44 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt@@ -254,6 +254,9 @@ class DeviceDetailActivity : AppCompatActivity() {id += "Probe fingerprint" to fp + if (OuiWatchlist.isFingerprintWatched(fp)) " · on your watchlist" else" (same for every device of this model / OS - Watchlist can watch it)"}+ r.skeleton?.let { sk ->+ id += "Probe shape" to "%08x".format(sk) + (com.rfsentinel.app.detect.SignatureEngine.probeShapeNote(sk)?.let { " · $it" } ?: "")+ }if (r.probed.isNotEmpty()) id += "Networks it asked for" to r.probed.reversed().joinToString(", ")}if (id.isNotEmpty()) out += "Identity" to iddiff --git a/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt b/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.ktindex ebe1219..18bb9d8 100644--- a/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt@@ -19,6 +19,8 @@ class MonitorFrames {var wps: ProbeIntel.Wps? = null/** How it builds its probe requests ([ProbeIntel.fingerprint]). */var fingerprint: String? = null+ /** FlipDeFlock's probe skeleton hash ([ProbeIntel.skeletonHash]). */+ var skeleton: Long? = null/** An access point that hides its name (blank name in its beacons). */var hidden = false/** A client that sent wildcard probe requests; with the Flock-camera Wi-Fi Alliance element. */@@ -103,6 +105,7 @@ class MonitorFrames {if (ies.wildcard) s.wildcard = trueif (ies.flockIe) s.flockIe = trueProbeIntel.fingerprint(b, d + 24, end)?.let { s.fingerprint = it }+ ProbeIntel.skeletonHash(b, d + 24, ProbeIntel.withoutFcs(b, d, end))?.let { s.skeleton = it }ies.ssid?.takeIf { validSsid(it) }?.let { name ->s.probed.remove(name); s.probed.add(name)if (s.probed.size > MAX_PROBED) s.probed.remove(s.probed.first())@@ -170,6 +173,7 @@ class MonitorFrames {probedSsids = s.probed.toList(),wps = s.wps,fingerprint = s.fingerprint,+ probeSkeleton = s.skeleton,hiddenNetwork = s.hidden,wildcardProbe = s.wildcard,flockProbeIe = s.flockIediff --git a/app/src/main/java/com/rfsentinel/app/usb/ProbeIntel.kt b/app/src/main/java/com/rfsentinel/app/usb/ProbeIntel.ktindex de0fe81..c826744 100644--- a/app/src/main/java/com/rfsentinel/app/usb/ProbeIntel.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/ProbeIntel.kt@@ -81,19 +81,49 @@ object ProbeIntel {return "%08x".format(crc.value)}+ /**+ * FlipDeFlock's probe "skeleton" (its ie_skeleton_hash, ported as is so its published values+ * match): FNV-1a over each element's id and length, plus the first 5 bytes (OUI + type) of+ * vendor elements, from [from] to [end] (no checksum). Unsigned 32-bit; null with no elements.+ * Coarse: many phones share one, so it marks a candidate, never a device.+ */+ fun skeletonHash(b: ByteArray, from: Int, end: Int): Long? {+ var h = 0x811c9dc5L+ fun fold(v: Int) { h = ((h xor (v.toLong() and 0xff)) * 0x01000193L) and 0xffffffffL }+ var i = from; var any = false+ while (i + 2 <= end) {+ val tag = b[i].toInt() and 0xff; val len = b[i + 1].toInt() and 0xff+ if (i + 2 + len > end) break+ fold(tag); fold(len)+ if (tag == 0xDD) for (k in 0 until minOf(len, 5)) fold(b[i + 2 + k].toInt())+ any = true+ i += 2 + len+ }+ return if (any) h else null+ }++ /** [end] without the 4-byte checksum some drivers keep on a frame starting at [d]. */+ fun withoutFcs(b: ByteArray, d: Int, end: Int): Int {+ if (end - d < 28) return end+ val crc = CRC32().apply { update(b, d, end - d - 4) }.value+ for (k in 0 until 4) if ((b[end - 4 + k].toLong() and 0xff) != ((crc shr (8 * k)) and 0xff)) return end+ return end - 4+ }+private fun hex(b: ByteArray, at: Int, len: Int) = (at until at + len).joinToString("") { "%02x".format(b[it].toInt() and 0xff) }/** What external hardware learned about a device this scan, for its detail screen. */- data class Record(val wps: Wps?, val fingerprint: String?, val probed: List<String>, val hidden: Boolean = false)+ data class Record(val wps: Wps?, val fingerprint: String?, val probed: List<String>, val hidden: Boolean = false,+ val skeleton: Long? = null)private val byMac = ConcurrentHashMap<String, Record>()- fun note(mac: String, wps: Wps?, fingerprint: String?, probed: List<String>, hidden: Boolean = false) {- if (wps == null && fingerprint == null && probed.isEmpty() && !hidden) return+ fun note(mac: String, wps: Wps?, fingerprint: String?, probed: List<String>, hidden: Boolean = false, skeleton: Long? = null) {+ if (wps == null && fingerprint == null && probed.isEmpty() && !hidden && skeleton == null) returnval key = mac.uppercase()val old = byMac[key]byMac[key] = Record(wps ?: old?.wps, fingerprint ?: old?.fingerprint, probed.ifEmpty { old?.probed.orEmpty() },- hidden || old?.hidden == true)+ hidden || old?.hidden == true, skeleton ?: old?.skeleton)if (byMac.size > 5000) byMac.keys.take(500).forEach { byMac.remove(it) }}diff --git a/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt b/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.ktindex 8c7b72d..35fae5d 100644--- a/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt@@ -27,6 +27,8 @@ data class MonitorSighting(val wps: ProbeIntel.Wps? = null,/** How it builds its probe requests: marks a device model / OS ([ProbeIntel.fingerprint]). */val fingerprint: String? = null,+ /** FlipDeFlock's probe skeleton hash ([ProbeIntel.skeletonHash]). */+ val probeSkeleton: Long? = null,/** An access point hiding its name; [ssid] is then the name revealed by a device joining or asking for it. */val hiddenNetwork: Boolean = false,/** A client that sent wildcard probe requests (no network name). */diff --git a/app/src/test/java/com/rfsentinel/app/usb/ProbeShapeTest.kt b/app/src/test/java/com/rfsentinel/app/usb/ProbeShapeTest.ktnew file mode 100644index 0000000..c369f5d--- /dev/null+++ b/app/src/test/java/com/rfsentinel/app/usb/ProbeShapeTest.kt@@ -0,0 +1,64 @@+package com.rfsentinel.app.usb++import com.rfsentinel.app.detect.Advert+import com.rfsentinel.app.detect.Category+import com.rfsentinel.app.detect.SignatureEngine+import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Test+import java.util.zip.CRC32++class ProbeShapeTest {++ /** Wildcard name, 802.11b rates, extended rates, Wi-Fi Alliance vendor element. */+ private val ies = byteArrayOf(0, 0, 1, 4, 0x82.toByte(), 0x84.toByte(), 0x8B.toByte(), 0x96.toByte(),+ 0x32, 4, 0x0C, 0x12, 0x18, 0x60, 0xDD.toByte(), 9, 0x50, 0x6F, 0x9A.toByte(), 0x16, 3, 1, 3, 0xAA.toByte(), 0xBB.toByte())++ private fun probe(fcs: Boolean): ByteArray {+ val f = ByteArray(24).also { it[0] = 0x40 } + ies+ if (!fcs) return f+ val c = CRC32().apply { update(f) }.value+ return f + ByteArray(4) { ((c shr (8 * it)) and 0xff).toByte() }+ }++ @Test+ fun matchesFlipDeFlocksHash() {+ // Reference value from a line-by-line port of FlipDeFlock's ie_skeleton_hash().+ assertEquals(0xDFAE8CC6L, ProbeIntel.skeletonHash(ies, 0, ies.size))+ // Vendor element contents past OUI + type don't count; a truncated element ends it.+ val other = ies.copyOf().also { it[23] = 0x11; it[24] = 0x22 } + byteArrayOf(0xDD.toByte(), 40)+ assertEquals(0xDFAE8CC6L, ProbeIntel.skeletonHash(other, 0, other.size))+ assertNull(ProbeIntel.skeletonHash(ies, 0, 0))+ }++ @Test+ fun aKeptChecksumIsLeftOut() {+ val plain = probe(false); val withFcs = probe(true)+ assertEquals(plain.size, ProbeIntel.withoutFcs(plain, 0, plain.size))+ assertEquals(plain.size, ProbeIntel.withoutFcs(withFcs, 0, withFcs.size))+ }++ private fun client(mac: String, shape: Long) = Advert(mac = mac, source = Advert.Source.WIFI, rssi = -70, name = null,+ wifi = Advert.WifiInfo(2437, "", null, emptyList(), client = true, probeSkeleton = shape), timestamp = 0L)++ @Test+ fun aCandidateFlockShapeIsAWeakHit() {+ val random = SignatureEngine.classify(client("DA:11:22:33:44:55", 0x42D75CD1L))+ .single { it.label == "Possible Flock camera (probe shape)" }+ assertEquals(Category.ALPR, random.category)+ assertEquals(35, random.confidence)+ assertTrue(random.evidence.contains("42d75cd1"))+ val onModule = SignatureEngine.classify(client("24:B2:B9:33:44:55", 0xD0BBEC4CL))+ .single { it.label == "Possible Flock camera (probe shape)" }+ assertEquals(50, onModule.confidence)+ }++ @Test+ fun commonShapesAreNeverACamera() {+ for (shape in listOf(0x96FCD1B2L, 0x89C3DEBFL, 0xBA9FAFA0L, 0xDFAE8CC6L))+ assertTrue(SignatureEngine.classify(client("DA:11:22:33:44:55", shape)).none { it.category == Category.ALPR })+ assertEquals("common to phones and ESP32 boards", SignatureEngine.probeShapeNote(0x7C923B53L))+ assertNull(SignatureEngine.probeShapeNote(0xDFAE8CC6L))+ }+}diff --git a/docs/SIGNATURES.md b/docs/SIGNATURES.mdindex 7b4990f..a3118f9 100644--- a/docs/SIGNATURES.md+++ b/docs/SIGNATURES.md@@ -49,6 +49,7 @@ Before shipping, the identifiers were checked against these registries:| ALPR | Service UUID `e8ccbb38-9532-46a8-9fe5-1814df172e6f` or `20c944c1-add2-42d7-a638-967ee9a26ff6` (Flock battery) | 80 | Flock-You, SquachWatch, SignalSweep || ALPR | Wildcard probe requests from a Flock radio-module block (USB WiFi adapter) | 60, or 75 with the Wi-Fi Alliance element `50:6F:9A:16 03 01 03` | SignalSweep / DeFlock field tests (11 of 12 cameras, 2 false alarms) || ALPR | BLE name starting with `Flock` | 55 | ACAB (loose brand string) |+| ALPR | Probe-request shape `42d75cd1` or `d0bbec4c` (FlipDeFlock candidates, USB WiFi adapter) | 35, or 50 on a Flock module block | FlipDeFlock (single report each) || ALPR | Company ID `0x09C8` alone (XUNTONG, shared silicon) | 45 | SIG / ACAB || Audio sensor | 128-bit service UUIDs with short IDs `0x3100` to `0x3500` (Flock Raven) | 80 | ACAB field capture || Drone | Service data `0xFFFA` with ASTM F3411 app code `0x0D`; decoded | 95 | ASTM F3411 / opendroneid |@@ -332,6 +333,7 @@ candidate's IEEE registrant was checked against the maker the project names.| [OUI-Spy](https://github.com/colonelpanichacks/oui-spy-unified-blue) | 11 Ring (Amazon) blocks, as home cameras (off by default) || [Wardrive Go](https://github.com/RocketGod-git/wardrive-go) | Same Flock list; its traffic-camera and drone blocks were already here. Later (3.1.165): EMS gear, IP-camera setup networks, train WiFi and mesh radio nodes, above || [Flock-You-Android](https://github.com/MaxwellDPS/Flock-You-Android) | Hikvision, Dahua, Axis, Vivotek, Amcrest, Reolink, Wyze, TVT, Reecam camera blocks; Sierra Wireless and Digi fleet gateways |+| [FlipDeFlock](https://github.com/ReconGrunt/FlipDeFlock) | Its probe-request "skeleton" hash (element ids and lengths, vendor OUI + type), ported so its published values match: 2 candidate Flock shapes as **weak** hits, 6 shapes it found on phones and ESP32 boards marked as common. Shown as "Probe shape" in device details || [Fieldwatch](https://github.com/OffGridPete/Fieldwatch) | BlueTOAD (Iteris) and BlipTrack roadside travel-time sensors; Flock-pole battery radios (weak); Hanwha, Uniview, Rhombus cameras; Sierra AirLink, Compex and Inseego (Novatel) vehicle radios |The Flock radio list is mostly Liteon, Silicon Labs, Espressif and USI module