One dig query; returns status/AD-flag/query-time/answers, parsed.
(name, resolver=None, rtype='A')
| 1051 | '00:1b:63': 'Apple', 'ac:bc:32': 'Apple', '90:9c:4a': 'Apple', |
| 1052 | '00:50:56': 'VMware', '00:0c:29': 'VMware', '00:05:69': 'VMware', |
| 1053 | '08:00:27': 'VirtualBox', '00:15:5d': 'Microsoft Hyper-V', |
| 1054 | '00:16:6c': 'Samsung', 'e8:50:8b': 'Samsung', '5c:0a:5b': 'Samsung', |
| 1055 | '3c:97:0e': 'Intel', '00:1b:21': 'Intel', '34:13:e8': 'Intel', |
| 1056 | '00:1a:a1': 'Cisco', '00:1b:0d': 'Cisco', |
| 1057 | '50:c7:bf': 'TP-Link', 'a4:2b:b0': 'TP-Link', 'c0:06:c3': 'TP-Link', |
| 1058 | '00:14:6c': 'Netgear', '20:e5:2a': 'Netgear', |
| 1059 | '24:0a:c4': 'Espressif', '30:ae:a4': 'Espressif', |
| 1060 | '7c:9e:bd': 'Espressif', 'a0:20:a6': 'Espressif', |
| 1061 | '00:e0:fc': 'Huawei', 'ec:b5:fa': 'Philips', |
| 1062 | } |
| 1063 | |
| 1064 | _OUI_DB_PATHS = ('/usr/share/arp-scan/ieee-oui.txt', |
| 1065 | '/usr/share/nmap/nmap-mac-prefixes') |
| 1066 | # Cap the loaded OUI table so a pathological file can't blow memory. |
| 1067 | _OUI_DB_CAP = 60000 |
| 1068 | _oui_db_cache = None |
| 1069 | _oui_db_lock = threading.Lock() |
| 1070 | |
| 1071 | |
| 1072 | def _mac_norm(mac): |
| 1073 | """Normalise a MAC to lowercase colon form, or None if it isn't a MAC.""" |
| 1074 | if not mac or not isinstance(mac, str): |
| 1075 | return None |
| 1076 | hexs = re.sub(r'[^0-9a-fA-F]', '', mac) |
| 1077 | if len(hexs) != 12: |
| 1078 | return None |
| 1079 | hexs = hexs.lower() |
| 1080 | return ':'.join(hexs[i:i + 2] for i in range(0, 12, 2)) |
| 1081 | |
| 1082 | |
| 1083 | def _mac_first_octet(mac): |
| 1084 | try: |
| 1085 | return int(mac[0:2], 16) |
no test coverage detected