Skip to main content

Python bindings to the boreal YARA scanner

Project description

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.

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.

Project details


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-0.1.0.tar.gz (345.0 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-0.1.0-cp311-abi3-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+Windows x86

boreal_python-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl (2.3 MB view details)

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

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

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

boreal_python-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

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

boreal_python-0.1.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl (2.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.5+ i686

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

boreal_python-0.1.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-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for boreal_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72b02cc37b3ea80d837537fe1dbba80725dc7f868c8d77bb10df4174dc0452f9
MD5 5ea6fcbcd34803f592adcebebe1ebeb0
BLAKE2b-256 9c217592a1b80f7a821f546685a93dfe2d067373829dc41733e09d04f2a3c4b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7f506f21d394f1a0b3beccc34cdbee3ff4eddeaefae3ec3903be02938b5aa31d
MD5 f13e0bede27eda672aa2f53dff200a30
BLAKE2b-256 87e7b63580c6e0928db115298bf2ccc06f2bcda68cfdd13e11b6654bef0e73fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 6cde0f0650239e1b0b574c1535035f8e1fef7b2ac1298cf2ce5c6ae016c11cd8
MD5 f17e65a81dc07a230406b1345ff3171c
BLAKE2b-256 e863f8b2076873d74cb4eefcfb47513e53a79f18c2af81748203dd82cbdfdab8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ea57555fd467562d762beb45f699e93835737af074b375d908438f081c4bbae2
MD5 59d40a24114119b6324c7a7ea0345465
BLAKE2b-256 f301d1aba8042c9a278e1eb4b2b81cfa4e53d8bc98a1a89638694fcd435d7ccf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 821ec357a5698164e5717e2adced43d847249e0122d72077da37cd65595a75f2
MD5 8fe4ce5412d9de3a1fc833d1cfac8d80
BLAKE2b-256 c4ffcdf823c5bb8fe0d4b2555b960f7b3734e82c51719a3009d2a94f19c16115

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cbfc03d825b11e8ad3254cb69a8a07591e7fe7f79f402835d8555b9326c8cecf
MD5 4b3db8d2bea7e8a71880421e265e0066
BLAKE2b-256 0558d267d5bc3a74e50428d0dcb0a351be459d511f8cacbaab9b8d586ddd33b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 49c66ec18d800d0bc9d71c750eb8ce02ba0406cd9e7ae252fabc9236ec472c98
MD5 a1e86e47328a9a10c95f1164234627bc
BLAKE2b-256 bc2e6b0e56c9eb1139fbd5798c3c3c99dbdf38290ab581b586ea8a718af0634a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8deb0b5cab4ad4f6630a7b064f6fc971a2c763f8c6bd0258619bc4f284b8ce8d
MD5 f34e00eaafa29331d88219d83b145bca
BLAKE2b-256 ba8ec0713bc6fd4cfedc0b329edc2d0bdcdfd48257c9c12515c8ea2f7ef4e12d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for boreal_python-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c9587676aadc66ec57e6c294908cfe74a7c86567b9efbfc51a739a2a87558bf8
MD5 64e840014b75b588e326067c43ef4717
BLAKE2b-256 ac24c4bf4fbd9aeeb72ee578e0b226e87d52cc2997541c6cedd457ff9204841a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page