From f31e55fea4fd5fca7598f9e20caed50ae04796e5 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 10 Sep 2024 15:00:04 +0200 Subject: bcd: make recovery modifications optional Ignore recovery disable if no Recovery node is found in the BCD. --- src/utils/bcd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/bcd.py b/src/utils/bcd.py index dc85cc3..c2a13a0 100644 --- a/src/utils/bcd.py +++ b/src/utils/bcd.py @@ -85,7 +85,11 @@ def _match_node_with_type_data(hive, entry_node): def disable_recovery_field(hive, entry_node): - recovery_node = get_node_child_from_path(hive, entry_node, f'Elements/{BCDEntryElement.RECOVERY_ENABLED.value}') + try: + recovery_node = get_node_child_from_path(hive, entry_node, f'Elements/{BCDEntryElement.RECOVERY_ENABLED.value}') + except: + logging.info("no Recovery entry is found, skipping") + return recovery_value = {'key': 'Element', 't': RegistryType.BINARY.value, 'value': b'\x00'} hive.node_set_value(recovery_node, recovery_value) -- cgit v1.2.3-18-g5258