Small readability improvements

This commit is contained in:
j-t-1
2025-01-10 11:52:54 +00:00
committed by GitHub
parent 803c4ec364
commit 530617a700
+6 -7
View File
@@ -101,7 +101,7 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
except exceptions.InvalidAddressException:
vollog.log(
constants.LOGLEVEL_VVVV,
f"Skipping invalid idlepml4_ptr: 0x{idlepml4_ptr:0x}",
f"Skipping invalid idlepml4_ptr: {idlepml4_ptr:#x}",
)
continue
@@ -112,7 +112,7 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
if tmp_dtb % 4096:
vollog.log(
constants.LOGLEVEL_VVV,
f"Skipping non-page aligned DTB: 0x{tmp_dtb:0x}",
f"Skipping non-page aligned DTB: {tmp_dtb:#x}",
)
continue
@@ -136,7 +136,7 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
new_layer.config["kernel_virtual_offset"] = kaslr_shift
if new_layer and dtb:
vollog.debug(f"DTB was found at: 0x{dtb:0x}")
vollog.debug(f"DTB was found at: {dtb:#x}")
return new_layer
vollog.debug("No suitable mac banner could be matched")
return None
@@ -182,7 +182,7 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
aslr_shift = 0
for offset, banner in offset_generator:
banner_major, banner_minor = (int(x) for x in banner[22:].split(b".")[0:2])
banner_major, banner_minor = (int(x) for x in banner[22:].split(b".")[:2])
tmp_aslr_shift = offset - cls.virtual_to_physical_address(
version_json_address
@@ -208,7 +208,6 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
continue
aslr_shift = tmp_aslr_shift & 0xFFFFFFFF
break
vollog.log(constants.LOGLEVEL_VVVV, f"Mac find_aslr returned: {aslr_shift:0x}")
@@ -219,9 +218,9 @@ class MacIntelStacker(interfaces.automagic.StackerLayerInterface):
"""Converts a virtual mac address to a physical one (does not account
of ASLR)"""
if addr > 0xFFFFFF8000000000:
addr = addr - 0xFFFFFF8000000000
addr -= 0xFFFFFF8000000000
else:
addr = addr - 0xFF8000000000
addr -= 0xFF8000000000
return addr