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
Signatures from SignalSweep: Flock camera wildcard probes, newer Flock modules, Axon pairing networks, Karma access points, fake-tracker floods, a deauth alarm normal networks can't trip
CIS-C094a52d083be0
diff --git a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt b/app/src/main/java/com/rfsentinel/app/detect/Advert.ktindex 29b032c..6463c7f 100644--- a/app/src/main/java/com/rfsentinel/app/detect/Advert.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/Advert.kt@@ -41,7 +41,11 @@ class Advert(/** Beacon information elements (id, payload), API 30+ only. */val infoElements: List<Pair<Int, ByteArray>>,/** A client device (laptop, phone, camera) heard by a monitor-mode adapter, not an access point. */- val client: Boolean = false+ val client: Boolean = false,+ /** 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 isBle get() = source == Source.BLEdiff --git a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.ktindex bc3b06c..5c5157d 100644--- a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt@@ -31,6 +31,16 @@ object DeviceIntel {0x0F to "Nearby Action", 0x10 to "Nearby Info", 0x12 to "Find My", 0x16 to "Nearby Action (setup)")+ /**+ * What an iPhone, iPad, Mac or Watch is doing, from the low 4 bits of its Nearby Info status byte+ * (furiousMAC Continuity research, as checked against 2026 captures by SignalSweep; facts only).+ */+ private val APPLE_ACTIVITY = mapOf(+ 0x01 to "Activity reporting off", 0x03 to "Idle", 0x05 to "Playing audio, screen locked",+ 0x07 to "In use, screen on", 0x09 to "Playing video", 0x0A to "Watch on wrist, unlocked",+ 0x0B to "Just used", 0x0D to "Driving", 0x0E to "On a call"+ )+private val NAME_TYPES = listOf(Regex("airpods|beats|buds|earbud|headphone|headset|jbl|bose|sony w[hf]-|soundcore|jabra|sennheiser|skullcandy", RegexOption.IGNORE_CASE) to "Headphones / earbuds",Regex("watch|fitbit|garmin|amazfit|mi band|galaxy fit|whoop|polar|suunto|oura", RegexOption.IGNORE_CASE) to "Wearable",@@ -142,6 +152,9 @@ object DeviceIntel {if (t == 0x12) {facts += "Find My state" to if (len == 0x19) "Separated from owner" else "Near its owner"}+ if (t == 0x10 && len >= 1 && i + 2 < d.size) {+ APPLE_ACTIVITY[Bytes.u8(d, i + 2) and 0x0F]?.let { facts += "Apple activity" to it }+ }if (len == 0) breaki += 2 + len}diff --git a/app/src/main/java/com/rfsentinel/app/detect/HackerWatch.kt b/app/src/main/java/com/rfsentinel/app/detect/HackerWatch.ktindex 10e2777..eb98b3b 100644--- a/app/src/main/java/com/rfsentinel/app/detect/HackerWatch.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/HackerWatch.kt@@ -2,8 +2,8 @@ package com.rfsentinel.app.detect/*** Card skimmers and attack tools: exact signatures (Flipper Zero, Pwnagotchi, WiFi Pineapple,- * ESP deauthers, Bluetooth card-skimmer modules) plus two behaviours that need memory across- * adverts: an evil-twin access point and a Bluetooth pairing-pop-up spam flood.+ * ESP deauthers, Bluetooth card-skimmer modules) plus behaviours that need memory across+ * adverts: an evil-twin access point, a Bluetooth pairing-pop-up spam flood and a fake-tracker flood.* Signatures and their grading follow SquachWatch's DETECTIONS.md (GPL-3.0), re-checked* against the IEEE and Bluetooth SIG registries. Receive-only, like the rest of the app.*/@@ -17,6 +17,11 @@ object HackerWatch {private const val CID_FLIPPER = 0x0E29 // Flipper Devices Inc. (not 0x0FBA: that's Cosonic)private const val OUI_FLIPPER = "0CFA22"private val HAK5_LA = setOf("02C0CA", "021337")+ /**+ * STMicroelectronics' STM32WB Bluetooth chips build their address from these prefixes (not in the+ * IEEE register). A Flipper Zero is one, but so are other STM32WB gadgets: a hint only.+ */+ private val STM32WB = setOf("80E126", "80E127")// ---- Action cameras (Category.OTHER_CAMERA) ------------------------------------------------private const val CID_ARASHI = 0x10D7 // Arashi Vision Inc. (Insta360)@@ -117,6 +122,9 @@ object HackerWatch {"Address in Flipper Devices' registered block 0C:FA:22", SRC)name.startsWith("Flipper ") -> hits += Hit(Category.HACKER, "Flipper Zero", 60,"Advertised name \"$name\" (owners can rename it - verify)", SRC)+ prefix in STM32WB -> hits += Hit(Category.HACKER, "Possible Flipper Zero (STM32WB chip)", 30,+ "Address ${prefix.chunked(2).joinToString(":")}: an STMicroelectronics STM32WB Bluetooth chip, which a " ++ "Flipper Zero uses - so do other gadgets, weak", "SignalSweep research (GPL-3.0; facts only)")}} else if (a.source == Advert.Source.WIFI) {pwnagotchiName(a)?.let { n ->@@ -213,8 +221,80 @@ object HackerWatch {return a.serviceData.keys.any { Advert.shortOf(it) == 0xFE2C } // Google Fast Pair}+ // ---- Fake-tracker flood ---------------------------------------------------------------++ /** A flood of fake [network] trackers: [addresses] throwaway addresses in the last [windowS] s, [sample] one of them. */+ data class TagFlood(val network: String, val addresses: Int, val sample: String, val windowS: Int)++ /** A real tag keeps its address for a long time; a fake one is heard a couple of times, briefly. */+ const val FLOOD_MAX_HITS = 3+ const val FLOOD_MAX_SPAN_MS = 10_000L+ /** Quiet this long and an address counts as gone. */+ const val FLOOD_QUIET_MS = 30_000L+ /** This many gone short-lived addresses of one network within [FLOOD_WINDOW_MS] is a flood. */+ const val FLOOD_EVIDENCE = 6+ const val FLOOD_WINDOW_MS = 5 * 60_000L+ /** Weaker than this doesn't count: real tags in passing cars are short-lived too, but far. */+ const val FLOOD_MIN_RSSI = -80+ private const val FLOOD_MAX_ADDRESSES = 64++ private class TagAddr(val first: Long, var last: Long, var hits: Int, var best: Int)+ private class Network {+ val addrs = LinkedHashMap<String, TagAddr>()+ /** When each short-lived address went quiet, by address. */+ val evidence = LinkedHashMap<String, Long>()+ var lastReport = Long.MIN_VALUE / 2+ }+ private val networks = HashMap<String, Network>()++ /**+ * Which finding network a tracker advert belongs to, or null. Only adverts no phone sends:+ * Apple's separated Find My frame, Google Find Hub frames, Samsung SmartTag and Tile services.+ */+ internal fun trackerNetwork(a: Advert): String? {+ if (a.source != Advert.Source.BLE) return null+ a.manufacturerData[0x004C]?.let { d -> if (d.size >= 2 && Bytes.u8(d, 0) == 0x12 && Bytes.u8(d, 1) == 0x19) return "Apple Find My" }+ a.serviceData[Advert.uuid16(0xFEAA)]?.let { d -> if (d.isNotEmpty() && Bytes.u8(d, 0) in 0x40..0x41) return "Google Find Hub" }+ val shorts = a.serviceData.keys.mapNotNull { Advert.shortOf(it) }+ if (shorts.any { it == 0xFD5A || it == 0xFD59 }) return "Samsung SmartTag"+ if (shorts.any { it == 0xFEED || it == 0xFEEC }) return "Tile"+ return null+ }++ /**+ * Every tracker advert. Tools like a Flipper Zero flood an area with fake trackers, each on a+ * throwaway address: heard once or twice, then never again. Real tags keep theirs. One alarm says+ * what's going on (and again every few minutes while it lasts); real trackers are still reported+ * as ever. The approach and thresholds follow SignalSweep's field-tuned detector (GPL-3.0; the idea,+ * not code).+ */+ @Synchronized+ fun tagFlood(a: Advert, now: Long): TagFlood? {+ val kind = trackerNetwork(a) ?: return null+ val n = networks.getOrPut(kind) { Network() }+ fun gone(mac: String, t: TagAddr, at: Long) {+ val fake = t.hits <= FLOOD_MAX_HITS && t.last - t.first <= FLOOD_MAX_SPAN_MS && t.best >= FLOOD_MIN_RSSI+ if (fake && mac !in n.evidence) n.evidence[mac] = at+ }+ val iter = n.addrs.entries.iterator()+ while (iter.hasNext()) {+ val (mac, t) = iter.next()+ if (mac != a.mac && now - t.last >= FLOOD_QUIET_MS) { gone(mac, t, t.last + FLOOD_QUIET_MS); iter.remove() }+ }+ val t = n.addrs[a.mac]+ if (t != null) { t.last = now; t.hits++; if (a.rssi > t.best) t.best = a.rssi }+ else {+ if (n.addrs.size >= FLOOD_MAX_ADDRESSES) n.addrs.entries.first().let { (mac, old) -> gone(mac, old, now); n.addrs.remove(mac) }+ n.addrs[a.mac] = TagAddr(now, now, 1, a.rssi)+ }+ n.evidence.entries.removeAll { now - it.value > FLOOD_WINDOW_MS }+ if (n.evidence.size < FLOOD_EVIDENCE || now - n.lastReport < FLOOD_WINDOW_MS) return null+ n.lastReport = now+ return TagFlood(kind, n.evidence.size, n.evidence.keys.last(), (FLOOD_WINDOW_MS / 1000).toInt())+ }+@Synchronizedfun reset() {- bySsid.clear(); twinsFlagged.clear(); spamTimes.clear(); lastFlood = Long.MIN_VALUE / 2+ bySsid.clear(); twinsFlagged.clear(); spamTimes.clear(); lastFlood = Long.MIN_VALUE / 2; networks.clear()}}diff --git a/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt b/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.ktindex c56a673..c6ff688 100644--- a/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/SignatureEngine.kt@@ -29,6 +29,7 @@ object SignatureEngine {private const val SIG = "Bluetooth SIG assigned numbers"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)"// --- Bluetooth SIG company IDs (manufacturer data, AD 0xFF) ---------------private const val CID_APPLE = 0x004C@@ -51,6 +52,8 @@ object SignatureEngine {0x3400 to "upload", 0x3500 to "error")/** Flock's accessory GATT service, from a Flock camera's firmware (Flock-You issue #15, SquachWatch). */private val FLOCK_GATT = UUID.fromString("e8ccbb38-9532-46a8-9fe5-1814df172e6f")+ /** The same battery's second Flock service (the "safety" one), same source. */+ private val FLOCK_GATT_2 = UUID.fromString("20c944c1-add2-42d7-a638-967ee9a26ff6")private const val UUID_TILE_2 = 0xFEEC // Tile, Inc. (second SIG-assigned UUID)/**@@ -78,6 +81,7 @@ object SignatureEngine {)private const val UUID_REMOTE_ID = 0xFFFA // ASTM Remote ID (SIG SDO UUID)private const val UUID_SMARTTAG = 0xFD5A // Samsung Electronics+ private const val UUID_SMARTTAG_SETUP = 0xFD59 // Samsung Electronics (a SmartTag not yet registered)private const val UUID_TILE = 0xFEED // Tile, Inc.private const val UUID_CHIPOLO = 0xFE33 // CHIPOLO d.o.o. (as AirGuard, SEEMOO / TU Darmstadt, Apache-2.0)private const val UUID_GOOGLE_FMDN = 0xFEAA // Google LLC (Eddystone / Find Hub)@@ -245,6 +249,11 @@ object SignatureEngine {hits += Hit(Category.ALPR, "Flock Safety device", 80,"Numeric name \"$name\" plus XUNTONG module ID 0x09C8 (newer Penguin firmware)","$ACAB (flock-detection research)")+ // Newer Penguin batteries also carry their serial ("TN" + digits) in the module's data, name or not.+ xuntong && hasTnSerial(a.manufacturerData[CID_XUNTONG]) ->+ hits += Hit(Category.ALPR, "Flock Safety device", 80,+ "XUNTONG module ID 0x09C8 with a \"TN<digits>\" serial in its data (Flock Penguin battery)",+ "$SIGNALSWEEP; oui-spy notes")name.startsWith("Flock", ignoreCase = true) ->hits += Hit(Category.ALPR, "Possible Flock Safety device", 55,"Advertised name starts with \"Flock\" (brand string - verify)", ACAB)@@ -258,6 +267,9 @@ object SignatureEngine {if (a.serviceUuids.contains(FLOCK_GATT) || a.serviceData.keys.contains(FLOCK_GATT)) {hits += Hit(Category.ALPR, "Flock Safety device", 80,"Flock accessory service UUID e8ccbb38-... (from Flock camera firmware)", "Flock-You research; SquachWatch")+ } else if (a.serviceUuids.contains(FLOCK_GATT_2) || a.serviceData.keys.contains(FLOCK_GATT_2)) {+ hits += Hit(Category.ALPR, "Flock Safety device", 80,+ "Flock accessory service UUID 20c944c1-... (from Flock camera firmware)", "Flock-You research; $SIGNALSWEEP")}RAVEN_SHORTS.keys.filter { it in shorts }.takeIf { it.isNotEmpty() }?.let { found ->hits += Hit(Category.AUDIO_SENSOR, "Flock Raven audio / gunshot sensor", 80,@@ -289,9 +301,14 @@ object SignatureEngine {"Google Find Hub Network Accessory Spec; $ACAB")}}- a.serviceData[Advert.uuid16(UUID_SMARTTAG)]?.takeIf { it.isNotEmpty() }?.let {+ val smartTag = a.serviceData[Advert.uuid16(UUID_SMARTTAG)]?.takeIf { it.isNotEmpty() }+ if (smartTag != null) {hits += Hit(Category.TRACKER, "Samsung SmartTag", 55,"Service data on UUID 0xFD5A (Samsung)", "$SIG; arXiv 2501.17452")+ } else if (a.serviceData[Advert.uuid16(UUID_SMARTTAG_SETUP)]?.isNotEmpty() == true) {+ hits += Hit(Category.TRACKER, "Samsung SmartTag (not set up yet)", 40,+ "Service data on UUID 0xFD59 (Samsung): a tag still being set up, usually next to its owner",+ "$SIG; arXiv 2210.14702; $SIGNALSWEEP")}(a.serviceData[Advert.uuid16(UUID_TILE)] ?: a.serviceData[Advert.uuid16(UUID_TILE_2)])?.takeIf { it.isNotEmpty() }?.let {hits += Hit(Category.TRACKER, "Tile tracker", 55, "Service data on UUID 0xFEED / 0xFEEC (Tile, Inc.)", SIG)@@ -357,6 +374,23 @@ object SignatureEngine {else -> null}+ /** The network an Axon body camera or device opens while pairing ("AB3-...", "AXON-..."). */+ internal fun axonPairingSsid(ssid: String): Hit? {+ if (AXON_FLEET_SSID.matches(ssid)) return null // an in-car network: policeVehicleSsid+ AXON_BODY_SSID.find(ssid)?.let { m ->+ val gen = m.groupValues[1]+ return Hit(Category.BODY_CAM, "Axon Body $gen camera (pairing network)", 80,+ "WiFi network \"$ssid\": Axon Body $gen cameras open an \"AB$gen-\" network while pairing",+ "Axon admin documentation; $SIGNALSWEEP")+ }+ if (ssid.startsWith("AXON-", ignoreCase = true)) {+ return Hit(Category.BODY_CAM, "Axon device hotspot (body camera or in-car)", 75,+ "WiFi network \"$ssid\": the \"AXON-\" hotspot Axon devices open", "Axon admin documentation; $SIGNALSWEEP")+ }+ return null+ }++ private val AXON_BODY_SSID = Regex("^AB([234])-", RegexOption.IGNORE_CASE)private val AXON_FLEET_SSID = Regex("^axon[-_ ]?\\d{1,6}[-_ ]?5g$", RegexOption.IGNORE_CASE)private val VEHICLE_NUMBER_5G_SSID = Regex("^\\d{2,6}[-_ ]5g$", RegexOption.IGNORE_CASE)private val CRADLEPOINT_VEHICLE_SSID = Regex("^(ibr\\d{3,4}[a-z]{0,4}|r1900|r2100)-[0-9a-f]{3}(-5g)?$", RegexOption.IGNORE_CASE)@@ -370,8 +404,18 @@ object SignatureEngine {private val FLOCK_MODULE_PREFIXES = setOf("70C94E", "3C9180", "D8F3BC", "803049", "B83532", "145AFC", "744CA1", "083A88", "9C2F9D", "C03532","940853", "E4AAEA", "F46ADD", "F8A2D6", "24B2B9", "00F48D", "D03957", "E8D0FC", "E04F43", "B81EA4",- "700894", "588E81", "EC1BBD", "3C71BF", "5800E3", "9035EA", "5C93A2", "646E69", "4827EA", "A4CF12", "826BF2"+ "700894", "588E81", "EC1BBD", "3C71BF", "5800E3", "9035EA", "5C93A2", "646E69", "4827EA", "A4CF12", "826BF2",+ // Added from flock-you's 2026 list via SignalSweep (Liteon and Silicon Labs blocks).+ "14B5CD", "040D84", "1C34F1", "385B44", "943469", "B4E3F9", "F082C0", "E00AF6")++ /**+ * The module prefixes trusted for the wildcard-probe signature: the list above without the ones+ * that also turn up in plenty of ordinary devices (two Espressif blocks, one seen on a Sony media+ * player, and a randomized-address prefix). A bare wildcard probe from any other device means+ * nothing; from these it's the only thing a current Flock camera still sends (SignalSweep, DeFlock).+ */+ private val FLOCK_PROBE_PREFIXES = FLOCK_MODULE_PREFIXES - setOf("F8A2D6", "A4CF12", "3C71BF", "826BF2")private val FLOCK_PRODUCT_SSID = Regex("^(flock|falcon|sparrow|raven|penguin)[_-]", RegexOption.IGNORE_CASE)private fun classifyWifi(a: Advert): List<Hit> {@@ -399,6 +443,23 @@ object SignatureEngine {"the same chips are in many ordinary devices - verify", "$ACAB (flock-you / MILLIE research)")}}+ // A Flock camera with its management network off (since late 2025) still looks for networks:+ // wildcard probe requests from a Flock radio module, heard by a USB WiFi adapter.+ val w = a.wifi+ if (w != null && w.client && w.wildcardProbe && !isLocallyAdministered(a.mac) &&+ a.mac.replace(":", "").uppercase().take(6) in FLOCK_PROBE_PREFIXES) {+ val prefix = fmtPrefix(a.mac.replace(":", "").uppercase().take(6))+ hits += if (w.flockProbeIe) Hit(Category.ALPR, "Flock Safety camera (probe request)", 75,+ "Wildcard probe requests from a WiFi module Flock cameras use ($prefix), carrying the Wi-Fi Alliance " ++ "element 50:6F:9A:16 03 01 03 Flock cameras send. Ordinary devices with the same chip can match - verify",+ "$SIGNALSWEEP; DeFlock / flock-you research")+ else Hit(Category.ALPR, "Possible Flock camera (probe request)", 60,+ "Wildcard probe requests from a WiFi module Flock cameras use ($prefix). In field tests this caught " ++ "11 of 12 cameras with 2 false alarms; ordinary devices with the same chip can match - verify",+ "$SIGNALSWEEP; DeFlock / flock-you research")+ }+ // 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_")) {hits += Hit(Category.NETWORK_CAMERA, "Arlo camera base station", 88,"WiFi network \"$ssid\" (Arlo base-station SSID)", "$ACAB (field capture)")@@ -461,6 +522,15 @@ object SignatureEngine {).firstOrNull { it.first in o }?.second ?: owner}+ /** "TN" followed by a digit somewhere in a Flock Penguin battery's XUNTONG data: its serial. */+ private fun hasTnSerial(d: ByteArray?): Boolean {+ if (d == null) return false+ for (i in 0 until d.size - 2) {+ if (d[i] == 'T'.code.toByte() && d[i + 1] == 'N'.code.toByte() && d[i + 2] in '0'.code.toByte()..'9'.code.toByte()) return true+ }+ return false+ }+private fun isLocallyAdministered(mac: String): Boolean =(mac.take(2).toIntOrNull(16) ?: 0) and 0x02 != 0diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.ktindex 7754cc7..781111b 100644--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt@@ -293,6 +293,7 @@ class ScanForegroundService : Service() {// A USB WiFi adapter in monitor mode (e.g. AWUS036ACS): access points and client devices.com.rfsentinel.app.usb.UsbWifi.start(this) { list -> pipeline.post { list.forEach(::processUsbWifi) } }com.rfsentinel.app.usb.DeauthWatch.onAttack = { a -> pipeline.post { onDeauth(a) } }+ com.rfsentinel.app.usb.KarmaWatch.onAttack = { a -> pipeline.post { onKarma(a) } }// An RTL-SDR dongle: strong two-way radio transmissions nearby (signal strength only).if (Prefs.categoryEnabled(this, Category.RADIO)) {// Settings > RTL-SDR radio: bands, excluded ranges, watched frequencies, sensitivity (re-read on every refresh).@@ -504,6 +505,9 @@ class ScanForegroundService : Service() {?.let { remoteId = RemoteId.decodeWifiIe(it.second, DeviceRegistry.remoteIdOf(mac)) }}+ // Every tracker advert counts toward a fake-tracker flood (HackerWatch).+ if (a.isBle) com.rfsentinel.app.detect.HackerWatch.tagFlood(a, now)?.let { onTagFlood(it) }+val prev = classified[mac]// A newly heard address counts toward a Bluetooth spam flood (HackerWatch).val spam = if (prev == null) com.rfsentinel.app.detect.HackerWatch.bleSpam(a, now) else null@@ -590,7 +594,8 @@ class ScanForegroundService : Service() {// 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),+ wifi = Advert.WifiInfo(m.frequencyMhz, "", null, emptyList(), client = !m.isAccessPoint,+ wildcardProbe = m.wildcardProbe, flockProbeIe = m.flockProbeIe),timestamp = now), null)}@@ -1107,20 +1112,52 @@ class ScanForegroundService : Service() {"handful, never a stream. Heard by the USB WiFi adapter; nothing is sent."val hit = Hit(Category.HACKER, "WiFi deauth attack on $net", if (a.broadcast) 80 else 70, detail,"802.11 management frames (USB WiFi adapter, receive-only)")+ reportAttack(a.bssid, "WIFI", hit, ssid, "deauth:" + a.bssid, "WiFi attack nearby", now)+ }++ /** One transmitter answering under many network names (USB WiFi adapter): a Karma / PineAP fake access point. */+ private fun onKarma(a: com.rfsentinel.app.usb.KarmaWatch.Attack) {+ if (!Prefs.categoryEnabled(this, Category.HACKER)) return+ val now = System.currentTimeMillis()+ val shown = a.names.take(6).joinToString { "\"$it\"" } + if (a.names.size > 6) "..." else ""+ val channel = if (a.channel >= 5955) "6 GHz channel ${(a.channel - 5950) / 5}" else "channel ${a.channel}"+ val detail = "One access point (${a.transmitter}, $channel) answered under ${a.names.size} different network names " ++ "in ${a.windowS} s: $shown. A real access point answers under its own name only. This is how a WiFi Pineapple " ++ "or ESP32 Karma attack makes phones join it, posing as networks they know - don't join open networks here. " ++ "Heard by the USB WiFi adapter; nothing is sent."+ val hit = Hit(Category.HACKER, "Fake WiFi access point (Karma / PineAP)", 80, detail,+ "802.11 beacons and probe responses (USB WiFi adapter, receive-only); SignalSweep research (GPL-3.0; facts only)")+ reportAttack(a.transmitter, "WIFI", hit, a.names.firstOrNull(), "karma:" + a.transmitter, "WiFi attack nearby", now)+ }++ /** A flood of fake trackers on throwaway addresses (HackerWatch.tagFlood). */+ private fun onTagFlood(f: com.rfsentinel.app.detect.HackerWatch.TagFlood) {+ if (!Prefs.categoryEnabled(this, Category.HACKER)) return+ val now = System.currentTimeMillis()+ val detail = "${f.addresses} fake ${f.network} trackers in ${f.windowS / 60} min, each heard once or twice on an address " ++ "it never used again - real tags keep theirs. A Flipper Zero or ESP32 tracker-spam attack makes phones show " ++ "\"tracker found\" warnings that aren't real. Real trackers are still reported as usual."+ val hit = Hit(Category.HACKER, "Fake tracker flood (${f.network})", 65, detail,+ "Bluetooth adverts, receive-only; SignalSweep research (GPL-3.0; facts only)")+ reportAttack(f.sample, "BLE", hit, null, "tagflood:" + f.network, "Fake trackers nearby", now)+ }++ /** An attack heard over time rather than one device: logged, and alerted like a detection. */+ private fun reportAttack(mac: String, source: String, hit: Hit, name: String?, key: String, spoken: String, now: Long) {val loc = lastLocationval tag = Prefs.gpsTaggingEnabled(this)serviceScope.launch {AppDatabase.getInstance(this@ScanForegroundService).detectionDao().insert(DetectionEntity(- mac = a.bssid, label = hit.label, source = "WIFI", rssi = 0, timestamp = now,+ mac = mac, label = hit.label, source = source, rssi = 0, timestamp = now,latitude = if (tag) loc?.latitude else null, longitude = if (tag) loc?.longitude else null,- category = Category.HACKER.name, confidence = hit.confidence, evidence = detail, deviceName = ssid+ category = Category.HACKER.name, confidence = hit.confidence, evidence = hit.evidence, deviceName = name))}if (hit.confidence >= Prefs.alertThreshold(this) && now >= Prefs.alertsSnoozedUntil(this)) {- NotificationHelper.sendMapAlert(this, "deauth:" + a.bssid, hit, com.rfsentinel.app.ui.DetectionLogActivity::class.java)- AlertPlayer.play(this, hit.tier, "WiFi attack nearby")+ NotificationHelper.sendMapAlert(this, key, hit, com.rfsentinel.app.ui.DetectionLogActivity::class.java)+ AlertPlayer.play(this, hit.tier, spoken)}}@@ -1240,6 +1277,8 @@ class ScanForegroundService : Service() {override fun onDestroy() {com.rfsentinel.app.usb.DeauthWatch.onAttack = nullcom.rfsentinel.app.usb.DeauthWatch.clear()+ com.rfsentinel.app.usb.KarmaWatch.onAttack = null+ com.rfsentinel.app.usb.KarmaWatch.clear()com.rfsentinel.app.usb.PcapRecorder.stop()locatingHandler.removeCallbacks(locatingCheck)com.rfsentinel.app.esp.EspBoards.stop(this)diff --git a/app/src/main/java/com/rfsentinel/app/usb/DeauthWatch.kt b/app/src/main/java/com/rfsentinel/app/usb/DeauthWatch.ktindex 3919787..5beaa34 100644--- a/app/src/main/java/com/rfsentinel/app/usb/DeauthWatch.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/DeauthWatch.kt@@ -17,10 +17,20 @@ object DeauthWatch {/*** The adapter hops channels (each one gets a fraction of a second at a time), so a flood is only- * partly heard: count over a longer window with a threshold a normal network never reaches.+ * partly heard. Two ways to call it:+ * - a burst: [BURST_WEIGHT] in [BURST_MS], a frame to every device counting twice. Normal networks+ * reach 11-24 (SignalSweep's field measurements; the idea, not code);+ * - a stream: [MIN_FRAMES] in [WINDOW_MS], heard in at least [MIN_SLICES] separate [SLICE_MS] slices+ * with [SLICE_FRAMES] each. A normal network's frames come in one short burst (an access point+ * restarting drops everyone at once) and then stop; an attack keeps going.*/const val WINDOW_MS = 30_000Lconst val MIN_FRAMES = 25+ const val BURST_MS = 5_000L+ const val BURST_WEIGHT = 30+ const val SLICE_MS = 5_000L+ const val MIN_SLICES = 3+ const val SLICE_FRAMES = 4/** One alert per network this often while a flood goes on. */const val REPEAT_MS = 5 * 60_000Lprivate const val MAX_KEPT = 4_000@@ -45,7 +55,7 @@ object DeauthWatch {n.frames.addLast(now to broadcast)n.channel = channelwhile (n.frames.isNotEmpty() && (now - n.frames.first().first > WINDOW_MS || n.frames.size > MAX_KEPT)) n.frames.removeFirst()- if (n.frames.size < MIN_FRAMES || now - n.lastReport < REPEAT_MS) return@synchronized null+ if (now - n.lastReport < REPEAT_MS || !(burst(n, now) || stream(n, now))) return@synchronized nulln.lastReport = nowAttack(bssid, n.frames.size, n.frames.count { it.second } * 2 >= n.frames.size, channel, (WINDOW_MS / 1000).toInt())}@@ -53,6 +63,15 @@ object DeauthWatch {return attack}+ private fun burst(n: Net, now: Long) =+ n.frames.sumOf { (t, all) -> if (now - t <= BURST_MS) (if (all) 2 else 1) else 0 } >= BURST_WEIGHT++ private fun stream(n: Net, now: Long): Boolean {+ if (n.frames.size < MIN_FRAMES) return false+ val perSlice = n.frames.groupingBy { (now - it.first) / SLICE_MS }.eachCount()+ return perSlice.count { it.value >= SLICE_FRAMES } >= MIN_SLICES+ }+@Synchronizedfun clear() = nets.clear()}diff --git a/app/src/main/java/com/rfsentinel/app/usb/KarmaWatch.kt b/app/src/main/java/com/rfsentinel/app/usb/KarmaWatch.ktnew file mode 100644index 0000000..5eb2337--- /dev/null+++ b/app/src/main/java/com/rfsentinel/app/usb/KarmaWatch.kt@@ -0,0 +1,55 @@+package com.rfsentinel.app.usb++/**+ * Karma / PineAP fake access points, from the beacons and probe responses a USB WiFi adapter hears+ * in monitor mode. A real access point answers under its own network name (a router with a guest+ * network uses a second address for it). A Karma attack (WiFi Pineapple, ESP32 tools) answers every+ * name a phone asks for, so that phones join it thinking it's their home or work network: one+ * transmitter, many names in a short time.+ *+ * Receive-only: it counts frames, nothing is sent. Fed from every driver's RX thread, so it's+ * synchronized. Pure logic, unit-tested. Threshold as in SignalSweep (GPL-3.0; the idea, not code).+ */+object KarmaWatch {++ /** [transmitter] answered under [names] (the most recent first) within [windowS] s. */+ data class Attack(val transmitter: String, val names: List<String>, val channel: Int, val windowS: Int)++ const val WINDOW_MS = 60_000L+ /** Different network names one transmitter answers under before it's called a fake access point. */+ const val MIN_NAMES = 4+ /** One alert per transmitter this often while it goes on. */+ const val REPEAT_MS = 5 * 60_000L+ private const val MAX_TRANSMITTERS = 2_000++ /** Set by the scanning service; called (on the RX thread) when a fake access point is found. */+ @Volatile var onAttack: ((Attack) -> Unit)? = null++ private class Tx {+ /** Name -> when last heard under it. */+ val names = LinkedHashMap<String, Long>()+ var lastSeen = 0L+ var lastReport = Long.MIN_VALUE / 2+ }++ private val txs = HashMap<String, Tx>()++ /** A beacon or probe response from [transmitter] under network name [ssid]. */+ fun frame(transmitter: String, ssid: String, channel: Int, now: Long = System.currentTimeMillis()): Attack? {+ val attack = synchronized(this) {+ if (txs.size > MAX_TRANSMITTERS) txs.entries.removeAll { now - it.value.lastSeen > WINDOW_MS }+ val t = txs.getOrPut(transmitter) { Tx() }+ t.lastSeen = now+ t.names.remove(ssid); t.names[ssid] = now+ t.names.entries.removeAll { now - it.value > WINDOW_MS }+ if (t.names.size < MIN_NAMES || now - t.lastReport < REPEAT_MS) return@synchronized null+ t.lastReport = now+ Attack(transmitter, t.names.keys.reversed(), channel, (WINDOW_MS / 1000).toInt())+ }+ attack?.let { a -> onAttack?.invoke(a) }+ return attack+ }++ @Synchronized+ fun clear() = txs.clear()+}diff --git a/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt b/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.ktindex 301839d..163f108 100644--- a/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/MonitorFrames.kt@@ -21,6 +21,8 @@ class MonitorFrames {var fingerprint: String? = 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. */+ var wildcard = false; var flockIe = false// Per-window counters for driver diagnostics (debug builds).var winHits = 0; var winMeasured = 0; var winMax = -128; var winSum = 0Lvar winOfdm = 0; var winA = -128; var winB = -128@@ -86,6 +88,8 @@ class MonitorFrames {if (it.ssid == null) pendingNames.remove(it.mac)?.let { n -> it.ssid = n }ies.wps?.let { w -> it.wps = w }}+ // One transmitter answering under many network names: a Karma / PineAP fake access point.+ if (isReal(b, a2)) ies.ssid?.takeIf { validSsid(it) }?.let { KarmaWatch.frame(mac(b, a2), it, channel, now) }}// Probe request: a device looking for networks (e.g. a laptop or a Flock camera),// often by name - the networks it has joined before.@@ -93,6 +97,8 @@ class MonitorFrames {4 -> if (captureClients && !isScannerProbe(b, d, end)) touch(a2, ap = false)?.let { s ->val ies = Ies.read(b, d + 24, end)ies.wps?.let { s.wps = it }+ if (ies.wildcard) s.wildcard = true+ if (ies.flockIe) s.flockIe = trueProbeIntel.fingerprint(b, d + 24, end)?.let { s.fingerprint = it }ies.ssid?.takeIf { validSsid(it) }?.let { name ->s.probed.remove(name); s.probed.add(name)@@ -161,7 +167,9 @@ class MonitorFrames {probedSsids = s.probed.toList(),wps = s.wps,fingerprint = s.fingerprint,- hiddenNetwork = s.hidden+ hiddenNetwork = s.hidden,+ wildcardProbe = s.wildcard,+ flockProbeIe = s.flockIe)}sightings.entries.removeAll { now - it.value.lastSeen > pruneMs }@@ -183,27 +191,39 @@ class MonitorFrames {return out}- /** Network name and channel from a management frame's information elements. */- data class Ies(val ssid: String?, val channel: Int, val wps: ProbeIntel.Wps? = null) {+ /**+ * Network name and channel from a management frame's information elements. [wildcard]: an empty+ * name element (a probe request asking every network to answer). [flockIe]: the Wi-Fi Alliance+ * element 50:6F:9A type 0x16 with 03 01 03, which Flock cameras put in their probe requests+ * (also some ordinary clients: it only ever tightens a Flock-module match).+ */+ data class Ies(val ssid: String?, val channel: Int, val wps: ProbeIntel.Wps? = null,+ val wildcard: Boolean = false, val flockIe: Boolean = false) {companion object {+ private val FLOCK_IE = byteArrayOf(0x50, 0x6F, 0x9A.toByte(), 0x16, 0x03, 0x01, 0x03)+fun read(b: ByteArray, from: Int, end: Int): Ies {var ssid: String? = null; var ds = 0; var ht = 0; var wps: ProbeIntel.Wps? = null+ var wildcard = false; var flockIe = falsevar i = fromwhile (i + 2 <= end) {val tag = b[i].toInt() and 0xff; val tl = b[i + 1].toInt() and 0xffif (i + 2 + tl > end) breakwhen (tag) {- 0 -> if (ssid == null) ssid = String(b, i + 2, tl, Charsets.UTF_8).trim { it <= ' ' }+ 0 -> {+ if (tl == 0) wildcard = true+ if (ssid == null) ssid = String(b, i + 2, tl, Charsets.UTF_8).trim { it <= ' ' }+ }3 -> if (tl >= 1) ds = b[i + 2].toInt() and 0xff // DS parameter set (2.4 GHz)61 -> if (tl >= 1) ht = b[i + 2].toInt() and 0xff // HT operation: primary channel221 -> if (tl >= 4 && b[i + 2].toInt() == 0x00 && b[i + 3].toInt() == 0x50 &&(b[i + 4].toInt() and 0xff) == 0xF2 && b[i + 5].toInt() == 0x04) {ProbeIntel.parseWps(b, i + 6, i + 2 + tl)?.let { wps = it } // WPS- }+ } else if (tl == FLOCK_IE.size && (0 until tl).all { k -> b[i + 2 + k] == FLOCK_IE[k] }) flockIe = true}i += 2 + tl}- return Ies(ssid, if (ds != 0) ds else ht, wps)+ return Ies(ssid, if (ds != 0) ds else ht, wps, wildcard, flockIe)}}}diff --git a/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt b/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.ktindex 10452a5..8c7b72d 100644--- a/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt+++ b/app/src/main/java/com/rfsentinel/app/usb/UsbWifi.kt@@ -28,7 +28,11 @@ data class MonitorSighting(/** How it builds its probe requests: marks a device model / OS ([ProbeIntel.fingerprint]). */val fingerprint: String? = 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+ val hiddenNetwork: Boolean = false,+ /** A client that sent wildcard probe requests (no network name). */+ val wildcardProbe: Boolean = false,+ /** Its probe requests carried the Wi-Fi Alliance element Flock cameras send ([MonitorFrames.Ies.flockIe]). */+ val flockProbeIe: Boolean = false)/**diff --git a/app/src/test/java/com/rfsentinel/app/detect/EspSoupIdeasTest.kt b/app/src/test/java/com/rfsentinel/app/detect/EspSoupIdeasTest.ktindex 0b965dc..029fb42 100644--- a/app/src/test/java/com/rfsentinel/app/detect/EspSoupIdeasTest.kt+++ b/app/src/test/java/com/rfsentinel/app/detect/EspSoupIdeasTest.kt@@ -40,11 +40,12 @@ class EspSoupIdeasTest {val heard = ArrayList<DeauthWatch.Attack>()DeauthWatch.onAttack = { heard += it }var t = 1_000_000L- repeat(DeauthWatch.MIN_FRAMES - 1) { assertNull(DeauthWatch.frame(ap, broadcast = true, channel = 6, now = t)); t += 100 }+ // Frames to every device count twice.+ repeat(DeauthWatch.BURST_WEIGHT / 2 - 1) { assertNull(DeauthWatch.frame(ap, broadcast = true, channel = 6, now = t)); t += 100 }val a = DeauthWatch.frame(ap, broadcast = true, channel = 6, now = t)assertNotNull(a)assertEquals(ap, a!!.bssid); assertTrue(a.broadcast); assertEquals(6, a.channel)- assertEquals(DeauthWatch.MIN_FRAMES, a.frames)+ assertEquals(DeauthWatch.BURST_WEIGHT / 2, a.frames)// Still flooding: no new alarm for a while.repeat(100) { t += 100; assertNull(DeauthWatch.frame(ap, true, 6, t)) }assertEquals(1, heard.size)diff --git a/app/src/test/java/com/rfsentinel/app/detect/SignalSweepIdeasTest.kt b/app/src/test/java/com/rfsentinel/app/detect/SignalSweepIdeasTest.ktnew file mode 100644index 0000000..836bd3c--- /dev/null+++ b/app/src/test/java/com/rfsentinel/app/detect/SignalSweepIdeasTest.kt@@ -0,0 +1,288 @@+package com.rfsentinel.app.detect++import com.rfsentinel.app.usb.DeauthWatch+import com.rfsentinel.app.usb.KarmaWatch+import com.rfsentinel.app.usb.MonitorFrames+import org.junit.After+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertNotNull+import org.junit.Assert.assertNull+import org.junit.Assert.assertTrue+import org.junit.Before+import org.junit.BeforeClass+import org.junit.Test+import java.io.File+import java.util.UUID++/**+ * Ideas from SignalSweep (GPL-3.0, facts only): the Flock camera's wildcard probe, newer Flock module+ * prefixes, Axon pairing networks, Karma access points, the second Flock battery service, the Penguin+ * serial, a SmartTag in setup, fake-tracker floods, the STM32WB hint, Apple activity and a deauth alarm+ * that a normal network's burst can't trip.+ */+class SignalSweepIdeasTest {++ companion object {+ @BeforeClass+ @JvmStatic+ fun loadVendors() {+ VendorDb.load { File("src/main/assets", it).inputStream() }+ }+ }++ @Before+ fun setUp() { HackerWatch.reset(); KarmaWatch.clear(); KarmaWatch.onAttack = null; DeauthWatch.clear(); DeauthWatch.onAttack = null }++ @After+ fun tearDown() = setUp()++ private fun mac(s: String) = s.split(":").map { it.toInt(16).toByte() }.toByteArray()++ /** A management frame: [fc0] subtype byte, addresses, [fixed] fixed-field bytes, then [ies]. */+ private fun mgmt(fc0: Int, a1: String, a2: String, a3: String, fixed: Int, ies: ByteArray): ByteArray {+ val h = ByteArray(24); h[0] = fc0.toByte()+ mac(a1).copyInto(h, 4); mac(a2).copyInto(h, 10); mac(a3).copyInto(h, 16)+ return h + ByteArray(fixed) + ies+ }++ private fun ssidIe(name: String) = byteArrayOf(0, name.length.toByte()) + name.toByteArray()+ private val rates = byteArrayOf(1, 8, 0x82.toByte(), 0x84.toByte(), 0x8B.toByte(), 0x96.toByte(), 0x0C, 0x12, 0x18, 0x24)+ private val flockIe = byteArrayOf(221.toByte(), 7, 0x50, 0x6F, 0x9A.toByte(), 0x16, 0x03, 0x01, 0x03)+ private val everyone = "ff:ff:ff:ff:ff:ff"++ private fun client(mac: String, wildcard: Boolean, ie: Boolean) = Advert(mac, Advert.Source.WIFI, -70,+ wifi = Advert.WifiInfo(2437, "", null, emptyList(), client = true, wildcardProbe = wildcard, flockProbeIe = ie))++ private fun ap(mac: String, ssid: String) = Advert(mac, Advert.Source.WIFI, -60, name = ssid,+ wifi = Advert.WifiInfo(2437, "[WPA2-PSK-CCMP][ESS]", null, emptyList()))++ private fun alpr(a: Advert) = SignatureEngine.classify(a).firstOrNull { it.category == Category.ALPR }++ // ---- Flock wildcard probe++ @Test+ fun theAdapterRecordsAWildcardProbeAndTheFlockElement() {+ val t = MonitorFrames()+ val cam = "14:b5:cd:12:34:56"+ val probe = mgmt(0x40, everyone, cam, everyone, 0, ssidIe("") + rates + flockIe)+ t.frame(probe, 0, probe.size, 6, -70, 0)+ val s = t.drain(0, 5000).single()+ assertFalse(s.isAccessPoint)+ assertTrue(s.wildcardProbe)+ assertTrue(s.flockProbeIe)+ // A laptop asking for its home network by name: neither.+ val t2 = MonitorFrames()+ val named = mgmt(0x40, everyone, "3c:22:fb:00:00:02", everyone, 0, ssidIe("HomeNet") + rates)+ t2.frame(named, 0, named.size, 6, -70, 0)+ val l = t2.drain(0, 5000).single()+ assertFalse(l.wildcardProbe); assertFalse(l.flockProbeIe)+ }++ @Test+ fun aWildcardProbeFromAFlockModuleIsAFlockCamera() {+ val bare = alpr(client("14:B5:CD:12:34:56", wildcard = true, ie = false))+ assertEquals("Possible Flock camera (probe request)", bare?.label)+ assertEquals(60, bare?.confidence)+ val withIe = alpr(client("E0:0A:F6:12:34:56", wildcard = true, ie = true))+ assertEquals("Flock Safety camera (probe request)", withIe?.label)+ assertEquals(75, withIe?.confidence)+ }++ @Test+ fun aWildcardProbeAloneOrFromAGenericChipIsNothing() {+ assertNull(alpr(client("3C:22:FB:12:34:56", wildcard = true, ie = true))) // not a Flock module+ assertNull(alpr(client("A4:CF:12:12:34:56", wildcard = true, ie = true))) // Espressif: in every gadget+ assertNull(alpr(client("82:6B:F2:12:34:56", wildcard = true, ie = true))) // a randomized address+ assertNull(alpr(client("14:B5:CD:12:34:56", wildcard = false, ie = false))) // asked for networks by name+ }++ @Test+ fun theNewFlockPrefixesCountLikeTheOldOnes() {+ for (p in listOf("14:B5:CD", "04:0D:84", "1C:34:F1", "38:5B:44", "94:34:69", "B4:E3:F9", "F0:82:C0", "E0:0A:F6")) {+ assertEquals(p, "Possible Flock camera (hidden network)", alpr(ap("$p:00:00:01", ""))?.label)+ assertEquals(p, "Flock Safety camera", alpr(ap("$p:00:00:01", "Falcon_12"))?.label)+ }+ }++ // ---- Axon pairing networks++ @Test+ fun axonBodyCamerasPairingNetworks() {+ val ab3 = SignatureEngine.classify(ap("00:11:22:33:44:55", "AB3-X12345")).first()+ assertEquals(Category.BODY_CAM, ab3.category)+ assertEquals("Axon Body 3 camera (pairing network)", ab3.label)+ assertEquals(80, ab3.confidence)+ assertEquals("Axon Body 4 camera (pairing network)", SignatureEngine.classify(ap("00:11:22:33:44:56", "ab4-1")).first().label)+ assertEquals("Axon device hotspot (body camera or in-car)", SignatureEngine.classify(ap("00:11:22:33:44:57", "AXON-7F2A")).first().label)+ // Not these: an Axon Fleet in-car network has its own rule; other "AB" names are nothing.+ assertNull(SignatureEngine.axonPairingSsid("Axon12-5g"))+ assertNull(SignatureEngine.axonPairingSsid("AB5-Home"))+ assertNull(SignatureEngine.axonPairingSsid("CAB3-x"))+ }++ // ---- Flock battery++ private fun ble(mac: String, name: String? = null, mfr: Map<Int, ByteArray> = emptyMap(), uuids: List<UUID> = emptyList(),+ data: Map<UUID, ByteArray> = emptyMap(), rssi: Int = -60) =+ Advert(mac, Advert.Source.BLE, rssi, name = name, manufacturerData = mfr, serviceUuids = uuids, serviceData = data)++ @Test+ fun theFlockBatterysSecondService() {+ val h = alpr(ble("C0:11:22:33:44:55", uuids = listOf(UUID.fromString("20c944c1-add2-42d7-a638-967ee9a26ff6"))))+ assertEquals("Flock Safety device", h?.label)+ assertEquals(80, h?.confidence)+ }++ @Test+ fun aPenguinBatteryByTheSerialInItsData() {+ val serial = byteArrayOf(1, 2) + "TN1234567".toByteArray()+ val h = alpr(ble("C0:11:22:33:44:56", mfr = mapOf(0x09C8 to serial)))+ assertEquals("Flock Safety device", h?.label)+ assertEquals(80, h?.confidence)+ // The module alone stays the weak shared-silicon hint.+ val bare = alpr(ble("C0:11:22:33:44:57", mfr = mapOf(0x09C8 to "TNX".toByteArray())))+ assertEquals(45, bare?.confidence)+ }++ // ---- Trackers++ @Test+ fun aSmartTagBeingSetUp() {+ val h = SignatureEngine.classify(ble("C0:11:22:33:44:58", data = mapOf(Advert.uuid16(0xFD59) to byteArrayOf(1)))).first()+ assertEquals(Category.TRACKER, h.category)+ assertEquals("Samsung SmartTag (not set up yet)", h.label)+ assertTrue(h.confidence < 50) // below the default alert threshold+ // A registered one is still the plain SmartTag.+ assertEquals("Samsung SmartTag", SignatureEngine.classify(ble("C0:11:22:33:44:59",+ data = mapOf(Advert.uuid16(0xFD5A) to byteArrayOf(1)))).first().label)+ }++ private fun airTag(mac: String, rssi: Int = -60) =+ ble(mac, mfr = mapOf(0x004C to byteArrayOf(0x12, 0x19) + ByteArray(25)), rssi = rssi)++ /** [n] fake tags on throwaway addresses, each heard twice a second apart, a few seconds after one another. */+ private fun fakes(n: Int, from: Long, rssi: Int = -60, prefix: String = "D0"): Long {+ var t = from+ repeat(n) { i ->+ val m = "$prefix:00:00:00:00:%02X".format(i)+ assertNull(HackerWatch.tagFlood(airTag(m, rssi), t)); t += 1_000+ HackerWatch.tagFlood(airTag(m, rssi), t); t += 2_000+ }+ return t+ }++ @Test+ fun aFloodOfFakeTrackersIsOneAlarm() {+ var t = fakes(HackerWatch.FLOOD_EVIDENCE, 0L)+ // The last fakes count once they've gone quiet: the next tracker advert notices.+ t += HackerWatch.FLOOD_QUIET_MS+ val f = HackerWatch.tagFlood(airTag("D1:00:00:00:00:01"), t)+ assertNotNull(f)+ assertEquals("Apple Find My", f!!.network)+ assertEquals(HackerWatch.FLOOD_EVIDENCE, f.addresses)+ // Still going: not again for a while.+ t = fakes(HackerWatch.FLOOD_EVIDENCE, t + 1_000, prefix = "D2") + HackerWatch.FLOOD_QUIET_MS+ assertNull(HackerWatch.tagFlood(airTag("D1:00:00:00:00:01"), t))+ }++ @Test+ fun realTagsAndFarAwayOnesAreNoFlood() {+ // Real tags: each keeps its address and is heard again and again.+ var t = 0L+ repeat(HackerWatch.FLOOD_EVIDENCE * 2) { i ->+ repeat(10) { assertNull(HackerWatch.tagFlood(airTag("E0:00:00:00:00:%02X".format(i)), t)); t += 2_000 }+ }+ assertNull(HackerWatch.tagFlood(airTag("E1:00:00:00:00:01"), t + HackerWatch.FLOOD_QUIET_MS))+ // Short-lived but weak: tags in passing cars.+ HackerWatch.reset()+ t = fakes(HackerWatch.FLOOD_EVIDENCE * 2, 0L, rssi = -90) + HackerWatch.FLOOD_QUIET_MS+ assertNull(HackerWatch.tagFlood(airTag("E1:00:00:00:00:01"), t))+ // Not a tracker at all: an iPhone's short Find My status.+ assertNull(HackerWatch.trackerNetwork(ble("E2:00:00:00:00:01", mfr = mapOf(0x004C to byteArrayOf(0x12, 0x02, 0, 2)))))+ }++ @Test+ fun theFindingNetworks() {+ assertEquals("Google Find Hub", HackerWatch.trackerNetwork(ble("E3:00:00:00:00:01", data = mapOf(Advert.uuid16(0xFEAA) to byteArrayOf(0x41)))))+ assertNull(HackerWatch.trackerNetwork(ble("E3:00:00:00:00:02", data = mapOf(Advert.uuid16(0xFEAA) to byteArrayOf(0x10))))) // Eddystone-URL+ assertEquals("Samsung SmartTag", HackerWatch.trackerNetwork(ble("E3:00:00:00:00:03", data = mapOf(Advert.uuid16(0xFD5A) to byteArrayOf(1)))))+ assertEquals("Tile", HackerWatch.trackerNetwork(ble("E3:00:00:00:00:04", data = mapOf(Advert.uuid16(0xFEEC) to byteArrayOf(1)))))+ }++ // ---- Flipper hint++ @Test+ fun anStm32wbAddressIsOnlyAWeakFlipperHint() {+ val h = SignatureEngine.classify(ble("80:E1:26:00:00:01")).first { it.category == Category.HACKER }+ assertEquals("Possible Flipper Zero (STM32WB chip)", h.label)+ assertTrue(h.confidence < 50)+ }++ // ---- Apple activity++ @Test+ fun whatAnAppleDeviceIsDoing() {+ val driving = ble("40:00:00:00:00:01", mfr = mapOf(0x004C to byteArrayOf(0x10, 0x05, 0x3D, 0x18, 0, 0, 0)))+ assertEquals("Driving", DeviceIntel.identify(driving).facts.toMap()["Apple activity"])+ val call = ble("40:00:00:00:00:02", mfr = mapOf(0x004C to byteArrayOf(0x10, 0x05, 0x1E, 0x18, 0, 0, 0)))+ assertEquals("On a call", DeviceIntel.identify(call).facts.toMap()["Apple activity"])+ }++ // ---- Karma++ @Test+ fun oneAccessPointAnsweringUnderManyNamesIsKarma() {+ val heard = ArrayList<KarmaWatch.Attack>()+ KarmaWatch.onAttack = { heard += it }+ val t = MonitorFrames()+ val pineapple = "00:13:37:00:00:01"+ val names = listOf("HomeNet", "Starbucks WiFi", "attwifi", "eduroam")+ names.forEachIndexed { i, n ->+ val resp = mgmt(0x50, "3c:22:fb:00:00:02", pineapple, pineapple, 12, ssidIe(n))+ t.frame(resp, 0, resp.size, 6, -55, i * 1_000L)+ }+ assertEquals(1, heard.size)+ assertEquals(pineapple, heard[0].transmitter)+ assertEquals(names.reversed(), heard[0].names)+ }++ @Test+ fun ordinaryAccessPointsAreNotKarma() {+ var t = 0L+ // A router answering under its own name, again and again.+ repeat(100) { assertNull(KarmaWatch.frame("00:30:44:00:00:01", "HomeNet", 6, t)); t += 500 }+ // A router with a guest network: a second address for it.+ assertNull(KarmaWatch.frame("00:30:44:00:00:02", "HomeNet-Guest", 6, t))+ // Renamed twice in a minute: still under the threshold.+ assertNull(KarmaWatch.frame("00:30:44:00:00:01", "HomeNet2", 6, t))+ assertNull(KarmaWatch.frame("00:30:44:00:00:01", "HomeNet3", 6, t))+ // Names heard more than a minute apart don't add up.+ assertNull(KarmaWatch.frame("00:30:44:00:00:01", "HomeNet4", 6, t + KarmaWatch.WINDOW_MS + 1))+ }++ // ---- Deauth++ @Test+ fun aNormalNetworksBurstDoesNotAlarm() {+ // An access point restarting drops its 24 devices at once, then nothing.+ var t = 0L+ repeat(24) { assertNull(DeauthWatch.frame("02:00:00:00:00:BB", broadcast = false, channel = 6, now = t)); t += 100 }+ // ...and a couple more devices leave later on.+ t += 7_000; assertNull(DeauthWatch.frame("02:00:00:00:00:BB", false, 6, t))+ t += 7_000; assertNull(DeauthWatch.frame("02:00:00:00:00:BB", false, 6, t))+ }++ @Test+ fun aStreamHeardInPiecesStillAlarms() {+ // The adapter is on this channel for a moment every few seconds: a few frames each time.+ var t = 0L+ var alarm: DeauthWatch.Attack? = null+ repeat(10) {+ repeat(5) { DeauthWatch.frame("02:00:00:00:00:CC", false, 1, t)?.let { alarm = it }; t += 50 }+ t += 3_000+ }+ assertNotNull(alarm)+ assertFalse(alarm!!.broadcast)+ }+}diff --git a/docs/SIGNATURES.md b/docs/SIGNATURES.mdindex 5809efd..755ef62 100644--- a/docs/SIGNATURES.md+++ b/docs/SIGNATURES.md@@ -30,6 +30,8 @@ Before shipping, the identifiers were checked against these registries:| Body cam | Company ID `0x034D` (TASER International) | 60 | SIG || Body cam | Service UUID `0xFC81` (Axon), `0xFE6B` or `0xFE6C` (TASER) | 60 | SIG || Body cam | Name contains `BodyWorn Remote` (Utility Inc.) | 80 | ACAB / nite-oui-collection |+| Body cam | WiFi network starting with `AB2-`, `AB3-` or `AB4-` (an Axon Body camera pairing) | 80 | Axon admin docs, via SignalSweep |+| Body cam | WiFi network starting with `AXON-` (an Axon device's hotspot; not the `Axon12-5g` Fleet names) | 75 | Axon admin docs, via SignalSweep || Public safety | Company ID `0x04EC`, or UUID `0xFD8E` / `0xFE04` (Motorola Solutions) | 45 | SIG; mostly two-way radios || Public safety | UUID `0xFE79` / `0xFD66` (Zebra) with a factory-serial name (`^[A-Z0-9]{2}[A-Z]{3}\d{9}$`): unrenamed fleet mobile printer, e.g. e-ticket printers | 50 | SIG; Zebra Link-OS BLE app note; field capture || Public safety | UUID `0xFE79` / `0xFD66` (Zebra) with any other name | 30 | SIG; mostly warehouse/retail printers |@@ -40,6 +42,9 @@ Before shipping, the identifiers were checked against these registries:| ALPR | WiFi SSID starting with `Flock-` | 88 | ACAB (ryanohoro, GainSec) || ALPR | BLE name `FS Ext Battery` | 80 | ACAB || ALPR | BLE name `Penguin-<digits>` or `FS-<hex>` | 70, or 80 with company ID `0x09C8` | ACAB |+| ALPR | Company ID `0x09C8` with `TN` + digits (the battery's serial) in its data | 80 | SignalSweep / oui-spy notes |+| 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 | 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 |@@ -48,7 +53,8 @@ Before shipping, the identifiers were checked against these registries:| Drone | Drone makers' own IEEE blocks (DJI, Parrot, Skydio, Autel /28, Yuneec /28, and others) | 60 | IEEE / ACAB || Tracker | Apple company ID `0x004C`, type `0x12`, length `0x19` (separated from owner only) | 70 | ACAB; arXiv 2501.17452 || Tracker | Google `0xFEAA` service data, frame `0x41` (separated; frame `0x40` = near owner, ignored) | 70 | Find Hub Network spec |-| Tracker | Samsung `0xFD5A` / Tile `0xFEED` service data | 55 | SIG |+| Tracker | Samsung `0xFD5A` / Tile `0xFEED` or `0xFEEC` service data | 55 | SIG |+| Tracker | Samsung `0xFD59` service data (a SmartTag not set up yet) | 40 | SIG; arXiv 2210.14702 || Glasses | Company ID `0x0D53` (Luxottica), `0x03C2` (Snapchat), `0x060C` (Vuzix); UUID `0xFE45` | 70 | SIG || Glasses | `0x058E` only together with the `META_RB_GLASS` token | 72 | ACAB || Glasses | Company ID `0x01AB` or UUID `0xFEB7` / `0xFEB8` (Meta corporate; also Quest headsets) | 45 | SIG / ACAB |@@ -267,6 +273,40 @@ label names.The Motorola entries are weak on purpose. In ACAB's field capture, all 27 of 27hits on Motorola WiFi prefixes turned out *not* to be body cams.+### SignalSweep compared (2026-10)++[SignalSweep](https://github.com/B0z0dcl0wn/SignalSweep) (GPL-3.0) is an ESP32+counter-surveillance scanner. Its signatures and field notes were compared with ours;+what was new was re-implemented from the facts (prefixes, UUIDs, frame layouts and+thresholds), no code was taken.++- Flock cameras turned their management network off around December 2025. Since then the+ one thing they still send is a wildcard probe request from their radio module, sometimes+ with the Wi-Fi Alliance element `50:6F:9A:16 03 01 03`. A USB WiFi adapter now flags it+ for the module blocks below, minus four that are common in ordinary devices+ (`F8:A2:D6`, `A4:CF:12`, `3C:71:BF`, `82:6B:F2`).+- Eight newer Flock radio-module blocks (Liteon and Silicon Labs): `14:B5:CD`, `04:0D:84`,+ `1C:34:F1`, `38:5B:44`, `94:34:69`, `B4:E3:F9`, `F0:82:C0`, `E0:0A:F6`.+- Axon's pairing networks, the second Flock battery service, the battery serial, a SmartTag+ in setup (table above).+- Hacking tools (`detect/HackerWatch.kt`, `usb/KarmaWatch.kt`):+ - **Karma / PineAP:** one transmitter answering under 4 or more network names within a+ minute (USB WiFi adapter). A real access point uses its own address for each network.+ - **Fake-tracker flood:** 6 or more Find My, Find Hub, SmartTag or Tile addresses in 5+ minutes, each heard 3 times or fewer within 10 s at -80 dBm or stronger and then never+ again. Real tags keep their address. One alarm per 5 minutes; real trackers are still+ reported.+ - `80:E1:26` / `80:E1:27` (STM32WB chips, as in a Flipper Zero): a weak hint (30).+- **Deauth alarm:** normal networks send bursts of 11 to 24 frames in 5 s (SignalSweep's field+ measurements). The alarm now needs 30 in 5 s (a frame to every device counts twice), or 25+ in 30 s heard in at least three 5 s slices with 4 or more each. An access point restarting+ drops all its devices at once, then stops; an attack keeps going.+- **Apple activity:** a device's detail screen shows what an iPhone, Mac or Watch is doing,+ from its Nearby Info status (idle, screen on, driving, on a call...).++Not taken: ringing a tracker (that sends), and the Remote ID OUI `90:3A:E6`, which is Parrot's+own block rather than an ASTM identifier.+### Community lists compared (2026-10)The prefix lists of five open projects were compared with ours, and every