From 08d8b1e20a33c52cc9cb27266a78f63f99459a51 Mon Sep 17 00:00:00 2001 From: Janis Streib <janis.streib@kit.edu> Date: Wed, 26 Mar 2025 18:58:46 +0100 Subject: [PATCH] FIX: disable oui_lookup_disabled check.. just in case... --- model/macfinder.py | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/model/macfinder.py b/model/macfinder.py index b38c4ea..7f51410 100644 --- a/model/macfinder.py +++ b/model/macfinder.py @@ -11,29 +11,29 @@ from model.settings import settings OUI_DB = dict() # TODO: redis-cache -if not settings.oui_lookup_disabled: - for oui in ['http://standards-oui.ieee.org/oui.txt', 'https://standards-oui.ieee.org/oui28/mam.txt', - 'https://standards-oui.ieee.org/oui36/oui36.txt']: - ouis = requests.get(oui).text.split('\n') # normal request, not with fastapi Request Object - last_hex = '' - if len(ouis) == 0: - raise ValueError(f'Empty OUI-DB from {oui}!') - for line in ouis: - if '(hex)' not in line: - if '(base 16)' in line: - p16 = line.split('(base 16)') - p16[0] = p16[0].strip() - if '-' in p16[0]: - r = [int(p, base=16) for p in p16[0].split('-')] - OUI_DB[last_hex].append((r[0], r[1], p16[1].strip())) - continue - parts = line.split('(hex)') - parts[0] = parts[0].strip().lower().replace('-', ':') - last_hex = parts[0] - if parts[0] not in OUI_DB: - OUI_DB[parts[0]] = [(None, None, parts[1].strip())] - else: - OUI_DB[parts[0]].append((None, None, parts[1].strip())) +# if not settings.oui_lookup_disabled: +for oui in ['http://standards-oui.ieee.org/oui.txt', 'https://standards-oui.ieee.org/oui28/mam.txt', + 'https://standards-oui.ieee.org/oui36/oui36.txt']: + ouis = requests.get(oui).text.split('\n') # normal request, not with fastapi Request Object + last_hex = '' + if len(ouis) == 0: + raise ValueError(f'Empty OUI-DB from {oui}!') + for line in ouis: + if '(hex)' not in line: + if '(base 16)' in line: + p16 = line.split('(base 16)') + p16[0] = p16[0].strip() + if '-' in p16[0]: + r = [int(p, base=16) for p in p16[0].split('-')] + OUI_DB[last_hex].append((r[0], r[1], p16[1].strip())) + continue + parts = line.split('(hex)') + parts[0] = parts[0].strip().lower().replace('-', ':') + last_hex = parts[0] + if parts[0] not in OUI_DB: + OUI_DB[parts[0]] = [(None, None, parts[1].strip())] + else: + OUI_DB[parts[0]].append((None, None, parts[1].strip())) class MacFinderJobCreationRequest(BaseModel): -- GitLab