From db31547b81dbd0265d3ccf3795862676c37bf378 Mon Sep 17 00:00:00 2001 From: jgstew Date: Mon, 2 Oct 2023 13:44:42 -0400 Subject: [PATCH] add debug output to fileexegetinfope --- SharedProcessors/FileExeGetInfoPE.py | 7 +++++-- Test-Recipes/FileExeGetInfoPE.test.recipe.yaml | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SharedProcessors/FileExeGetInfoPE.py b/SharedProcessors/FileExeGetInfoPE.py index 54f5488..a2b57c1 100644 --- a/SharedProcessors/FileExeGetInfoPE.py +++ b/SharedProcessors/FileExeGetInfoPE.py @@ -13,7 +13,7 @@ __all__ = ["FileExeGetInfoPE"] -def dump_info_pefile(filepath, first_only=True): +def dump_info_pefile(filepath, first_only=True, verbosity=0): """dump pefile info StringTable Originally from: @@ -33,6 +33,8 @@ def dump_info_pefile(filepath, first_only=True): pe_info_dict[ str_entry[0].decode("utf-8", "backslashreplace") ] = str_entry[1].decode("utf-8", "backslashreplace") + if verbosity > 3: + print(pe_info_dict) if first_only: return pe_info_dict return pe_info_dict @@ -82,8 +84,9 @@ def main(self): custom_peinfo_index = self.env.get("custom_peinfo_index", "FileVersion") custom_peinfo_output = self.env.get("custom_peinfo_output", "version") peinfo_first_only = self.env.get("peinfo_first_only", True) + verbosity = int(self.env.get("verbose", 0)) - pe_info_dict = dump_info_pefile(file_pathname, peinfo_first_only) + pe_info_dict = dump_info_pefile(file_pathname, peinfo_first_only, verbosity) self.output(f"Info: full pe_info: {pe_info_dict}", 4) diff --git a/Test-Recipes/FileExeGetInfoPE.test.recipe.yaml b/Test-Recipes/FileExeGetInfoPE.test.recipe.yaml index 0cd5179..57b9611 100644 --- a/Test-Recipes/FileExeGetInfoPE.test.recipe.yaml +++ b/Test-Recipes/FileExeGetInfoPE.test.recipe.yaml @@ -6,10 +6,12 @@ Input: MinimumVersion: "2.3" Process: - Processor: com.github.jgstew.SharedProcessors/SharedUtilityMethods + - Processor: URLDownloaderPython Arguments: url: https://raw.githubusercontent.com/ralphje/signify/master/tests/test_data/SoftwareUpdate.exe COMPUTE_HASHES: False + - Processor: com.github.jgstew.SharedProcessors/FileExeGetInfoPE # Example Output: # 'file_peinfo_CompanyName': 'Apple Inc.',