Skip to content

Commit 482b35b

Browse files
committed
If the loaded yara module doesn't contain a compile attr, then fallback to Maco's interface
1 parent 94cb0c6 commit 482b35b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

maco/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def object_hook(self, obj):
7777
try:
7878
# Respect cases where the extractor is tied to certain version of yara-python for processing
7979
import yara
80+
81+
if not hasattr(yara, "compile"):
82+
raise ImportError("Loaded version does not have compile method, falling back to MACO's yara interface")
83+
8084
except:
8185
# Otherwise fallback to MACO's interface for yara-python==4.5.x
8286
from maco import yara

0 commit comments

Comments
 (0)