diff --git a/Scripts/aida64.py b/Scripts/aida64.py index d00b6d7..9aad47a 100644 --- a/Scripts/aida64.py +++ b/Scripts/aida64.py @@ -1,4 +1,5 @@ from Scripts.datasets import pci_data +from Scripts import gpu_identifier from Scripts import utils from bs4 import BeautifulSoup @@ -6,6 +7,7 @@ class AIDA64: def __init__(self): self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"} self.encodings = ['utf-8', 'latin-1', 'ISO-8859-1'] + self.gpu_identifier = gpu_identifier.GPUIdentifier() self.utils = utils.Utils() def try_open(self, file_path): @@ -211,47 +213,26 @@ class AIDA64: return audio_devices_info - def gpu(self, gpu_data, vulkan_data, windows_devices): - gpu_info_dict = {} + def gpu(self, pci_devices, windows_devices): + gpu_info = {} - for adapter_name, adapter_props in windows_devices.get("Display adapters", windows_devices.get("Display adaptors", {})).items(): + display_adapters = windows_devices.get("Display adapters", windows_devices.get("Display adaptors", {})) + gpu_by_class = None + if not display_adapters: + gpu_by_class = self.utils.search_dict_iter(pci_devices, "VGA Display Controller", equal=False) + if gpu_by_class: + gpu_in_windows_devices = self.utils.search_dict_iter(windows_devices, gpu_by_class.get("Device ID")) + display_adapters = self.utils.search_dict_iter(windows_devices, gpu_in_windows_devices) + + for adapter_name, adapter_props in display_adapters.items(): device_id = adapter_props.get("Device ID") if not device_id: continue - manufacturer = "Intel" if device_id.startswith("8086") else "AMD" if device_id.startswith("1002") else "NVIDIA" if device_id.startswith("10DE") else "Unknown" - props_in_vulkan = self.utils.search_dict_iter(vulkan_data, device_id, equal=False) - gpu_props = self.utils.search_dict_iter(gpu_data, device_id, equal=False) - bus_type = gpu_props.get("Bus Type", "Unknown") - device_type = props_in_vulkan.get("Device Type", "Discrete GPU" if "PCI Express" in bus_type else "Integrated GPU" if "Integrated" in bus_type else "Unknown") - gpu_codename = gpu_props.get("GPU Code Name", props_in_vulkan.get("Device Code Name", "Unknown")) + if gpu_by_class and self.utils.contains_any(["Video Controller", "Video Adapter", "Graphics Controller"], adapter_name + adapter_props.get("PCI Device", "")) is None: + continue + gpu_info[adapter_name] = self.gpu_identifier.classify_gpu(device_id) - gpu_info_dict[gpu_props.get("Video Adapter", adapter_name)] = { - "Manufacturer": manufacturer, - "GPU Codename": gpu_codename, - "Device ID": device_id, - "Device Type": device_type, - "Memory Size": gpu_props.get("Memory Size", "Unknown") - } - - if not gpu_info_dict: - if gpu_data: - for gpu_name, gpu_props in gpu_data.items(): - gpu_props = gpu_props.get("Graphics Processor Properties", {}) - device_id = gpu_props.get("PCI Device", "Unknown").split(" / ")[0] - manufacturer = "Intel" if device_id.startswith("8086") else "AMD" if device_id.startswith("1002") else "NVIDIA" if device_id.startswith("10DE") else "Unknown" - bus_type = gpu_props.get("Bus Type", "Unknown") - device_type = "Discrete GPU" if "PCI Express" in bus_type else "Integrated GPU" if "Integrated" in bus_type else "Unknown" - gpu_codename = gpu_props.get("GPU Code Name", "Unknown") - - gpu_info_dict[gpu_props.get("Video Adapter", gpu_name.split(": ")[-1])] = { - "Manufacturer": manufacturer, - "GPU Codename": gpu_codename, - "Device ID": device_id, - "Device Type": device_type, - "Memory Size": gpu_props.get("Memory Size", "Unknown") - } - - return self.utils.sort_dict_by_key(gpu_info_dict, "Device Type") + return self.utils.sort_dict_by_key(gpu_info, "Device Type") def input(self, human_interface_devices, keyboards, pointing_devices, usb_devices): input_devices_info = {} @@ -488,8 +469,6 @@ class AIDA64: "Summary", "DMI", "CPU", - "GPU", - "Vulkan", "Windows Devices", "PCI Devices", "USB Devices" @@ -558,7 +537,7 @@ class AIDA64: current_dict[list(current_dict.keys())[0]].append(key) current_dict[list(current_dict.keys())[1]].append(value) - if len(table_names) - len(root) > 1: + if len(table_names) != len(root): raise Exception("Your AIDA64 report is missing some information. Please revise it according to the provided guidelines") return root @@ -572,7 +551,7 @@ class AIDA64: hardware = {} hardware["Motherboard"] = self.motherboard(report_dict.get("Summary", {}).get("Motherboard", {}), dmi) hardware["CPU"] = self.cpu(report_dict.get("CPU", {})) - hardware["GPU"] = self.gpu(report_dict.get("GPU", {}), report_dict.get("Vulkan", {}), windows_devices) + hardware["GPU"] = self.gpu(report_dict.get("PCI Devices", {}), windows_devices) hardware["Network"] = self.network(windows_devices, report_dict.get("PCI Devices", {})) hardware["Storage Controllers"] = self.storage_controllers(windows_devices.get("IDE ATA/ATAPI controllers", {}), windows_devices.get("Storage controllers", {})) hardware["Audio"] = self.audio(windows_devices) diff --git a/Scripts/gpu_identifier.py b/Scripts/gpu_identifier.py new file mode 100644 index 0000000..1bece8e --- /dev/null +++ b/Scripts/gpu_identifier.py @@ -0,0 +1,125 @@ +class GPUIdentifier: + def identify_intel_graphics(self, hardware_id): + gpu_codename = "Unknown" + device_id = hardware_id[5:] + + if device_id.startswith("01"): + if device_id[-2] in ["5", "6"]: + gpu_codename = "Ivy Bridge" + else: + gpu_codename = "Sandy Bridge" + elif device_id.startswith(("04", "0A", "0C", "0D")): + gpu_codename = "Haswell" + elif device_id.startswith(("0B", "16")): + gpu_codename = "Broadwell" + elif device_id.startswith(("09", "19")): + gpu_codename = "Skylake" + elif device_id.startswith("59"): + gpu_codename = "Kaby Lake" + elif device_id.startswith("87"): + gpu_codename = "Amber Lake" + elif device_id.startswith(("3E", "5A")): + if device_id.endswith(("A0", "A1")): + gpu_codename = "Whiskey Lake" + else: + gpu_codename = "Coffee Lake" + elif device_id.startswith("8A"): + gpu_codename = "Ice Lake" + elif device_id.startswith("9B"): + gpu_codename = "Comet Lake" + + return { + "Manufacturer": "Intel", + "GPU Codename": gpu_codename, + "Device ID": hardware_id, + "Device Type": "Unknown" if gpu_codename == "Unknown" else "Integrated GPU" + } + + def identify_amd_graphics(self, hardware_id): + gpu_codename = "Unknown" + device_id = hardware_id[5:] + + if device_id.startswith("15D8"): + gpu_codename = "Picasso" + elif device_id.startswith("15DD"): + gpu_codename = "Raven Ridge" + elif device_id.startswith("15E7"): + gpu_codename = "Barcelo" + elif device_id.startswith("1636"): + gpu_codename = "Renoir" + elif device_id.startswith("1638"): + gpu_codename = "Cezanne" + elif device_id.startswith("164C"): + gpu_codename = "Lucienne" + elif device_id.startswith(("67C", "67D")): + gpu_codename = "Ellesmere" + elif device_id.startswith(("67E", "67F")): + gpu_codename = "Baffin" + elif device_id.startswith("694"): + gpu_codename = "Polaris 22" + elif device_id.startswith(("698", "699")): + gpu_codename = "Lexa" + elif device_id.startswith("69A"): + gpu_codename = "Vega 12" + elif device_id.startswith("6FDF"): + gpu_codename = "Polaris 20" + elif device_id.startswith(("686", "687")): + gpu_codename = "Vega 10" + elif device_id.startswith("66A"): + gpu_codename = "Vega 20" + elif device_id.startswith("731"): + gpu_codename = "Navi 10" + elif device_id.startswith("734"): + gpu_codename = "Navi 14" + elif device_id.startswith("736"): + gpu_codename = "Navi 12" + elif device_id.startswith(("73A", "73B")): + gpu_codename = "Navi 21" + elif device_id.startswith(("73C", "73D")): + gpu_codename = "Navi 22" + elif device_id.startswith(("73E", "73FF")): + gpu_codename = "Navi 23" + + return { + "Manufacturer": "AMD", + "GPU Codename": gpu_codename, + "Device ID": hardware_id, + "Device Type": "Unknown" if gpu_codename == "Unknown" else "Integrated GPU" if device_id.startswith(("15", "16")) else "Discrete GPU" + } + + def identify_nvidia_graphics(self, hardware_id): + gpu_codename = "Unknown" + device_id = hardware_id[5:] + + if device_id.startswith(("0FC", "0FD", "0FE", "0FF", "100", "101", "102", "103", "11", "128", "129", "12A", "12B", "130")) and device_id != "1140": + gpu_codename = "Kepler" + elif device_id.startswith(("05E", "05F", "0A2", "0A3", "0A6", "0A7", "0C", "10C", "10D")): + gpu_codename = "Tesla" + elif device_id.startswith(("06C", "06D", "0DC", "0DD", "0DE", "0DF", "0E2", "0E3", "0F0", "104", "105", "107", "108", "109", "114", "120", "121", "124", "125")): + gpu_codename = "Fermi" + elif device_id.startswith(("13", "14", "16", "17")) and not device_id.startswith("172"): + gpu_codename = "Maxwell" + elif device_id.startswith(("15", "172", "1B", "1C", "1D0", "1D1", "1D3", "1D5")): + gpu_codename = "Pascal" + + return { + "Manufacturer": "NVIDIA", + "GPU Codename": gpu_codename, + "Device ID": hardware_id, + "Device Type": "Discrete GPU" + } + + def classify_gpu(self, hardware_id): + if hardware_id.startswith("8086"): + return self.identify_intel_graphics(hardware_id) + elif hardware_id.startswith("1002"): + return self.identify_amd_graphics(hardware_id) + elif hardware_id.startswith("10DE"): + return self.identify_nvidia_graphics(hardware_id) + else: + return { + "Manufacturer": "Unknown", + "GPU Codename": "Unknown", + "Device ID": hardware_id, + "Device Type": "Unknown" + } \ No newline at end of file