summaryrefslogtreecommitdiffstats
path: root/src/utils/sw_inventory.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-03-07 10:58:21 +0100
committerlupoDharkael <izhe@hotmail.es>2024-03-08 13:03:33 +0100
commit52ab38fc28abcad001de995cbcec3ce23094b507 (patch)
treec6ca445b5f07588b6f3c9159afbf32fdf69ed57b /src/utils/sw_inventory.py
parentf5501aac91704da4e9b6d7a67633b9e52b48bef7 (diff)
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.
Diffstat (limited to 'src/utils/sw_inventory.py')
-rw-r--r--src/utils/sw_inventory.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/utils/sw_inventory.py b/src/utils/sw_inventory.py
index b2d55c3..c7bb458 100644
--- a/src/utils/sw_inventory.py
+++ b/src/utils/sw_inventory.py
@@ -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