skillfed

yara-x

Python bindings for YARA-X

yara-x v1.19.0 447.0K downloads/30d#6,609 on PyPI1,249
Permissive license Active released

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-x

uv

uv add yara-x

poetry

poetry add yara-x

Installing 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

License :: OSI Approved :: BSD LicenseProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust

Tags

yara pattern matchingmalware detection pythonbinary scanning rulesforensic analysis toolyara-x bindingsthreat hunting patternsrule-based scanning
malware-detectionpattern-matchingforensics

More Security packages