Last active
November 6, 2023 09:14
-
-
Save spookyahell/b317bdf0712aac5fd37dd79f70bfbe69 to your computer and use it in GitHub Desktop.
Using the python pefile lib to extract version information from an exe file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Licensed under the MIT License :)''' | |
import pefile | |
import pprint | |
pe = pefile.PE('example.exe') | |
string_version_info = {} | |
for fileinfo in pe.FileInfo[0]: | |
if fileinfo.Key.decode() == 'StringFileInfo': | |
for st in fileinfo.StringTable: | |
for entry in st.entries.items(): | |
string_version_info[entry[0].decode()] = entry[1].decode() | |
pprint.pprint(string_version_info) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment