Skip to content

Commit

Permalink
skip unprocessed guid defined sections (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeggor authored Feb 1, 2024
1 parent f05ed14 commit 0dda10b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions bin/uefi-firmware-parser
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ from uefi_firmware import AutoParser
import uefi_firmware.utils # import nocolor

def _process_show_extract(parsed_object):
if parsed_object is None:
return

global FILENAME
if not args.quiet:
parsed_object.showinfo('')
Expand Down
3 changes: 0 additions & 3 deletions uefi_firmware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import os

from . import uefi
from . import pfs
from . import me
from . import flash

from .misc import checker
from .base import FirmwareObject, RawObject, AutoRawObject
Expand Down
8 changes: 5 additions & 3 deletions uefi_firmware/uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,9 @@ def process(self):
if raw_object:
self.parsed_object = RawObject(self.data)
status = True
elif isinstance(self.parsed_object, GuidDefinedSection):
self.parsed_object = None
return True
return status

def build(self, generate_checksum=False, debug=False):
Expand All @@ -872,7 +875,6 @@ def build(self, generate_checksum=False, debug=False):
string_size = struct.pack("<I", size)
header = struct.pack("<3sB", string_size[:3], self.type)
return size, header + data
pass

def showinfo(self, ts='', index=-1):
print ("%s type 0x%02x, size 0x%x (%d bytes) (%s section)" % (
Expand Down Expand Up @@ -1186,11 +1188,11 @@ def _is_ucode(self, data):
return data[:4] == "\x01\x00\x00\x00" and data[20:24] == "\x01\x00\x00\x00"

def _guessinfo_dict(self, data):
if _is_ucode(data):
if self._is_ucode(data):
return "Might contain CPU microcodes"

def _guessinfo_text(self, ts, data, index="N/A"):
if _is_ucode(data):
if self._is_ucode(data):
print ("%s Might contain CPU microcodes" % (
blue("%sBlob %d:" % (ts, index))))

Expand Down

0 comments on commit 0dda10b

Please sign in to comment.