From 8b08b76f777d92b1afd99a55a515a70b2b2fe7b6 Mon Sep 17 00:00:00 2001 From: TKE Date: Tue, 26 Jan 2021 16:16:31 +0100 Subject: [PATCH] Fix Bug in mac-lookup --- visidatarc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/visidatarc b/visidatarc index b743f88..d749dd4 100644 --- a/visidatarc +++ b/visidatarc @@ -15,10 +15,10 @@ def sym_time(val): @functools.lru_cache() def vendor(mac): try: - from mac_vendor_lookup import MacLookup as mlu - return mlu().lookup(mac) + from mac_vendor_lookup import InvalidMacError, MacLookup as mlu + return mlu().lookup(mac.strip()) except InvalidMacError: - return "not a MAC" + return f"not a MAC {str(mac).strip()} of type {type(mac)}" except ModuleNotFoundError: return "module not available" @@ -43,9 +43,10 @@ def dns_lookup(domain,record='A'): def _ipinfo(ip): try: import requests + import json r = requests.get(url='http://ipinfo.io/{}/json'.format(ip)) return r.json() - except simplejson.errors.JSONDecodeError as e: + except json.JSONDecodeError as e: return None except ModuleNotFoundError: return None