-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvendors.py
More file actions
105 lines (97 loc) · 5.29 KB
/
Copy pathvendors.py
File metadata and controls
105 lines (97 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright (c) 2026 reusteur73
# Licensed under the MIT License.
# See LICENSE file in the project root for full license information.
# (category, display_name) keyed by lowercase substring of the MAC vendor string.
# Matching: key is tested as substring of vendor.lower(), first match wins.
VENDOR_CATEGORIES: dict[str, tuple[str, str]] = {
# ── Phones / Tablets ──────────────────────────────────────────────────────
"apple": ("phone", "Apple"),
"samsung": ("phone", "Samsung"),
"xiaomi": ("phone", "Xiaomi"),
"huawei": ("phone", "Huawei"),
"oppo": ("phone", "OPPO"),
"oneplus": ("phone", "OnePlus"),
"google": ("phone", "Google"),
"motorola": ("phone", "Motorola"),
"sony": ("phone", "Sony"),
"realme": ("phone", "Realme"),
"vivo": ("phone", "Vivo"),
"honor": ("phone", "Honor"),
"nothing": ("phone", "Nothing"),
# ── Routers / Access Points / Network security ────────────────────────────
"cisco": ("router", "Cisco"),
"netgear": ("router", "Netgear"),
"tp-link": ("router", "TP-Link"),
"linksys": ("router", "Linksys"),
"d-link": ("router", "D-Link"),
"ubiquiti": ("router", "Ubiquiti"),
"mikrotik": ("router", "MikroTik"),
"routerboard": ("router", "MikroTik"),
"synology": ("router", "Synology"),
"aruba": ("router", "Aruba"),
"fortinet": ("router", "Fortinet"),
"pfsense": ("router", "pfSense"),
"technicolor": ("router", "Technicolor"),
"arcadyan": ("router", "Arcadyan"),
"sagemcom": ("router", "Sagemcom"),
"ruckus": ("router", "Ruckus"),
"stormshield": ("router", "Stormshield"),
# ── Computers / NICs / Adapters ──────────────────────────────────────────
"intel": ("computer", "Intel"),
"realtek": ("computer", "Realtek"),
"dell": ("computer", "Dell"),
"hewlett": ("computer", "HP"),
"hp ": ("computer", "HP"),
"lenovo": ("computer", "Lenovo"),
"acer": ("computer", "Acer"),
"gigabyte": ("computer", "Gigabyte"),
"giga-byte": ("computer", "Gigabyte"),
"asustek": ("computer", "ASUS"),
"asus": ("computer", "ASUS"),
"micro-star": ("computer", "MSI"),
"msi": ("computer", "MSI"),
"vmware": ("computer", "VMware"),
"parallels": ("computer", "Parallels"),
"broadcom": ("computer", "Broadcom"),
"azurewave": ("computer", "AzureWave"),
"asix": ("computer", "ASIX"),
"speed dragon": ("computer", "Speed Dragon"),
"clevo": ("computer", "Clevo"),
"quanta": ("computer", "Quanta"),
"liteon": ("computer", "Lite-On"),
"lite-on": ("computer", "Lite-On"),
"icp": ("computer", "ICP Electronics"),
# ── Servers / Hypervisors ─────────────────────────────────────────────────
"proxmox": ("server", "Proxmox"),
"supermicro": ("server", "Supermicro"),
"ibm": ("server", "IBM"),
"fujitsu": ("server", "Fujitsu"),
# ── IoT / Smart devices ───────────────────────────────────────────────────
"espressif": ("iot", "ESP Device"),
"raspberry": ("iot", "Raspberry Pi"),
"philips": ("iot", "Philips"),
"amazon": ("iot", "Amazon"),
"roku": ("iot", "Roku"),
"sonos": ("iot", "Sonos"),
"ring": ("iot", "Ring"),
"nest": ("iot", "Nest"),
"shelly": ("iot", "Shelly"),
"tuya": ("iot", "Smart Device"),
"nintendo": ("iot", "Nintendo"),
"valve": ("iot", "Steam Deck"),
"xbox": ("iot", "Xbox"),
"playstation": ("iot", "PlayStation"),
# ── TVs / Streaming ───────────────────────────────────────────────────────
"lg": ("tv", "LG"),
"sharp": ("tv", "Sharp"),
"hisense": ("tv", "Hisense"),
}
def guess_device_category(vendor: str | None) -> tuple[str, str | None]:
"""Returns (category, display_name) from a MAC vendor string."""
if not vendor:
return "unknown", None
v = vendor.lower()
for key, (cat, display) in VENDOR_CATEGORIES.items():
if key in v:
return cat, display
return "unknown", vendor