From 35f97a4b8f4bebeb40aa0b46e5d4cdfb7f6b332c Mon Sep 17 00:00:00 2001 From: David Santos <44490090+dsecuma@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:41:23 +0100 Subject: [PATCH] check flare-capa with python version --- lib/cuckoo/common/integrations/capa.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cuckoo/common/integrations/capa.py b/lib/cuckoo/common/integrations/capa.py index 13dd1c97858..8ad59a48836 100644 --- a/lib/cuckoo/common/integrations/capa.py +++ b/lib/cuckoo/common/integrations/capa.py @@ -28,9 +28,16 @@ HAVE_FLARE_CAPA = False if processing_conf.flare_capa.enabled or reporting_conf.flare_capa_summary.enabled: try: + from platform import python_version + from packaging import version from capa.version import __version__ as capa_version - if capa_version[0] != "7": + if version.parse(python_version()) >= version.parse("3.10.0"): + capa_compatible_version = "8" + else: + capa_compatible_version = "7" + + if version.parse(capa_version).base_version.split('.')[0] != capa_compatible_version: print("FLARE-CAPA missed or incompatible version. Run: poetry install") else: import capa.capabilities.common