uefi-firmware
raw JSON → 1.11 verified Fri May 01 auth: no python
Python library for parsing and manipulating UEFI firmware volumes, files, sections, and capsules. It supports common UEFI structures like FFS, FV, FFSv3, compressed sections, and more. The latest version on PyPI is 1.11, but the GitHub repo has releases up to 1.13. Active development with occasional updates.
pip install uefi-firmware Common errors
error ImportError: No module named 'uefi_firmware.constructs' ↓
cause Trying to import constructs submodule that doesn't exist in modern versions.
fix
Use 'from construct import Container, Struct' etc., and install construct if needed.
error uefi_firmware.AutoParser' object has no attribute 'objects' ↓
cause AutoParser returns a list stored as 'result' attribute, not 'objects'.
fix
Access parser.result instead of parser.objects.
Warnings
breaking Python 2 support was dropped in version 1.8. If you are still on Python 2, pin to <1.8. ↓
fix Use Python 3.6+ or pin to 'uefi-firmware<1.8'.
deprecated The 'construct' dependency is optional but old examples may try to import directly from 'uefi_firmware.constructs'. Use 'construct' package directly if needed. ↓
fix Install 'construct' separately if needed, and import from the 'construct' package, not from 'uefi_firmware'.
gotcha AutoParser may not detect all structures in fragmented or corrupted firmware images. It will raise exceptions for invalid data. ↓
fix Wrap parsing in try-except to handle parse failures, and consider using lower-level classes if AutoParser fails.
Imports
- AutoParser wrong
from uefi_firmware.parser import AutoParsercorrectfrom uefi_firmware import AutoParser - FirmwareVolume
from uefi_firmware.volume import FirmwareVolume
Quickstart
import os
from uefi_firmware import AutoParser
# Path to a UEFI firmware image (e.g., a BIOS update file)
firmware_path = os.environ.get('FIRMWARE_PATH', 'test.rom')
with open(firmware_path, 'rb') as f:
data = f.read()
parser = AutoParser(data)
print(f"Parsed {len(parser.objects)} objects")
for obj in parser.objects:
print(type(obj).__name__)