diff --git a/Scripts/platforms/windows.py b/Scripts/platforms/windows.py index e64a6c5..ed7b790 100644 --- a/Scripts/platforms/windows.py +++ b/Scripts/platforms/windows.py @@ -16,6 +16,7 @@ class WindowsHardwareInfo: self.classify_gpu = gpu_identifier.GPUIdentifier().classify_gpu self.get_device_location_paths = device_locator.WindowsDeviceLocator().get_device_location_paths self.utils = utils.Utils() + self.usb_ids = self.utils.read_file(self.utils.get_full_path("Scripts", "datasets", "usb.ids")) def parse_device_path(self, device_path): if "VEN" in device_path: @@ -341,7 +342,10 @@ class WindowsHardwareInfo: seen_ids.add(device_info.get("Device ID")) if not device_info.get("Bus Type") in ("ACPI"): - device_name = self.utils.usb_ids.get(device_info.get("Device ID")[:4], {}).get("devices", {}).get(device_info.get("Device ID")[5:]) or device_name + try: + device_name = self.usb_ids.get(device_info.get("Device ID")[:4]).get("devices")[device_info.get("Device ID")[5:]] + except: + pass device_info["Bus Type"] = "USB" del device_info["Device Type"] else: diff --git a/Scripts/utils.py b/Scripts/utils.py index be24a63..129ac20 100755 --- a/Scripts/utils.py +++ b/Scripts/utils.py @@ -10,6 +10,14 @@ class Utils: def __init__(self, script_name = "Hardware Sniffer"): self.script_name = script_name + def get_full_path(self, *path): + if getattr(sys, 'frozen', False): + base_path = sys._MEIPASS + else: + base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + return os.path.join(base_path, *path) + def write_file(self, file_path, data): file_extension = os.path.splitext(file_path)[1]