Python implements the method for calculating the resource icon crc value, pythoncrc
This article describes how to use python to calculate the resource icon crc value. The specific method is as follows:
The key to implementing this function is to parse the resource information, find the icon data, and then calculate the crc of the data.
The specific implementation code is as follows:
def _get_iconcrc(self, file_path): """ Generates the crc32 hash of the icon of the file. @return: str, the str value of the file's icon """ iconData = "" mype = pefile.PE(file_path) if hasattr(mype, "DIRECTORY_ENTRY_RESOURCE"): resIcons = filter(lambda x: x.id==pefile.RESOURCE_TYPE['RT_ICON'], mype.DIRECTORY_ENTRY_RESOURCE.entries) if len(resIcons)>0: resIcons = resIcons[0] if hasattr(resIcons, "directory"): for resId in resIcons.directory.entries: if hasattr(resId, 'directory'): for resLang in resId.directory.entries: iconData += mype.get_data(resLang.data.struct.OffsetToData, resLang.data.struct.Size) if not iconData: print "not iconData" return None else: return self._crc32(iconData)
I hope this article will help you with Python programming.
How does python calculate the value of crc32?
Binascii. crc32
Python implementation click the taskbar icon pop-up window
Hello, python visualization has several packages:
Tk
Wxpython
You can find some examples online.