def get_exported_functions(self):
"""Get the exported function names of this PE file."""
filetype = self.get_type()
if "MS-DOS" not in filetype and "PE32" not in self.get_type():
return
if not HAVE_PEFILE:
if not File.notified_pefile:
File.notified_pefile = True
log.warning("Unable to import pefile (`pip install pefile`)")
return
try:
pe = pefile.PE(self.file_path)
if not hasattr(pe, "DIRECTORY_ENTRY_EXPORT"):
return
for export in pe.DIRECTORY_ENTRY_EXPORT.symbols:
if export.name:
yield export.name
except Exception as e:
log.warning("Error enumerating exported functions: %s", e)
评论列表
文章目录