Skip to content


Uefi (FilesystemRoot, Pe) dataclass

Filesystem extracted from a UEFI binary.

UefiUnpacker (Unpacker)

Unpack a UEFI binary. This current method cannot repack after modification because UEFITool cannot support it.

unpack(self, resource, config=None) async

Unpack the given resource.

Users should not call this method directly; rather, they should run or Resource.unpack.


Name Type Description Default
resource Resource

The resource that is being unpacked


Optional config for unpacking. If an implementation provides a default, this default will always be used when config would otherwise be None. Note that a copy of the default config will be passed, so the default config values cannot be modified persistently by a component run.

Source code in ofrak/core/
async def unpack(self, resource: Resource, config=None):
    ROM_FILE = "uefi.rom"

    with tempfile.TemporaryDirectory() as temp_flush_dir:
        # uefiextract always outputs to the CWD, so we must run this command from the temp dir to not leave behind artifacts
        await resource.flush_data_to_disk(ROM_FILE)
        cmd = [
        proc = await asyncio.create_subprocess_exec(
        returncode = await proc.wait()
        if proc.returncode:
            raise CalledProcessError(returncode=returncode, cmd=cmd)

        uefi_view = await resource.view_as(Uefi)
        await uefi_view.initialize_from_disk(os.path.join(temp_flush_dir, f"{ROM_FILE}.dump"))