utils: handle exceptions caused by the hivex package

The mage creation process was being interrupted by an error
trying to read the Windows registry by the Hivex library.
Now the exceptions are handled and an error is reported.
master
Alejandro Sirgo Rica 2024-03-07 10:58:21 +01:00 committed by lupoDharkael
parent f5501aac91
commit 52ab38fc28
1 changed files with 6 additions and 3 deletions

View File

@ -84,9 +84,12 @@ def _fill_package_set_2(h, pkg_set):
def _get_package_set_windows(hivepath):
packages = set()
h = hivex.Hivex(hivepath)
_fill_package_set_1(h, packages)
_fill_package_set_2(h, packages)
try:
h = hivex.Hivex(hivepath)
_fill_package_set_1(h, packages)
_fill_package_set_2(h, packages)
except Exception as e:
logging.error(f'Hivex was not able to operate over {hivepath}. Reported: {e}')
return packages