BIOSUtilities v25.02.23

Fixed AMI PFAT Extract file naming of "ALL" and "OOB"
Upgraded dependency "dissect.util" from 3.18 to 3.19
This commit is contained in:
Plato Mavropoulos 2025-02-24 00:42:26 +02:00
parent 5f9ea8e846
commit 40553b3244
9 changed files with 26 additions and 25 deletions

View file

@ -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

View file

@ -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

View file

@ -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'

View file

@ -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)

View file

@ -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

View file

@ -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,

View file

@ -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]

View file

@ -1,2 +1,2 @@
mypy==1.13.0
pylint==3.3.1
mypy==1.15.0
pylint==3.3.4

View file

@ -1,2 +1,2 @@
dissect.util==3.18
dissect.util==3.19
pefile==2023.2.7