Refresh snapshot to 2026-11-25: +300 OUI, +10 Bluetooth assigned numbers
Browse files- README.md +16 -3
- data/bluetooth_assigned_numbers.csv +0 -0
- data/source_manifest.csv +11 -11
- data/vendor_identifiers.csv +0 -0
- data/vendor_summary.csv +13 -13
- scripts/build_snapshot.py +241 -0
README.md
CHANGED
|
@@ -63,12 +63,25 @@ for impersonation or nuisance testing.
|
|
| 63 |
- `data/source_manifest.csv`: source URLs, snapshot hashes, and row counts.
|
| 64 |
- `schema/vendor_identifiers.schema.json`: vendor identifier schema.
|
| 65 |
- `schema/bluetooth_assigned_numbers.schema.json`: assigned-number schema.
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
Current vendor identifier records: `
|
| 68 |
|
| 69 |
-
Current Bluetooth assigned-number records: `
|
| 70 |
|
| 71 |
-
Snapshot date: `2026-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
## Intended Use
|
| 74 |
|
|
|
|
| 63 |
- `data/source_manifest.csv`: source URLs, snapshot hashes, and row counts.
|
| 64 |
- `schema/vendor_identifiers.schema.json`: vendor identifier schema.
|
| 65 |
- `schema/bluetooth_assigned_numbers.schema.json`: assigned-number schema.
|
| 66 |
+
- `scripts/build_snapshot.py`: rebuilds the tables from a fresh download of
|
| 67 |
+
the upstream registries.
|
| 68 |
|
| 69 |
+
Current vendor identifier records: `6513`.
|
| 70 |
|
| 71 |
+
Current Bluetooth assigned-number records: `1237`.
|
| 72 |
|
| 73 |
+
Snapshot date: `2026-11-25`.
|
| 74 |
+
|
| 75 |
+
## Changelog
|
| 76 |
+
|
| 77 |
+
- `2026-11-25`: refreshed from upstream. Added 300 IEEE OUI/MA-L assignments
|
| 78 |
+
(Huawei/Honor 114, Apple 80, Samsung 24, Xiaomi/Huami 22, Amazon 11,
|
| 79 |
+
Google 10, Motorola/Lenovo 10, Microsoft 9, OPPO/realme 8, vivo 6, Sony 3,
|
| 80 |
+
LG 2, Meta 1) and 10 Bluetooth assigned numbers (AD Type `0x33` IP Link,
|
| 81 |
+
GATT Service `0x1860` Tire Pressure Monitoring System, and GATT
|
| 82 |
+
Characteristics `0x2C3B`-`0x2C42`). No new Bluetooth Company Identifiers
|
| 83 |
+
for the tracked vendors. No records were removed or renamed.
|
| 84 |
+
- `2026-05-25`: initial snapshot.
|
| 85 |
|
| 86 |
## Intended Use
|
| 87 |
|
data/bluetooth_assigned_numbers.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/source_manifest.csv
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
dataset_component,source_authority,source_url,snapshot_date,source_sha256,curated_records
|
| 2 |
-
vendor_identifiers,IEEE Registration Authority,https://standards-oui.ieee.org/oui/oui.csv,2026-
|
| 3 |
-
vendor_identifiers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/company_identifiers/company_identifiers.yaml,2026-
|
| 4 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/core/ad_types.yaml,2026-
|
| 5 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/service_uuids.yaml,2026-
|
| 6 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/characteristic_uuids.yaml,2026-
|
| 7 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/descriptors.yaml,2026-
|
| 8 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/declarations.yaml,2026-
|
| 9 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/protocol_identifiers.yaml,2026-
|
| 10 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/service_class.yaml,2026-
|
| 11 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/units.yaml,2026-
|
| 12 |
-
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/core/appearance_values.yaml,2026-
|
|
|
|
| 1 |
dataset_component,source_authority,source_url,snapshot_date,source_sha256,curated_records
|
| 2 |
+
vendor_identifiers,IEEE Registration Authority,https://standards-oui.ieee.org/oui/oui.csv,2026-11-25,e6e5726282b211d61e889cc1c153e53ca51ea0f4572ffb913dbfb38a93a98f12,6489
|
| 3 |
+
vendor_identifiers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/company_identifiers/company_identifiers.yaml,2026-11-25,459c1d512d51a4b9c4653252da624f8cf907fa51db2ce3cc1d929c55873e946f,24
|
| 4 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/core/ad_types.yaml,2026-11-25,52ea5060271deee9431c3fc2b29f65424d91bac0ee5283852dbaa11b7c08a704,52
|
| 5 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/service_uuids.yaml,2026-11-25,401d8e0962d2586dc2526e9ecedef40803c6e09b689767a526e86caa783c3166,76
|
| 6 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/characteristic_uuids.yaml,2026-11-25,f6c645d80eb175495fe23ee624d82f34e8317d7131e407d2d69fb5e2d9faac3f,512
|
| 7 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/descriptors.yaml,2026-11-25,0f71692193b852063d3f5e797924953dc7253fad71a233f2be0f5fdb5be3665c,24
|
| 8 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/declarations.yaml,2026-11-25,6932cfde003161b69241a61e01c78107fb91f0bc7327bbefd819e5cbdd2a4685,4
|
| 9 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/protocol_identifiers.yaml,2026-11-25,bfd6eb1604619904f49a20dd6886f28411c6dc48ae1c600f5dae83e941279f17,24
|
| 10 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/service_class.yaml,2026-11-25,dca1e3c4eabad2c34935535acac4b5362e856b2d009d239a676fcbe97acf9c07,76
|
| 11 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/uuids/units.yaml,2026-11-25,fbf00acc12bfd2bbef9869f9a8f49fe182c4bea1f557152d3a67ca33ade0ded5,127
|
| 12 |
+
bluetooth_assigned_numbers,Bluetooth SIG,https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/core/appearance_values.yaml,2026-11-25,0341ff695f2d8aaee13a36fc7ef4cf671196455c1b1020363267786ad8fb038a,342
|
data/vendor_identifiers.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/vendor_summary.csv
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
vendor_slug,vendor_display_name,ecosystem_tags,total_identifiers,ieee_oui_ma_l_count,bluetooth_sig_company_identifier_count,notes
|
| 2 |
-
amazon,Amazon,alexa|fire-tv|ring|iot,
|
| 3 |
-
apple,Apple,ios|ipados|macos|watchos|tvos|find-my,
|
| 4 |
-
google_android,Google / Android,android|pixel|wearos|nearby-share|fast-pair,
|
| 5 |
-
huawei,Huawei,android|harmonyos|wearables,
|
| 6 |
-
lg,LG,android|webos|consumer-electronics,
|
| 7 |
-
meta,Meta,quest|vr|ar|social,
|
| 8 |
-
microsoft,Microsoft,windows|xbox|surface,
|
| 9 |
-
motorola_lenovo,Motorola / Lenovo,android|wearables|pc,
|
| 10 |
-
oppo_oneplus_realme,OPPO / OnePlus / realme,android|coloros|oxygenos|realme-ui,
|
| 11 |
-
samsung,Samsung,android|galaxy|smartthings|wearos,
|
| 12 |
-
sony,Sony,android|audio|playstation|consumer-electronics,140,
|
| 13 |
-
vivo,vivo,android|originos|funtouch-os,
|
| 14 |
-
xiaomi,Xiaomi,android|miui|hyperos|wearables|iot,
|
|
|
|
| 1 |
vendor_slug,vendor_display_name,ecosystem_tags,total_identifiers,ieee_oui_ma_l_count,bluetooth_sig_company_identifier_count,notes
|
| 2 |
+
amazon,Amazon,alexa|fire-tv|ring|iot,226,225,1,Counts are based on keyword grouping over public registries.
|
| 3 |
+
apple,Apple,ios|ipados|macos|watchos|tvos|find-my,1594,1593,1,Counts are based on keyword grouping over public registries.
|
| 4 |
+
google_android,Google / Android,android|pixel|wearos|nearby-share|fast-pair,116,114,2,Counts are based on keyword grouping over public registries.
|
| 5 |
+
huawei,Huawei,android|harmonyos|wearables,2184,2182,2,Counts are based on keyword grouping over public registries.
|
| 6 |
+
lg,LG,android|webos|consumer-electronics,120,119,1,Counts are based on keyword grouping over public registries.
|
| 7 |
+
meta,Meta,quest|vr|ar|social,18,16,2,Counts are based on keyword grouping over public registries.
|
| 8 |
+
microsoft,Microsoft,windows|xbox|surface,133,132,1,Counts are based on keyword grouping over public registries.
|
| 9 |
+
motorola_lenovo,Motorola / Lenovo,android|wearables|pc,196,193,3,Counts are based on keyword grouping over public registries.
|
| 10 |
+
oppo_oneplus_realme,OPPO / OnePlus / realme,android|coloros|oxygenos|realme-ui,281,278,3,Counts are based on keyword grouping over public registries.
|
| 11 |
+
samsung,Samsung,android|galaxy|smartthings|wearos,977,975,2,Counts are based on keyword grouping over public registries.
|
| 12 |
+
sony,Sony,android|audio|playstation|consumer-electronics,143,140,3,Counts are based on keyword grouping over public registries.
|
| 13 |
+
vivo,vivo,android|originos|funtouch-os,172,171,1,Counts are based on keyword grouping over public registries.
|
| 14 |
+
xiaomi,Xiaomi,android|miui|hyperos|wearables|iot,353,351,2,Counts are based on keyword grouping over public registries.
|
scripts/build_snapshot.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Rebuild the dataset tables from a fresh upstream snapshot.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
python3 scripts/build_snapshot.py --upstream DIR --date YYYY-MM-DD
|
| 6 |
+
|
| 7 |
+
DIR holds the raw upstream files named like the manifest paths with "/"
|
| 8 |
+
replaced by "_" (oui.csv, company_identifiers_company_identifiers.yaml,
|
| 9 |
+
core_ad_types.yaml, uuids_service_uuids.yaml, ...).
|
| 10 |
+
|
| 11 |
+
vendor_identifiers is rebuilt in full. bluetooth_assigned_numbers is rebuilt
|
| 12 |
+
from YAML for every namespace except GAP appearance rows, which are kept from
|
| 13 |
+
the previous snapshot and only re-stamped (the script refuses to run if the
|
| 14 |
+
appearance source changed).
|
| 15 |
+
"""
|
| 16 |
+
import argparse
|
| 17 |
+
import csv
|
| 18 |
+
import hashlib
|
| 19 |
+
import re
|
| 20 |
+
from collections import Counter
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
ROOT = Path(__file__).resolve().parent.parent
|
| 24 |
+
DATA = ROOT / "data"
|
| 25 |
+
SIG_BASE = "https://bitbucket.org/bluetooth-SIG/public/raw/main/assigned_numbers/"
|
| 26 |
+
OUI_URL = "https://standards-oui.ieee.org/oui/oui.csv"
|
| 27 |
+
COMPANY_FILE = "company_identifiers/company_identifiers.yaml"
|
| 28 |
+
APPEARANCE_FILE = "core/appearance_values.yaml"
|
| 29 |
+
|
| 30 |
+
# namespace -> (source file, key holding the number)
|
| 31 |
+
SIG_TABLES = {
|
| 32 |
+
"ble_ad_type": ("core/ad_types.yaml", "value"),
|
| 33 |
+
"gatt_service_uuid": ("uuids/service_uuids.yaml", "uuid"),
|
| 34 |
+
"gatt_characteristic_uuid": ("uuids/characteristic_uuids.yaml", "uuid"),
|
| 35 |
+
"gatt_descriptor_uuid": ("uuids/descriptors.yaml", "uuid"),
|
| 36 |
+
"gatt_declaration_uuid": ("uuids/declarations.yaml", "uuid"),
|
| 37 |
+
"bluetooth_protocol_uuid": ("uuids/protocol_identifiers.yaml", "uuid"),
|
| 38 |
+
"bluetooth_service_class_uuid": ("uuids/service_class.yaml", "uuid"),
|
| 39 |
+
"bluetooth_unit_uuid": ("uuids/units.yaml", "uuid"),
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def sha256(path):
|
| 44 |
+
return hashlib.sha256(path.read_bytes()).hexdigest()
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def local_name(upstream, rel):
|
| 48 |
+
return upstream / rel.replace("/", "_")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_yaml_list(path):
|
| 52 |
+
"""Parse the flat `- key: value` list format used by Bluetooth SIG YAML."""
|
| 53 |
+
items, cur = [], None
|
| 54 |
+
for line in path.read_text(encoding="utf-8").splitlines():
|
| 55 |
+
m = re.match(r"^\s*(-\s+)?([A-Za-z_]+):\s*(.*?)\s*$", line)
|
| 56 |
+
if not m or line.lstrip().startswith("#"):
|
| 57 |
+
continue
|
| 58 |
+
dash, key, val = m.groups()
|
| 59 |
+
if len(val) >= 2 and val[0] == val[-1] and val[0] in "'\"":
|
| 60 |
+
val = val[1:-1].replace("''", "'")
|
| 61 |
+
if dash:
|
| 62 |
+
cur = {}
|
| 63 |
+
items.append(cur)
|
| 64 |
+
if cur is not None and val:
|
| 65 |
+
cur[key] = val
|
| 66 |
+
return items
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def norm(text):
|
| 70 |
+
return " " + re.sub(r"[^a-z0-9]+", " ", text.lower()).strip() + " "
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def slug(text):
|
| 74 |
+
return re.sub(r"[^a-z0-9]+", "-", text.lower()).strip("-")
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def hex_value(raw, width):
|
| 78 |
+
return "0x" + format(int(raw, 16), "0%dX" % width)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def read_csv(name):
|
| 82 |
+
with open(DATA / name, newline="", encoding="utf-8") as fh:
|
| 83 |
+
return list(csv.DictReader(fh))
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def write_csv(name, rows, fields):
|
| 87 |
+
with open(DATA / name, "w", newline="", encoding="utf-8") as fh:
|
| 88 |
+
writer = csv.DictWriter(fh, fieldnames=fields, lineterminator="\n")
|
| 89 |
+
writer.writeheader()
|
| 90 |
+
writer.writerows(rows)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class VendorMatcher:
|
| 94 |
+
def __init__(self, vendors):
|
| 95 |
+
self.vendors = [
|
| 96 |
+
(v, [norm(k) for k in v["keyword_hints"].split("|")]) for v in vendors
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
def match(self, name):
|
| 100 |
+
n = norm(name)
|
| 101 |
+
hits = [v for v, kws in self.vendors if any(k in n for k in kws)]
|
| 102 |
+
if len(hits) > 1:
|
| 103 |
+
raise ValueError("ambiguous vendor match: %r" % name)
|
| 104 |
+
return hits[0] if hits else None
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def build_vendor_identifiers(upstream, date, matcher, hashes):
|
| 108 |
+
rows = []
|
| 109 |
+
|
| 110 |
+
def add(vendor, record_id, namespace, value, fmt, name, authority, url, sha):
|
| 111 |
+
rows.append({
|
| 112 |
+
"record_id": record_id,
|
| 113 |
+
"vendor_slug": vendor["vendor_slug"],
|
| 114 |
+
"vendor_display_name": vendor["vendor_display_name"],
|
| 115 |
+
"ecosystem_tags": vendor["ecosystem_tags"],
|
| 116 |
+
"identifier_namespace": namespace,
|
| 117 |
+
"identifier_value": value,
|
| 118 |
+
"identifier_format": fmt,
|
| 119 |
+
"assignment_name": name,
|
| 120 |
+
"source_authority": authority,
|
| 121 |
+
"source_url": url,
|
| 122 |
+
"source_snapshot_date": date,
|
| 123 |
+
"source_sha256": sha,
|
| 124 |
+
"safe_use_category": "public_identifier_metadata",
|
| 125 |
+
"dual_use_notes": "identifier_only",
|
| 126 |
+
})
|
| 127 |
+
|
| 128 |
+
with open(upstream / "oui.csv", newline="", encoding="utf-8-sig") as fh:
|
| 129 |
+
for r in csv.DictReader(fh):
|
| 130 |
+
if r["Registry"] != "MA-L":
|
| 131 |
+
continue
|
| 132 |
+
name = r["Organization Name"].strip()
|
| 133 |
+
vendor = matcher.match(name)
|
| 134 |
+
if vendor:
|
| 135 |
+
oui = r["Assignment"].strip().upper()
|
| 136 |
+
add(vendor, "ieee-oui-" + oui, "ieee_oui_ma_l", oui,
|
| 137 |
+
"24-bit hexadecimal OUI/MA-L assignment", name,
|
| 138 |
+
"IEEE Registration Authority", OUI_URL, hashes["oui"])
|
| 139 |
+
|
| 140 |
+
for item in parse_yaml_list(local_name(upstream, COMPANY_FILE)):
|
| 141 |
+
vendor = matcher.match(item["name"])
|
| 142 |
+
if vendor:
|
| 143 |
+
value = hex_value(item["value"], 4)
|
| 144 |
+
add(vendor, "bluetooth-company-id-" + value[2:],
|
| 145 |
+
"bluetooth_sig_company_identifier", value,
|
| 146 |
+
"16-bit hexadecimal Bluetooth Company Identifier", item["name"],
|
| 147 |
+
"Bluetooth SIG", SIG_BASE + COMPANY_FILE, hashes[COMPANY_FILE])
|
| 148 |
+
|
| 149 |
+
rows.sort(key=lambda r: (r["vendor_slug"], r["record_id"]))
|
| 150 |
+
return rows
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def build_assigned_numbers(upstream, date, old_rows, hashes):
|
| 154 |
+
rows = []
|
| 155 |
+
for namespace, (rel, key) in SIG_TABLES.items():
|
| 156 |
+
for item in parse_yaml_list(local_name(upstream, rel)):
|
| 157 |
+
raw = item[key]
|
| 158 |
+
value = hex_value(raw, len(raw) - 2)
|
| 159 |
+
rows.append({
|
| 160 |
+
"record_id": "%s-%s-%s" % (namespace, value[2:], slug(item["name"])),
|
| 161 |
+
"assigned_number_namespace": namespace,
|
| 162 |
+
"assigned_number_value": value,
|
| 163 |
+
"name": item["name"],
|
| 164 |
+
"qualified_identifier": item.get("id", ""),
|
| 165 |
+
"parent_namespace": "",
|
| 166 |
+
"parent_value": "",
|
| 167 |
+
"reference": item.get("reference", ""),
|
| 168 |
+
"source_authority": "Bluetooth SIG",
|
| 169 |
+
"source_file": rel,
|
| 170 |
+
"source_url": SIG_BASE + rel,
|
| 171 |
+
"source_snapshot_date": date,
|
| 172 |
+
"source_sha256": hashes[rel],
|
| 173 |
+
"safe_use_category": "public_assigned_number_metadata",
|
| 174 |
+
"dual_use_notes": "identifier_only",
|
| 175 |
+
})
|
| 176 |
+
for r in old_rows:
|
| 177 |
+
if r["source_file"] == APPEARANCE_FILE:
|
| 178 |
+
rows.append(dict(r, source_snapshot_date=date, source_sha256=hashes[APPEARANCE_FILE]))
|
| 179 |
+
rows.sort(key=lambda r: (r["assigned_number_namespace"], int(r["assigned_number_value"], 16)))
|
| 180 |
+
return rows
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def main():
|
| 184 |
+
ap = argparse.ArgumentParser()
|
| 185 |
+
ap.add_argument("--upstream", required=True, type=Path)
|
| 186 |
+
ap.add_argument("--date", required=True)
|
| 187 |
+
args = ap.parse_args()
|
| 188 |
+
|
| 189 |
+
files = [COMPANY_FILE, APPEARANCE_FILE] + [rel for rel, _ in SIG_TABLES.values()]
|
| 190 |
+
hashes = {rel: sha256(local_name(args.upstream, rel)) for rel in files}
|
| 191 |
+
hashes["oui"] = sha256(args.upstream / "oui.csv")
|
| 192 |
+
|
| 193 |
+
old_manifest = read_csv("source_manifest.csv")
|
| 194 |
+
old_appearance_sha = {m["source_sha256"] for m in old_manifest if m["source_url"].endswith(APPEARANCE_FILE)}
|
| 195 |
+
if old_appearance_sha != {hashes[APPEARANCE_FILE]}:
|
| 196 |
+
raise SystemExit("appearance_values.yaml changed upstream; extend the builder first")
|
| 197 |
+
|
| 198 |
+
vendors = read_csv("vendors.csv")
|
| 199 |
+
old_vi = read_csv("vendor_identifiers.csv")
|
| 200 |
+
old_bn = read_csv("bluetooth_assigned_numbers.csv")
|
| 201 |
+
|
| 202 |
+
vi = build_vendor_identifiers(args.upstream, args.date, VendorMatcher(vendors), hashes)
|
| 203 |
+
bn = build_assigned_numbers(args.upstream, args.date, old_bn, hashes)
|
| 204 |
+
write_csv("vendor_identifiers.csv", vi, list(old_vi[0].keys()))
|
| 205 |
+
write_csv("bluetooth_assigned_numbers.csv", bn, list(old_bn[0].keys()))
|
| 206 |
+
|
| 207 |
+
# vendor_summary
|
| 208 |
+
old_summary = read_csv("vendor_summary.csv")
|
| 209 |
+
counts = Counter((r["vendor_slug"], r["identifier_namespace"]) for r in vi)
|
| 210 |
+
summary = []
|
| 211 |
+
for s in old_summary:
|
| 212 |
+
v = s["vendor_slug"]
|
| 213 |
+
oui = counts[(v, "ieee_oui_ma_l")]
|
| 214 |
+
bt = counts[(v, "bluetooth_sig_company_identifier")]
|
| 215 |
+
summary.append(dict(s, total_identifiers=oui + bt,
|
| 216 |
+
ieee_oui_ma_l_count=oui,
|
| 217 |
+
bluetooth_sig_company_identifier_count=bt))
|
| 218 |
+
write_csv("vendor_summary.csv", summary, list(old_summary[0].keys()))
|
| 219 |
+
|
| 220 |
+
# source_manifest
|
| 221 |
+
manifest = []
|
| 222 |
+
for m in old_manifest:
|
| 223 |
+
url = m["source_url"]
|
| 224 |
+
if url == OUI_URL:
|
| 225 |
+
sha = hashes["oui"]
|
| 226 |
+
n = sum(1 for r in vi if r["identifier_namespace"] == "ieee_oui_ma_l")
|
| 227 |
+
elif url.endswith(COMPANY_FILE):
|
| 228 |
+
sha = hashes[COMPANY_FILE]
|
| 229 |
+
n = sum(1 for r in vi if r["identifier_namespace"] == "bluetooth_sig_company_identifier")
|
| 230 |
+
else:
|
| 231 |
+
rel = url[len(SIG_BASE):]
|
| 232 |
+
sha = hashes[rel]
|
| 233 |
+
n = sum(1 for r in bn if r["source_file"] == rel)
|
| 234 |
+
manifest.append(dict(m, snapshot_date=args.date, source_sha256=sha, curated_records=n))
|
| 235 |
+
write_csv("source_manifest.csv", manifest, list(old_manifest[0].keys()))
|
| 236 |
+
|
| 237 |
+
print("vendor_identifiers", len(vi), "bluetooth_assigned_numbers", len(bn))
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
if __name__ == "__main__":
|
| 241 |
+
main()
|