Skip to main content

Python bindings for the boreal YARA scanner

The library allows using the boreal library to scan files and processes using YARA rules.

import boreal

scanner = boreal.compile(source="""
rule example {
    meta:
        description = "This is an YARA rule example"
        date = "2022-11-11"
    strings:
        $s1 = { 78 6d 6c 68 74 74 70 2e 73 65 6e 64 28 29 }
        $s2 = "tmp.dat" fullword wide
    condition:
        any of them
}
""");

results = scanner.match(data=b"<\0t\0m\0p\0.\0d\0a\0t\0>\0")
assert [rule.name for rule in results] == ["example"]

Description

This library can serve as a drop-in replacement of the YARA python library, while also providing improvements and saner default behavior.

  • Literal replacement to the yara library: replace import yara with import boreal and everything will work.

  • Saner default behavior compared to the yara library: fast scanning enabled by default, proper hash implementations of python objects, use of the bytes type in some places to avoid losing information, etc.

  • 100% compatibility with the yara library guaranteed if needed through a yara compatibility mode.

This library is fully compatible with free-threaded python.

Yara compatibility

This library guarantees 100% compatibility with the YARA library: the whole API is entirely tested against both libraries to guarantee perfect compatibility.

However, a few differences are introduced in the default behavior of this library to ensure that this default behavior fixes some issues in the behavior of the yara library. Those changes are minimal, but can introduce breakage when replacing the yara library.

Therefore, you can either:

  • Use the compatibility mode to ensure 100% compatibility with the yara library:
import boreal

boreal.set_config(yara_compatibility=True)

This guarantees that the yara library can be replaced and nothing will break. However, it also keeps alive a few issues in this library. It is therefore only recommended to enable this mode when replacing the yara library and wanting to ensure that nothing can break.

  • Use boreal as is. This fixes a few issues while still providing almost entirely the same API.

This is recommended if using this library from scratch, or when all the uses of the yara library can be easily checked to ensure nothing will break.

For a description of all the differences that exists when the compatibility mode is not enabled, you can consult this documentation.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boreal_python-1.2.0.tar.gz (360.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

boreal_python-1.2.0-cp311-abi3-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.11+Windows x86-64

boreal_python-1.2.0-cp311-abi3-win32.whl (1.8 MB view details)

Uploaded CPython 3.11+Windows x86

boreal_python-1.2.0-cp311-abi3-musllinux_1_2_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

boreal_python-1.2.0-cp311-abi3-musllinux_1_2_i686.whl (2.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

boreal_python-1.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

boreal_python-1.2.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.5+ i686

boreal_python-1.2.0-cp311-abi3-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

boreal_python-1.2.0-cp311-abi3-macosx_10_12_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file boreal_python-1.2.0.tar.gz.

File metadata

  • Download URL: boreal_python-1.2.0.tar.gz
  • Upload date:
  • Size: 360.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for boreal_python-1.2.0.tar.gz
Algorithm Hash digest
SHA256 deedf4c9daa4e26aaf6508a8d3ef4c2bd082d0bea9b886e15c3e7e8a8237d2f3
MD5 f55ca762df24130722c538ca2bbc8a78
BLAKE2b-256 53e86258015599cf77942061a03e5ea8905c220fd94054bf2418641b2e27ccfb

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ac9da1d47b6e1f0b38398dd028ac1a6712105a851bde6c509abe2717b86b3e3c
MD5 7f2fd8468596a99aa3b85ddae7d3ade9
BLAKE2b-256 03ee028b4ea51e0f0e4194583f24be83247ebf100342b4c68079ad38ee0a78f5

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-win32.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 fb2fde0a444e19d87c59563d970a04382cbeb9486f93a8581939453973dbf0c6
MD5 bfc3156e07520741c078064e9466fd2d
BLAKE2b-256 6390cff1fdcd074b1733b14111bdb99b67a956b84f990e1df96508ccb40a0543

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a2778ed032acc92a0a1b7a7e30354a7a502bbbee82f9b63b78ef363077e44c63
MD5 75e1f065f82d7f79e2c58012c961c390
BLAKE2b-256 91ca6a75397b6e17d8ee7f87e9a8d104d4c4bc4aef7aa192c5c32291717d5037

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 354d856a3ada6ab759dfb031c6a1803da464ed3a1ac5cae4a9fbe09736c2d2d1
MD5 de5dea4b0f46d99c8405fbc76e2adba3
BLAKE2b-256 c9cb2903c598593e9424581c272bbfbbb025456b0b28c57ccaba4595f257c649

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58cd011f36181ded5a402c739078db9c6e57cd2676dc81f8cc7b6e11019754d6
MD5 e296095a0ec3a73161d800bc6aab3eef
BLAKE2b-256 f2229f283bf811e882bc72e346565efe20375d2a44b78cd92ca0c0ae38890ee6

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 b9178978d022c941e601f7c08a6f4fa7a5e8a6a7c921078b4864badffcdf875e
MD5 26d0b86f35faa2d429011cf1c3f8aa5b
BLAKE2b-256 487b192f94d9db5a6a11f70588f90315db280d47f0a9b2c9b47c3c1062ee30f4

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd6028961d0587578ad411b2004b42ca01907cbba5d2fd2f73740fa51fac671b
MD5 fe6e4e77ac2ce186390e776ee7b46521
BLAKE2b-256 e699dcefe8b48cb025dc946834af47477fad6f485f3766e902d7222f0d158184

See more details on using hashes here.

File details

Details for the file boreal_python-1.2.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for boreal_python-1.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d6b70b58d4f3cf1909351d53572ed3c7a3a320e410e55a8e1b8f1e497f97a31
MD5 d3044f66fe226eb8efdb609b0e71d622
BLAKE2b-256 2e3c62775642618b008a00931546fe500595366591e90ab723ebbd2fac858c2d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.0 This release

9 files

1.1.0

15 files

1.0.0

9 files

0.1.0

9 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page