yara-x
Python bindings for YARA-X
What it is and what it does
yara-x is the official Python interface to YARA-X, VirusTotal's pattern-matching engine designed for cybersecurity and forensic use. It lets you compile YARA rules (text-based pattern definitions) and scan binary data to find matches. The library wraps a Rust implementation, providing both speed and memory safety while keeping the Python API simple: compile rules once, then call scan() on binary buffers to get structured results showing which rules matched, which patterns within those rules fired, and at what offsets.
The package targets Python 3.9+ and comes with pre-built wheels for CPython and PyPy on Linux, macOS, and Windows, reducing installation friction. It has no runtime dependencies beyond the Python standard library, making it lightweight to add to existing projects. Active maintenance and permissive licensing make it suitable for both open-source and commercial security tooling.
Use it for:
- Scan files or network traffic for known malware signatures using compiled YARA rules.
- Build forensic analysis pipelines that identify suspicious patterns in disk images or memory dumps.
- Integrate pattern matching into security monitoring or threat-hunting workflows.
- Detect indicators of compromise by matching rule sets against collected artifacts.
- Develop custom malware classification or triage systems based on rule-driven pattern detection.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python bindings for YARA-X, a pattern-matching engine for malware detection and forensic analysis. Compile rules and scan binary data to identify matching patterns.
Yes. yara-x is actively maintained, has no security vulnerabilities, permissive licensing, and pre-built wheels that minimize install friction. Install it if you need rule-based pattern matching for malware detection, forensics, or threat hunting. The zero runtime dependencies and straightforward API make it low-risk to add to security tooling.
Install
yara-x on PyPI
pip
pip install yara-xuv
uv add yara-xpoetry
poetry add yara-xInstalling yara-x
Before you install
Medium install friction due to compiled Rust bindings, but wheels are pre-built for common platforms (CPython ABI3, PyPy, Linux/macOS/Windows). Active maintenance with recent releases.
License in practice
Permissive license (BSD) allows commercial and private use without significant restrictions.
Quickstart
import yara_x
rules = yara_x.compile('''
rule test {
strings:
$a = "foobar"
condition:
$a
}''')
results = rules.scan(b"foobar")
print(results.matching_rules[0].identifier)
Requires Python 3.9 or later; compiled Rust extension may require a compatible C runtime on some systems.
Verify before relying
- Performance characteristics (scan speed, memory usage) on large binaries or rule sets.
- Compatibility with custom YARA rule syntax extensions or YARA 4.x rule features.
- Whether the library supports streaming/incremental scanning or only in-memory buffers.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 51 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 447,011/month — #6,609 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: yara_x-1.19.0-cp38-abi3-macosx_14_0_arm64.whl; yara_x-1.19.0-cp38-abi3-macosx_14_0_x86_64.whl; yara_x-1.19.0-cp38-abi3-manylinux_2_28_aarch64.whl; yara_x-1.19.0-cp38-abi3-manylinux_2_28_x86_64.whl; yara_x-1.19.0-cp38-abi3-win_amd64.whl; yara_x-1.19.0-pp311-pypy311_pp73-macosx_14_0_arm64.whl; yara_x-1.19.0-pp311-pypy311_pp73-macosx_14_0_x86_64.whl; yara_x-1.19.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl; yara_x-1.19.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl; yara_x-1.19.0-pp311-pypy311_pp73-win_amd64.whl
Keywords: pattern-matching, cybersecurity, forensics, malware, yara
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
plyaraParses YARA rule files into Python dictionary…
permissive · top 15,000 on PyPI
yara-pythonyara-python provides a Python interface to…
permissive · top 5,000 on PyPI
cisco-ai-mcp-scannerScans MCP (Model Context Protocol) servers and…
unclear · top 15,000 on PyPI
maecParse, manipulate, and generate MAEC (Malware…
permissive · top 15,000 on PyPI
cisco-ai-skill-scannerScans AI Agent Skills for prompt injection,…
permissive · top 15,000 on PyPI
PyMeta3PyMeta3 compiles pattern-matching grammars…
permissive · top 15,000 on PyPI
maco-extractorMaco is a framework for standardizing malware…
permissive · top 15,000 on PyPI
guarddogGuardDog is a CLI tool that scans PyPI, npm,…
permissive · top 15,000 on PyPI
mail-parserParses raw email messages into structured…
permissive · top 5,000 on PyPI
sigmatoolsSigmatools provides command-line utilities and…
copyleft · top 15,000 on PyPI