From 794ff9ab6695b75c8e6466527147d6434b373b17 Mon Sep 17 00:00:00 2001 From: Wesley Shields Date: Tue, 27 Jan 2026 04:15:00 -0500 Subject: [PATCH] Add crx and dex modules to python invoke API. (#534) While working on something else I realized the crx and dex modules are not exposed in the Python API for invocation directly. This commit fixes it by adding them to the SupportedModules list (and also exposes it as a feature in the case of the dex module). --- py/Cargo.toml | 2 ++ py/src/lib.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/py/Cargo.toml b/py/Cargo.toml index 43994c01e..7f5060628 100644 --- a/py/Cargo.toml +++ b/py/Cargo.toml @@ -19,6 +19,7 @@ crate-type = ["cdylib"] console-module = ["yara-x/console-module"] crx-module = ["yara-x/crx-module"] cuckoo-module = ["yara-x/cuckoo-module"] +dex-module = ["yara-x/dex-module"] dotnet-module = ["yara-x/dotnet-module"] elf-module = ["yara-x/elf-module"] hash-module = ["yara-x/hash-module"] @@ -39,6 +40,7 @@ default = [ "crx-module", "cuckoo-module", "dotnet-module", + "dex-module", "elf-module", "hash-module", "lnk-module", diff --git a/py/src/lib.rs b/py/src/lib.rs index 7e2bc6616..088169120 100644 --- a/py/src/lib.rs +++ b/py/src/lib.rs @@ -66,6 +66,10 @@ enum SupportedModules { Pe, #[cfg(feature = "dotnet-module")] Dotnet, + #[cfg(feature = "crx-module")] + Crx, + #[cfg(feature = "dex-module")] + Dex, } /// Formats YARA rules. @@ -313,6 +317,14 @@ impl Module { SupportedModules::Dotnet => { yrx::mods::invoke_dyn::(data) } + #[cfg(feature = "crx-module")] + SupportedModules::Crx => { + yrx::mods::invoke_dyn::(data) + } + #[cfg(feature = "dex-module")] + SupportedModules::Dex => { + yrx::mods::invoke_dyn::(data) + } _ => return Ok(py.None().into_bound(py)), };