Skip to content

Commit

Permalink
add debug output to fileexegetinfope
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Oct 2, 2023
1 parent b004f23 commit db31547
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SharedProcessors/FileExeGetInfoPE.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions Test-Recipes/FileExeGetInfoPE.test.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down

0 comments on commit db31547

Please sign in to comment.