From b12ad641591522a53f77caca56fc60b8bbdbddb4 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Tue, 29 Jul 2025 12:55:27 +0200 Subject: [PATCH] refs #2542 correctly decode hivexregedit UTF-16LE output --- CHANGELOG.md | 6 ++++++ ogclient/lib/python3/InventoryLib.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5f4efa..0c273b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.1] - 2025-07-29 + +### Fixed + +- Correctly decode hivexregedit UTF-16LE output + ## [1.1.0] - 2025-07-24 ### Changed diff --git a/ogclient/lib/python3/InventoryLib.py b/ogclient/lib/python3/InventoryLib.py index a83ae3d..78ec75a 100644 --- a/ogclient/lib/python3/InventoryLib.py +++ b/ogclient/lib/python3/InventoryLib.py @@ -266,8 +266,8 @@ def ogListSoftware (disk, par): if shutil.which ('hivexregedit'): hive = RegistryLib.ogGetHivePath (mntdir, 'software') if hive: - cmd1_out = subprocess.run (['hivexregedit', '--unsafe-printable-strings', '--export', hive, r'\Microsoft\Windows\CurrentVersion\Uninstall'], capture_output=True, text=True).stdout - cmd1_out += subprocess.run (['hivexregedit', '--unsafe-printable-strings', '--export', hive, r'\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'], capture_output=True, text=True).stdout + cmd1_out = subprocess.run (['hivexregedit', '--unsafe-printable-strings', '--export', hive, r'\Microsoft\Windows\CurrentVersion\Uninstall'], capture_output=True, text=True, encoding='utf-16le').stdout + cmd1_out += subprocess.run (['hivexregedit', '--unsafe-printable-strings', '--export', hive, r'\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'], capture_output=True, text=True, encoding='utf-16le').stdout out = name = '' for l in cmd1_out.splitlines(): words = l.split ('"')