Skip to content

Instantly share code, notes, and snippets.

@spookyahell
Last active November 6, 2023 09:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spookyahell/b317bdf0712aac5fd37dd79f70bfbe69 to your computer and use it in GitHub Desktop.
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
'''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