--- id: yara-python version: "4.5.4" license: Apache 2.0 license_treatment: permissive maintenance: active --- # yara-python — Python interface for YARA License: permissive · Maintenance: active · Downloads: 1.8M/mo ## What it is and what it does yara-python is a Python binding to YARA, the pattern-matching engine developed by VirusTotal. It allows you to write rules that describe patterns in data—typically used for malware detection, log analysis, and security scanning—and then compile and execute those rules against files, strings, or process memory from Python code. The library exposes YARA's full feature set: you define rules using YARA's domain-specific syntax (strings, conditions, tags), compile them into rule objects, and call match() to scan data. Results include the matched rule name, tags, and detailed information about each string match, including offset and matched length. No runtime dependencies are required beyond the compiled C extension. Use it for: - Malware detection and threat hunting by scanning files or memory against known malicious patterns - Log analysis and security event correlation by matching structured or unstructured text against detection rules - Content filtering and data classification by scanning strings or file contents against custom rule sets - Incident response automation by integrating YARA scanning into Python-based security workflows ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. yara-python provides a Python interface to YARA, enabling you to compile pattern-matching rules, scan files and strings for matches, and extract detailed information about what was matched. Yes. yara-python is actively maintained, has no known vulnerabilities, carries a permissive license, and offers pre-built wheels for common platforms. Install friction is moderate but manageable. It is the standard way to use YARA from Python and is well-suited for security, malware analysis, and pattern-matching workflows. ## Install pip install yara-python uv add yara-python poetry add yara-python ## Installing yara-python Before you install: Medium install friction due to compiled C extension bindings; pre-built wheels are available for common platforms (macOS, Linux, Windows across multiple architectures), but dynamic linking requires building YARA separately. Last release was 444 days ago; repository is active with recent commits. License in practice: Apache 2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects. Quickstart: pip install yara-python import yara rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}') matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') print(matches[0].rule, matches[0].strings) Pre-built wheels are available for common platforms; if using dynamic linking, YARA must be built and installed separately before installing yara-python. Verify before relying: - Whether Python version support is documented beyond the unspecified classifier - Performance characteristics for large-scale scanning or complex rule sets ## Package facts - License: Apache 2.0 (permissive) - Python support: unspecified - Install friction: medium - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pattern matching malware detection, yara rule compilation python, string scanning and matching, file content pattern rules, regex-like rule engine, malware-detection, pattern-matching, security-scanning [View on SkillFed](https://skillfed.io/packages/yara-python) · [View on PyPI](https://pypi.org/project/yara-python/)