mirror of
https://github.com/xiaoyaDev/xiaoya-alist.git
synced 2026-10-16 21:50:48 +08:00
feat: add dll version function
This commit is contained in:
@@ -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}")
|
||||
@@ -4,4 +4,5 @@ qrcode
|
||||
argparse
|
||||
requests
|
||||
pycryptodome
|
||||
aligo
|
||||
aligo
|
||||
pefile
|
||||
Reference in New Issue
Block a user