Add debug logging for MAC vendor lookup process
This commit is contained in:
parent
7ccddd89c5
commit
bca346ac5a
1 changed files with 10 additions and 6 deletions
10
listener.py
10
listener.py
|
@ -323,8 +323,9 @@ def main():
|
||||||
|
|
||||||
def get_mac_vendor(mac):
|
def get_mac_vendor(mac):
|
||||||
prefix = mac.upper()[0:8].replace(":", "-")
|
prefix = mac.upper()[0:8].replace(":", "-")
|
||||||
print(f"[+] Looking up vendor for {prefix}...")
|
print(f"[DEBUG] Looking up prefix: {prefix}")
|
||||||
if prefix in vendor_cache:
|
if prefix in vendor_cache:
|
||||||
|
print(f"[DEBUG] Cached hit: {vendor_cache[prefix]}")
|
||||||
return vendor_cache[prefix]
|
return vendor_cache[prefix]
|
||||||
try:
|
try:
|
||||||
if not os.path.exists("oui.txt"):
|
if not os.path.exists("oui.txt"):
|
||||||
|
@ -336,12 +337,15 @@ def get_mac_vendor(mac):
|
||||||
for line in f:
|
for line in f:
|
||||||
if line.strip().endswith("(hex)"):
|
if line.strip().endswith("(hex)"):
|
||||||
parts = line.split()
|
parts = line.split()
|
||||||
if len(parts) >= 3 and parts[0] == prefix:
|
if len(parts) >= 3:
|
||||||
|
print(f"[DEBUG] Checking line: {parts}")
|
||||||
|
if parts[0] == prefix:
|
||||||
vendor = " ".join(parts[2:]).replace("(hex)", "").strip()
|
vendor = " ".join(parts[2:]).replace("(hex)", "").strip()
|
||||||
vendor_cache[prefix] = vendor
|
vendor_cache[prefix] = vendor
|
||||||
|
print(f"[DEBUG] Vendor found: {vendor}")
|
||||||
return vendor
|
return vendor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
print(f"[ERROR] Vendor lookup failed: {e}")
|
||||||
vendor_cache[prefix] = "Unknown"
|
vendor_cache[prefix] = "Unknown"
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue