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.

Metadata

Release files for boreal-python 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boreal-python 1.4.0
File Size Uploaded
boreal_python-1.4.0.tar.gz 389.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for boreal-python 1.4.0
File
boreal_python-1.4.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
boreal_python-1.4.0-cp311-abi3-win32.whl CPython 3.11 abi3 Windows x86-32 Details
boreal_python-1.4.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
boreal_python-1.4.0-cp311-abi3-musllinux_1_2_i686.whl CPython 3.11 abi3 Linux musl 1.2+ x86-32 Details
boreal_python-1.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
boreal_python-1.4.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl CPython 3.11 abi3 Linux glibc 2.5+ x86-32 Details
boreal_python-1.4.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
boreal_python-1.4.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 17.6 MB

Release files / boreal_python-1.4.0.tar.gz

Download URL boreal_python-1.4.0.tar.gz
Size 389.8 kB
Tags Source
SHA-256 checksum
How to use checksums
375811d24b80246e444d1066c807b30394516b5d25cdcd067f7904182edadab3
BLAKE2b-256 checksum
How to use checksums
d325c15be8f6dfe7ee10697b20789bd40193cd30e3555058517f0155832c1d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-win_amd64.whl

Download URL boreal_python-1.4.0-cp311-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
edece7927a1ed46c8e79a76ea57da897824f57e4c69c57c2599cedc73af7684b
BLAKE2b-256 checksum
How to use checksums
d422c30ffeec71db04436e2eb28e9d2fe778ffc9f2444bde61d2776cb606c75f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-win32.whl

Download URL boreal_python-1.4.0-cp311-abi3-win32.whl
Size 1.8 MB
Tags CPython 3.11 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
855f14825ce66634b891c54029a763f6a35cd7b1d57ed3b952461279a1f713ce
BLAKE2b-256 checksum
How to use checksums
d168cdba846ac3f38d26473dee8035a2dd26353abd6dc7acc078a9732446d8a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL boreal_python-1.4.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 2.4 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
39532c8bb0f30ce2fd6ff89d21344082e28beefbcf56724f69692c9a5d736e6a
BLAKE2b-256 checksum
How to use checksums
a32811c51bb49e86e637fea671127dbc480e6aaf56bc19a7fa8af0a5538cd7d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-musllinux_1_2_i686.whl

Download URL boreal_python-1.4.0-cp311-abi3-musllinux_1_2_i686.whl
Size 2.5 MB
Tags CPython 3.11 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
d46fbe430ac1d4a8fa4a3009b8f63aea3f25f21a10d15d7d80d38a3da9fd488c
BLAKE2b-256 checksum
How to use checksums
946aa5f002b515657e597d927b2ec49a0a5f6e7792538be6c6723cddaea5e071
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL boreal_python-1.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4a860c7a4b1cc1bf498539c449d837673714e03a915cefd3d5ceff70cba77d4f
BLAKE2b-256 checksum
How to use checksums
db1a2926c5c4e37f26f68b2d8388788cefa7b1d8b9a5fff8d5b636411f9bf83b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl

Download URL boreal_python-1.4.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Size 2.4 MB
Tags CPython 3.11 Linux glibc 2.5+ x86-32 abi3
SHA-256 checksum
How to use checksums
ddd05b1537534fa4f2ff061ecd516b90a6c7393988bdc4d1d3c656673879cea6
BLAKE2b-256 checksum
How to use checksums
52e37a8a39b5bb1376746e7b17ec8472531370cddc195c5626ab382297d109df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL boreal_python-1.4.0-cp311-abi3-macosx_11_0_arm64.whl
Size 1.9 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4a6412718bd0fb30c922846409657e049cde58275bcb042ed228420d8bd41e6a
BLAKE2b-256 checksum
How to use checksums
2bba990c1c891bb241783646a1f46e0bb5312c01d5e3b11e38fd7a4e6ad6854f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / boreal_python-1.4.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL boreal_python-1.4.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
2bce387bb8183895f1b72e880666ecee3eb706e0631b52a8778fab3b62ca57fe
BLAKE2b-256 checksum
How to use checksums
61b7fca72e443fee7acc418b3267a0904b654705d93bcf087bee895277de6ae7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

1.4.0 This release

9 release files

1.3.0

9 release files

1.2.0

9 release files

1.1.0

15 release files

1.0.0

9 release files

0.1.0

9 release 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