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.

Sort plain-named WiFi networks from the beacon: provider and home routers by WPS model or maker, business access points, enterprise, Passpoint and open WiFi

CIS-C0fb0ef4adf07a
diff --git a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt
index b87f4e8..df9a309 100644
--- a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt
+++ b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt
@@ -458,6 +458,13 @@ object DeviceIntel {
}
if (!generic) return Identity(type, facts)
+ // What kind of network a plain or hidden name hides, from the beacon itself.
+ networkKind(w, ap, macVendor, ssid.isNullOrEmpty())?.let { (kind, why) ->
+ facts += "Identified by" to why
+ if (ssid.isNullOrEmpty()) facts += "Network name" to "Hidden (not broadcast)"
+ return Identity(kind, facts)
+ }
+
// Most specific first: WPS model, Cisco AP name, BSSID registrant (if not a
// chipset maker), then an equipment maker's vendor IE.
val (make, why) = when {
@@ -473,6 +480,78 @@ object DeviceIntel {
return Identity("$type - $make", facts)
}
+ /**
+ * Internet providers' own router models, as their WPS data names them (model name / number / device
+ * name). Platforms several providers share are named by model, not provider.
+ */
+ private val ISP_ROUTER_MODELS = listOf(
+ "livebox" to "Orange Livebox", "freebox" to "Free Freebox", "\\bbbox\\b" to "Bouygues Bbox", "speedport" to "Telekom Speedport",
+ "fritz!? ?box" to "FRITZ!Box", "vodafone ?station|gigacube" to "Vodafone Station", "sky ?(hub|q hub|broadband)" to "Sky Hub",
+ "bt ?smart ?hub|bt ?hub" to "BT Smart Hub", "giga ?hub|home ?hub ?[34]000" to "Bell Home Hub", "\\bbgw\\d{3}|\\bnvg5\\d{2}|5268ac" to "AT&T gateway",
+ "\\bg[13]100\\b|\\bcr1000|fios" to "Verizon Fios router", "\\bxb[678]\\b|\\bcgm4\\d{3}|\\btg1682|\\btg3482" to "XB gateway (Comcast platform)",
+ "\\bsax1v1|\\brac2v1" to "Spectrum router", "\\beero\\b" to "eero mesh", "\\bdeco\\b" to "TP-Link Deco mesh", "\\borbi\\b" to "NETGEAR Orbi mesh"
+ ).map { (re, name) -> Regex(re, RegexOption.IGNORE_CASE) to name }
+
+ /** Makers of the routers internet providers hand out, as the IEEE lists them (short name shown). */
+ private val ISP_ROUTER_MAKERS = listOf(
+ "^sagemcom" to "Sagemcom", "^commscope|^arris$" to "CommScope / ARRIS", "^vantiva|^technicolor" to "Technicolor / Vantiva",
+ "^askey" to "Askey", "^sercomm" to "Sercomm", "^hitron" to "Hitron", "^ubee" to "Ubee", "^calix" to "Calix",
+ "^actiontec" to "Actiontec", "^2wire|^pace americas" to "2Wire / Pace", "^compal broadband" to "Compal Broadband",
+ "^castlenet" to "CastleNet", "^nokia (solutions|shanghai)|^alcatel-lucent shanghai" to "Nokia", "^avm (audiovisuelles|gmbh)" to "AVM (FRITZ!Box)",
+ "^huawei technologies" to "Huawei", "^zte corporation" to "ZTE"
+ ).map { (re, name) -> Regex(re, RegexOption.IGNORE_CASE) to name }
+
+ /** Makers of home routers and mesh systems sold in stores. */
+ private val HOME_ROUTER_MAKERS = listOf(
+ "^netgear" to "NETGEAR", "^tp-link" to "TP-Link", "^asustek" to "ASUS", "linksys" to "Linksys", "^belkin" to "Belkin",
+ "^d-link" to "D-Link", "tenda technology" to "Tenda", "^mercusys" to "Mercusys", "^eero" to "eero", "^synology" to "Synology"
+ ).map { (re, name) -> Regex(re, RegexOption.IGNORE_CASE) to name }
+
+ /** Makers of business / campus WiFi (their own address or their beacon tags). Aruba's tags carry HPE's registration. */
+ private val BUSINESS_AP_MAKERS = listOf(
+ "^cisco systems" to "Cisco", "^cisco meraki" to "Cisco Meraki", "^hewlett packard enterprise" to "Aruba (HPE)",
+ "^ruckus" to "Ruckus", "^fortinet" to "Fortinet", "^juniper networks|^mist systems" to "Juniper Mist",
+ "^extreme networks" to "Extreme Networks", "^cambium" to "Cambium"
+ ).map { (re, name) -> Regex(re, RegexOption.IGNORE_CASE) to name }
+
+ private fun maker(table: List<Pair<Regex, String>>, vararg owners: String?): String? =
+ owners.filterNotNull().firstNotNullOfOrNull { o -> table.firstOrNull { it.first.containsMatchIn(o.trim()) }?.second }
+
+ /**
+ * A network with a plain (or no) name, sorted from its beacon: Passpoint public WiFi, account sign-in
+ * (enterprise) business WiFi, a provider's router by its WPS model, business access points by maker,
+ * provider and store-bought home routers by maker or by the WPS "router / gateway" kind, then open WiFi.
+ * The kind and why, or null.
+ */
+ internal fun networkKind(w: Advert.WifiInfo?, ap: WifiFingerprint.ApInfo, macVendor: String?, hidden: Boolean = false): Pair<String, String>? {
+ if (w == null || w.client) return null
+ val ies = w.infoElements
+ // Hotspot 2.0: the Interworking element (107) or the Wi-Fi Alliance HS2.0 indication (50:6F:9A type 0x10).
+ val passpoint = ies.any { it.first == 107 } || ies.any { (id, d) ->
+ id == 221 && d.size >= 4 && Bytes.u8(d, 0) == 0x50 && Bytes.u8(d, 1) == 0x6F && Bytes.u8(d, 2) == 0x9A && Bytes.u8(d, 3) == 0x10 }
+ if (passpoint) return "Public WiFi hotspot (Passpoint)" to "Passpoint / Hotspot 2.0 elements in the beacon"
+ val enterprise = w.capabilities.contains("EAP")
+ val business = maker(BUSINESS_AP_MAKERS, macVendor, *ap.ieVendors.toTypedArray())
+ if (enterprise) return "Business WiFi (account sign-in)" + (business?.let { " - $it" } ?: "") to
+ "WPA-Enterprise security: people sign in with an account (offices, schools, hotels)"
+ val wpsText = listOfNotNull(ap.manufacturer, ap.modelName, ap.modelNumber, ap.deviceName).joinToString(" ")
+ ISP_ROUTER_MODELS.firstOrNull { it.first.containsMatchIn(wpsText) }?.let { (_, name) ->
+ return "Home router - $name" + (ap.model?.let { " ($it)" } ?: "") to "router model in the beacon's WPS data"
+ }
+ if (business != null) return "Business access point - $business" to "business WiFi maker (address or beacon tags)"
+ maker(ISP_ROUTER_MAKERS, macVendor, ap.manufacturer)?.let {
+ return "Home router (internet provider's) - ${ap.model ?: it}" to "maker of the routers internet providers hand out (address or WPS)"
+ }
+ maker(HOME_ROUTER_MAKERS, macVendor, ap.manufacturer)?.let {
+ return "Home router - ${ap.model ?: it}" to "home router maker (address or WPS)"
+ }
+ if (ap.deviceKind == "Router" || ap.deviceKind == "Gateway") {
+ return "Home router" + (ap.model?.let { " - $it" } ?: "") to "WPS device kind \"${ap.deviceKind}\""
+ }
+ if (!hidden && security(w.capabilities) == "Open (no password)") return "Open WiFi (public or guest)" to "no password"
+ return null
+ }
+
/** "NETGEAR, Inc." -> "NETGEAR"; "TP-LINK TECHNOLOGIES CO.,LTD." -> "TP-LINK". */
fun shortVendor(v: String): String =
v.replace(Regex("(?i)(?:[,.]\\s*|\\s+)(inc\\.?|corp(oration)?\\.?|co\\.?,?\\s*ltd\\.?|ltd\\.?|llc|gmbh|s\\.?a\\.?|limited|technologies|technology|systems|networks|electronics|communications?|international)\\b.*$"), "")
diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
index 1a71167..fece903 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
@@ -115,7 +115,8 @@ enum class DeviceFilter(val label: String, val liveOnly: Boolean = false) {
/** Detection categories that are cameras (police, home security, action / hidden, recording glasses). */
private val CAMERA_CATEGORIES = setOf(Category.BODY_CAM, Category.ALPR, Category.NETWORK_CAMERA, Category.OTHER_CAMERA, Category.GLASSES)
private val ROUTER_TYPE = kind("^(home router|wifi access point|vehicle / cellular router|mesh router)|access point$")
- private val HOTSPOT_TYPE = kind("^(public wifi hotspot|mobile hotspot box|phone hotspot|train wifi)")
+ // Business access points and account sign-in WiFi stay off both: they're neither.
+ private val HOTSPOT_TYPE = kind("^(public wifi hotspot|mobile hotspot box|phone hotspot|train wifi|open wifi)")
private val TV_TYPE = kind("^(smart tv|tv / streaming|game console|apple tv)|television|set-top|media player|^gaming")
private val SMART_HOME_TYPE = kind("smart-home|smart home|^iot|smart plug|bthome|^sensor|environmental sensor|light|" +
"thermostat|^hvac|^heating|air conditioning|humidifier|^fan\\b|access control|door lock|power device|domestic appliance|" +
diff --git a/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt b/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt
index bda7472..f517eab 100644
--- a/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt
+++ b/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt
@@ -208,4 +208,38 @@ class IdentifyMoreTest {
assertEquals(AdvertFingerprint.hash("n=Buds|u=|d=|m=|t=|c="), AdvertFingerprint.hash("n=Buds|u=|d=|m=|t=|c="))
assertEquals(8, AdvertFingerprint.hash("x").length)
}
+
+ @Test
+ fun plainNamedNetworksSortedFromTheBeacon() {
+ fun net(mac: String, ssid: String?, caps: String = "[WPA2-PSK-CCMP]", ies: List<Pair<Int, ByteArray>> = emptyList()) =
+ DeviceIntel.identify(Advert(mac, Advert.Source.WIFI, -60, ssid, wifi = Advert.WifiInfo(2437, caps, null, ies)),
+ VendorDb.macVendor(mac)).type
+ fun tlv(type: Int, value: String) = byteArrayOf((type shr 8).toByte(), type.toByte(), 0, value.length.toByte()) + value.toByteArray()
+ fun wps(vararg attrs: ByteArray) = 221 to (byteArrayOf(0x00, 0x50, 0xF2.toByte(), 0x04) + attrs.fold(ByteArray(0)) { a, b -> a + b })
+
+ // A provider's router by its WPS model, even renamed or hidden.
+ assertEquals("Home router - Orange Livebox (Sagemcom Livebox 5)",
+ net("06:00:00:00:00:41", "Smith house", ies = listOf(wps(tlv(0x1021, "Sagemcom"), tlv(0x1023, "Livebox 5")))))
+ // By maker: a provider's router, a store-bought one, a business access point.
+ assertEquals("Home router (internet provider's) - Sagemcom", net("00:0E:59:00:00:42", "Smith house"))
+ assertEquals("Home router (internet provider's) - ZTE", net("00:15:EB:00:00:43", null))
+ assertEquals("Home router - eero", net("00:AB:48:00:00:44", "Smith house"))
+ assertEquals("Business access point - Ruckus", net("06:00:00:00:00:45", "Guest", ies = listOf(221 to byteArrayOf(0x00, 0x13, 0x92.toByte(), 0x01))))
+ // By security: account sign-in, Passpoint, open.
+ assertEquals("Business WiFi (account sign-in) - Cisco Meraki", net("00:18:0A:00:00:46", "corp", "[WPA2-EAP-CCMP]"))
+ assertEquals("Public WiFi hotspot (Passpoint)", net("06:00:00:00:00:47", "plain", ies = listOf(107 to byteArrayOf(0x10))))
+ assertEquals("Open WiFi (public or guest)", net("06:00:00:00:00:48", "plain", "[ESS]"))
+ // WPS "router" kind with no known maker.
+ assertEquals("Home router", net("06:00:00:00:00:49", "plain",
+ ies = listOf(wps(byteArrayOf(0x10, 0x54, 0, 8, 0, 6, 0x00, 0x50, 0xF2.toByte(), 0x04, 0, 2)))))
+ // A recognised name still wins; nothing to go on stays generic.
+ assertEquals("WiFi access point", net("06:00:00:00:00:4A", "plain"))
+
+ fun kinds(type: String) = DeviceFilter.KINDS.filter { it.matches(DeviceFilter.Seen("02:00:00:00:00:4B", type, null, emptyList(), emptySet(), false)) }
+ assertEquals(listOf(DeviceFilter.ROUTERS), kinds("Home router (internet provider's) - Sagemcom"))
+ assertEquals(listOf(DeviceFilter.HOTSPOTS), kinds("Open WiFi (public or guest)"))
+ assertEquals(listOf(DeviceFilter.HOTSPOTS), kinds("Public WiFi hotspot (Passpoint)"))
+ assertEquals(emptyList<DeviceFilter>(), kinds("Business access point - Ruckus"))
+ assertEquals(emptyList<DeviceFilter>(), kinds("Business WiFi (account sign-in)"))
+ }
}
diff --git a/app/src/test/java/com/rfsentinel/app/detect/WifiFingerprintTest.kt b/app/src/test/java/com/rfsentinel/app/detect/WifiFingerprintTest.kt
index 5c824f6..9002861 100644
--- a/app/src/test/java/com/rfsentinel/app/detect/WifiFingerprintTest.kt
+++ b/app/src/test/java/com/rfsentinel/app/detect/WifiFingerprintTest.kt
@@ -44,8 +44,9 @@ class WifiFingerprintTest {
assertEquals("Nighthawk", info.deviceName)
val id = DeviceIntel.identify(wifi("02:11:22:33:44:55", null, ies))
- assertEquals("Hidden WiFi network - NETGEAR R7000", id.type)
- assertTrue(id.facts.contains("Identified by" to "WPS model in the beacon"))
+ assertEquals("Home router - NETGEAR R7000", id.type)
+ assertTrue(id.facts.contains("Identified by" to "home router maker (address or WPS)"))
+ assertTrue(id.facts.contains("Network name" to "Hidden (not broadcast)"))
}
@Test
diff --git a/docs/SIGNATURES.md b/docs/SIGNATURES.md
index 08f06d7..fa8810d 100644
--- a/docs/SIGNATURES.md
+++ b/docs/SIGNATURES.md
@@ -155,6 +155,28 @@ The access point is identified from the first of these that answers:
registry and split into equipment makers (Apple, Cisco, Ubiquiti...) and
chipset makers (Broadcom, Qualcomm, MediaTek...).
+**Kind of network.** When the name is hidden or says nothing (no ISP default,
+chain or brand name), the beacon decides the kind, first match wins:
+
+1. Passpoint / Hotspot 2.0 (Interworking IE 107, or vendor IE `50:6F:9A`
+ type `0x10`): public WiFi hotspot.
+2. WPA-Enterprise (EAP) security: business WiFi with account sign-in, plus the
+ business maker when known.
+3. WPS model of a provider's router (Livebox, Freebox, Bbox, Speedport,
+ FRITZ!Box, Vodafone Station, BT / Sky / Bell hubs, AT&T, Verizon Fios, XB
+ gateways...): home router, named for the model. Works after a rename.
+4. Business WiFi maker, from the BSSID registrant or the beacon's vendor IEs
+ (Cisco, Meraki, Aruba / HPE, Ruckus, Fortinet, Juniper Mist, Extreme,
+ Cambium): business access point. Not on the Routers chip.
+5. Maker of the routers providers hand out (Sagemcom, CommScope / ARRIS,
+ Technicolor / Vantiva, Askey, Sercomm, Hitron, Ubee, Calix, ZTE, Huawei, AVM,
+ Nokia, Actiontec, 2Wire / Pace, Compal Broadband, CastleNet): home router
+ (internet provider's). The provider itself is never guessed.
+6. Store-bought router maker (NETGEAR, TP-Link, ASUS, Linksys, Belkin, D-Link,
+ Tenda, Mercusys, eero, Synology): home router.
+7. WPS device kind Router or Gateway: home router.
+8. No password (named networks only): open WiFi, public or guest.
+
**Same access point.** Two BSSIDs belong to the same access point when
octets 2–5 are equal, the last octet is within 16, and the first octet is equal
or locally administered (virtual BSSID). The detail screen then links a hidden