decalage2 / oletools

oletools - python tools to analyze MS OLE2 files (Structured Storage, Compound File Binary Format) and MS Office documents, for malware analysis, forensics and debugging.
http://www.decalage.info/python/oletools
Other
2.81k stars 560 forks source link

Remove imp import from xxxswf for python 3.12 compatability #841

Closed cccs-jh closed 1 month ago

cccs-jh commented 4 months ago

The imp module is removed in 3.12 and causes an error when loading xxxswf. The recommended replacement is importlib but here the use of imp is actually redundant. When yara isn't found the import yara statement already throws an ImportError for 3.5 and earlier, and for 3.6 and later it throws a ModuleNotFoundError which is a subclass of ImportError and is caught by the same try catch.

hugovk commented 1 month ago

This will fix https://github.com/decalage2/oletools/issues/813.