Created
June 6, 2024 10:13
-
-
Save rmkanda/32ca4c863af9307d900bb20daced681d to your computer and use it in GitHub Desktop.
DLL File info - pefile
This file contains 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
import pefile | |
import os | |
def print_version_info(pe): | |
for fileinfo in pe.FileInfo[0]: | |
if fileinfo.Key.decode() == 'StringFileInfo': | |
for st in fileinfo.StringTable: | |
for entry in st.entries.items(): | |
print(f"{entry[0].decode()}: {entry[1].decode()}") | |
BASE_PATH = "./test" | |
DLLS = [ | |
"System.CodeDom.dll", | |
"System.IO.Ports.dll" | |
] | |
for dll in DLLS: | |
print(f"File: {dll}") | |
dll_file = f"{BASE_PATH}/{dll}" | |
if os.path.exists(dll_file): | |
pe = pefile.PE(dll_file) | |
print_version_info(pe) | |
print("\n\n") | |
pe.close() | |
else: | |
print(f"File {dll} does not exist.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment