mype = pefile.PE(pefilepath)
# print pe # parse_version_information('MajorLinkerVersion')
if hasattr(mype, 'VS_VERSIONINFO'):
if hasattr(mype, 'FileInfo'):
for entry in mype.FileInfo:
if hasattr(entry, 'StringTable'):
for st in entry.StringTable:
for k, v in st.entries.items():
print k
print v
if hasattr(mype, 'VS_VERSIONINFO'): if hasattr(mype, 'FileInfo'): for entry in mype.FileInfo: if hasattr(entry, 'StringTable'): for st in entry.StringTable: for k, v in st.entries.items(): print k print v 这个有个小BUG,应该如下: if hasattr(peInfo, 'VS_VERSIONINFO'): if hasattr(peInfo, 'FileInfo'): print('count %d' %peInfo.FileInfo.__len__()); for entry in peInfo.FileInfo: for list1 in entry: if hasattr(list1, 'StringTable'): for st in list1.StringTable: for k, v in st.entries.items(): print(str(k),':',str(v.decode('utf-8)')))