feat: add dll version function

This commit is contained in:
DDSRem
2025-02-07 12:48:32 +08:00
parent 6f5509775f
commit 05bc3013d9
2 changed files with 25 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/local/bin/python3
# pylint: disable=C0103
# pylint: disable=C0114
import pefile
def get_file_version(file_path):
"""
获取文件版本
"""
pe = pefile.PE(file_path)
for file_info in pe.FileInfo[0]:
if file_info.Key == b"StringFileInfo":
for st in file_info.StringTable:
for entry in st.entries.items():
if entry[0] == b"FileVersion":
return entry[1].decode("utf-8")
version = get_file_version("/config/StrmAssistant.dll")
if version:
print(f"{version}")
+2 -1
View File
@@ -4,4 +4,5 @@ qrcode
argparse
requests
pycryptodome
aligo
aligo
pefile