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 yarawithimport borealand 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.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| boreal_python-1.3.0.tar.gz | 375.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| boreal_python-1.3.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| boreal_python-1.3.0-cp311-abi3-win32.whl | CPython 3.11 | abi3 | Windows x86-32 | Details |
| boreal_python-1.3.0-cp311-abi3-musllinux_1_2_x86_64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ x86-64 | Details |
| boreal_python-1.3.0-cp311-abi3-musllinux_1_2_i686.whl | CPython 3.11 | abi3 | Linux musl 1.2+ x86-32 | Details |
| boreal_python-1.3.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.3.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl | CPython 3.11 | abi3 | Linux glibc 2.5+ x86-32 | Details |
| boreal_python-1.3.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| boreal_python-1.3.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 17.5 MB
Release files / boreal_python-1.3.0.tar.gz
| Download URL | boreal_python-1.3.0.tar.gz |
|---|---|
| Size | 375.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97ea6a03c834fda30a50cb88bdf0058068838fb6bb0286f16706f4e06829a2ef
|
|
BLAKE2b-256 checksum How to use checksums |
68aaf6b0168bf8c744d6c30639462ea251a41b62e5ecf4335d3552a0da1e9fd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-win_amd64.whl
| Download URL | boreal_python-1.3.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 |
a277563913c99940886de910ed8521fa1ea78571de8e55f2de66fbbae12a4639
|
|
BLAKE2b-256 checksum How to use checksums |
dfddb77f80d9da77f888f07ec8413b153b32e3140c51b6bfa027cc0757fd725d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-win32.whl
| Download URL | boreal_python-1.3.0-cp311-abi3-win32.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
90f8c1e7441db3265b82004d449b3e12e264a2f455c69476ba6d6cfc901261ed
|
|
BLAKE2b-256 checksum How to use checksums |
7f53a6e12e3fb410634f015c6ff1f1027fd6d351542b7a0db9d9d0d775d101ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | boreal_python-1.3.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 |
ad2fbfd9454ef2c441c4c0fcf36d38f4d50ab6ab3054ce2bf8a0aa6ac831404f
|
|
BLAKE2b-256 checksum How to use checksums |
980e8539eb65904e073a50a40b7b1fd38d730d2a77999f0b8b2f7ade64cc928b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-musllinux_1_2_i686.whl
| Download URL | boreal_python-1.3.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 |
aff955de00e7ab71471a9849ea32f8b6f839ded372f697d9222b6835cc34570b
|
|
BLAKE2b-256 checksum How to use checksums |
1073f9f3e026d41c86a0c57b03bb31f808fc91e28a062037247886b8a9942048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | boreal_python-1.3.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 |
f19e95e669bd4c6065a3022e456ea7a091ebc4abb6c733ba01717bb888793961
|
|
BLAKE2b-256 checksum How to use checksums |
4cd9423554cafcb636a76e21dd9957c9bcf890d522e66a4ea4d55c5b3339f048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl
| Download URL | boreal_python-1.3.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 |
1f2c24639f6fd9fe923f621f79d64fa9f565334b6f03a13b725ff0ba7f533e58
|
|
BLAKE2b-256 checksum How to use checksums |
6498b9e4f06013a4670934b52d54169b5acc43496289e23d184c018de99d92e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | boreal_python-1.3.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 |
5f5ab0ed34ea156d4dff63aff37681d493925a26f9035d4b67ecf72b8c73feaa
|
|
BLAKE2b-256 checksum How to use checksums |
90f604875def2190769e30b3f6073d21b2f0fed5fd41608d61a70e5b09e13dee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / boreal_python-1.3.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | boreal_python-1.3.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 |
d28952e3239cea199268fe5e039d4758c2eddbf021a0c6566e2d415c4fd1f7ea
|
|
BLAKE2b-256 checksum How to use checksums |
88a49cb0eaed20d37b1b046bcf650ed4e7269a6ac94d7aff8506d7085279f02c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|