diff --git a/CHANGELOG b/CHANGELOG index f52833a..87e69fd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +25.02.23 + +Fixed AMI PFAT Extract file naming of "ALL" and "OOB" +Upgraded dependency "dissect.util" from 3.18 to 3.19 + 24.11.10 Re-written public attributes of Apple EFI ID diff --git a/README.md b/README.md index 1acfac3..f243715 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ There are two main types of requirements, depending on the utility: "Python Pack #### Python Packages * [pefile](https://pypi.org/project/pefile/2023.2.7/) -* [dissect.util](https://pypi.org/project/dissect.util/3.18/) +* [dissect.util](https://pypi.org/project/dissect.util/3.19/) Python packages can be installed via Pypi (e.g. pip) @@ -37,7 +37,7 @@ python -m pip install --upgrade -r requirements.txt or ``` bash -python -m pip install pefile==2023.2.7 dissect.util==3.18 +python -m pip install pefile==2023.2.7 dissect.util==3.19 ``` #### External Executables / Scripts @@ -227,7 +227,7 @@ is_extracted: bool = parse_format() Parses AMI BIOS Guard (a.k.a. PFAT, Platform Firmware Armoring Technology) images, extracts their SPI/BIOS/UEFI firmware components and optionally decompiles the Intel BIOS Guard Scripts. It supports all AMI PFAT revisions and formats, including those with Index Information tables or nested AMI PFAT structures. The output comprises only final firmware components which are directly usable by end users. -Note that the AMI PFAT structure may not have an explicit component order. AMI's BIOS Guard Firmware Update Tool (AFUBGT) updates components based on the user/OEM provided Parameters and Options or Index Information table, when applicable. Thus, merging all the components together does not usually yield a proper SPI/BIOS/UEFI image. The utility does generate such a merged file with the name "00 -- \<filename\>\_ALL.bin" but it is up to the end user to determine its usefulness. Additionally, any custom OEM data, after the AMI PFAT structure, is stored in the last file with the name "\<n+1\> -- \_OOB.bin" and it is once again up to the end user to determine its usefulness. In cases where the trailing custom OEM data includes a nested AMI PFAT structure, the utility will process and extract it automatically as well. +Note that the AMI PFAT structure may not have an explicit component order. AMI's BIOS Guard Firmware Update Tool (AFUBGT) updates components based on the user/OEM provided Parameters and Options or Index Information table, when applicable. Thus, merging all the components together does not usually yield a proper SPI/BIOS/UEFI image. The utility does generate such a merged file with the name "00 -- ALL" but it is up to the end user to determine its usefulness. Additionally, any custom OEM data, after the AMI PFAT structure of "n" components, is stored in the last file with the name "\<n + 1\> -- OOB" and it is once again up to the end user to determine its usefulness. In cases where the data of a component includes a nested AMI PFAT structure, the utility will process and extract it automatically as well. #### Arguments diff --git a/biosutilities/__init__.py b/biosutilities/__init__.py index 0790d55..e6c4a95 100644 --- a/biosutilities/__init__.py +++ b/biosutilities/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 """ -Copyright (C) 2018-2024 Plato Mavropoulos +Copyright (C) 2018-2025 Plato Mavropoulos """ -__version__ = '24.11.10' +__version__ = '25.02.23' diff --git a/biosutilities/ami_pfat_extract.py b/biosutilities/ami_pfat_extract.py index c8ab2b9..9aaa8db 100644 --- a/biosutilities/ami_pfat_extract.py +++ b/biosutilities/ami_pfat_extract.py @@ -4,7 +4,7 @@ """ AMI PFAT Extract AMI BIOS Guard Extractor -Copyright (C) 2018-2024 Plato Mavropoulos +Copyright (C) 2018-2025 Plato Mavropoulos """ import ctypes @@ -15,7 +15,7 @@ import struct from typing import Any, Final, Type from biosutilities.common.externals import big_script_tool -from biosutilities.common.paths import extract_suffix, extract_folder, make_dirs, path_name, safe_name +from biosutilities.common.paths import extract_folder, make_dirs, safe_name from biosutilities.common.patterns import PAT_AMI_PFAT from biosutilities.common.structs import CHAR, ctypes_struct, UINT8, UINT16, UINT32 from biosutilities.common.system import printer @@ -229,8 +229,6 @@ class AmiPfatExtract(BIOSUtility): bg_sign_len: int = 0 - extract_name: str = path_name(in_path=self.extract_path).removesuffix(extract_suffix()) - make_dirs(in_path=self.extract_path) block_all, block_off, file_count = self._parse_pfat_hdr(buffer=pfat_buffer, padding=self.padding) @@ -297,7 +295,7 @@ class AmiPfatExtract(BIOSUtility): pfat_oob_data: bytes = pfat_buffer[block_off:] # Store out-of-bounds data after the end of PFAT files - pfat_oob_name: str = self._get_file_name(index=file_count + 1, name=f'{extract_name}_OOB.bin') + pfat_oob_name: str = self._get_file_name(index=file_count + 1, name='OOB') pfat_oob_path: str = os.path.join(self.extract_path, pfat_oob_name) @@ -312,7 +310,7 @@ class AmiPfatExtract(BIOSUtility): in_all_data: bytes = b''.join([block[1] for block in sorted(all_blocks_dict.items())]) - in_all_name: str = self._get_file_name(index=0, name=f'{extract_name}_ALL.bin') + in_all_name: str = self._get_file_name(index=0, name='ALL') in_all_path: str = os.path.join(self.extract_path, in_all_name) diff --git a/biosutilities/common/paths.py b/biosutilities/common/paths.py index f33a1a0..98203b7 100644 --- a/biosutilities/common/paths.py +++ b/biosutilities/common/paths.py @@ -2,7 +2,7 @@ # coding=utf-8 """ -Copyright (C) 2022-2024 Plato Mavropoulos +Copyright (C) 2022-2025 Plato Mavropoulos """ import os @@ -99,9 +99,7 @@ def path_name(in_path: str, limit: bool = False) -> str: comp_name: str = PurePath(in_path).name - is_win: bool = system_platform()[1] - - if limit and is_win: + if limit and system_platform()[1]: comp_name = comp_name[:MAX_WIN_COMP_LEN - len(extract_suffix())] return comp_name diff --git a/biosutilities/common/structs.py b/biosutilities/common/structs.py index 794b9b8..4486f5c 100644 --- a/biosutilities/common/structs.py +++ b/biosutilities/common/structs.py @@ -2,18 +2,18 @@ # coding=utf-8 """ -Copyright (C) 2022-2024 Plato Mavropoulos +Copyright (C) 2022-2025 Plato Mavropoulos """ import ctypes from typing import Any, Final -CHAR: Final[type[ctypes.c_char] | int] = ctypes.c_char -UINT8: Final[type[ctypes.c_ubyte] | int] = ctypes.c_ubyte -UINT16: Final[type[ctypes.c_ushort] | int] = ctypes.c_ushort -UINT32: Final[type[ctypes.c_uint] | int] = ctypes.c_uint -UINT64: Final[type[ctypes.c_uint64] | int] = ctypes.c_uint64 +CHAR: Final[Any] = ctypes.c_char +UINT8: Final[Any] = ctypes.c_ubyte +UINT16: Final[Any] = ctypes.c_ushort +UINT32: Final[Any] = ctypes.c_uint +UINT64: Final[Any] = ctypes.c_uint64 def ctypes_struct(buffer: bytes | bytearray, start_offset: int, class_object: Any, diff --git a/pyproject.toml b/pyproject.toml index 4b72d16..5536ca5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ classifiers = [ ] [project.optional-dependencies] -lznt1 = ["dissect.util == 3.18"] +lznt1 = ["dissect.util == 3.19"] pefile = ["pefile == 2023.2.7"] [project.urls] diff --git a/requirements-dev.txt b/requirements-dev.txt index b0299a4..103fdc2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,2 @@ -mypy==1.13.0 -pylint==3.3.1 +mypy==1.15.0 +pylint==3.3.4 diff --git a/requirements.txt b/requirements.txt index 5e1841f..36429ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -dissect.util==3.18 +dissect.util==3.19 pefile==2023.2.7