import pefile, sys p = pefile.PE('/Users/jing/Documents/yutong/yutongapp/TP5(En).exe') print('ImageBase %08x' % p.OPTIONAL_HEADER.ImageBase) print('EP %08x' % p.OPTIONAL_HEADER.AddressOfEntryPoint) for s in p.sections: print(s.Name.decode().rstrip('\0'), 'VA=%08x VS=%08x PR=%08x RS=%08x' % (s.VirtualAddress, s.Misc_VirtualSize, s.PointerToRawData, s.SizeOfRawData)) print('--- imports ---') for e in p.DIRECTORY_ENTRY_IMPORT: names=[] for imp in e.imports: names.append(imp.name.decode() if imp.name else ('ord%d'%imp.ordinal)) print(e.dll.decode(), len(names))