Skip to main content

Python interface for YARA

Project description

https://ci.appveyor.com/api/projects/status/gidnb9ulj3rje5s2?svg=true

yara-python

With this library you can use YARA from your Python programs. It covers all YARA’s features, from compiling, saving and loading rules to scanning files, strings and processes.

Here it goes a little example:

>>> import yara
>>> rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}')
>>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz')
>>> print(matches)
[foo]
>>> print(matches[0].rule)
foo
>>> print(matches[0].tags)
['bar']
>>> print(matches[0].strings)
[$a]
>>> print(matches[0].strings[0].identifier)
$a
>>> print(matches[0].strings[0].instances)
[lmn]
>>> print(matches[0].strings[0].instances[0].offset)
10
>>> print(matches[0].strings[0].instances[0].matched_length)
3

Installation

The easiest way of installing YARA is by using pip:

$ pip install yara-python

But you can also get the source from GitHub and compile it yourself:

$ git clone --recursive https://github.com/VirusTotal/yara-python
$ cd yara-python
$ python setup.py build
$ sudo python setup.py install

Notice the --recursive option used with git. This is important because we need to download the yara subproject containing the source code for libyara (the core YARA library). It’s also important to note that the two methods above link libyara statically into yara-python. If you want to link dynamically against a shared libyara library use:

$ python setup.py build --dynamic-linking

For this option to work you must build and install YARA separately before installing yara-python.

Documentation

Find more information about how to use yara-python at https://yara.readthedocs.org/en/latest/yarapython.html.

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

yara-python-4.3.1.tar.gz (538.5 kB view details)

Uploaded Source

Built Distributions

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

yara_python-4.3.1-cp311-cp311-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.11Windows x86-64

yara_python-4.3.1-cp311-cp311-win32.whl (801.9 kB view details)

Uploaded CPython 3.11Windows x86

yara_python-4.3.1-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

yara_python-4.3.1-cp310-cp310-win32.whl (810.9 kB view details)

Uploaded CPython 3.10Windows x86

yara_python-4.3.1-cp39-cp39-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9Windows x86-64

yara_python-4.3.1-cp39-cp39-win32.whl (810.8 kB view details)

Uploaded CPython 3.9Windows x86

yara_python-4.3.1-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8Windows x86-64

yara_python-4.3.1-cp38-cp38-win32.whl (810.7 kB view details)

Uploaded CPython 3.8Windows x86

yara_python-4.3.1-cp37-cp37m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7mWindows x86-64

yara_python-4.3.1-cp37-cp37m-win32.whl (810.5 kB view details)

Uploaded CPython 3.7mWindows x86

File details

Details for the file yara-python-4.3.1.tar.gz.

File metadata

  • Download URL: yara-python-4.3.1.tar.gz
  • Upload date:
  • Size: 538.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara-python-4.3.1.tar.gz
Algorithm Hash digest
SHA256 7af4354ee0f1561f51fd01771a121d8d385b93bbc6138a25a38ce68aa6801c2c
MD5 ea531e711f4f34cda69fc23c74e6e43c
BLAKE2b-256 5f3460a293c7ae05731c2e6366e132a9fe4c02ae84c4f57714a2f5e8651a8491

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for yara_python-4.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 51f1bdbcdbcfa29a7a2cf7e7e5d6a7d8dbd00568e4ab6103adceda5a499895a6
MD5 bec8f610d67181563a8974c784541bdf
BLAKE2b-256 cef52671a90d4b56d5143001e47447784233a06bf9a9ada86d674587d039b58f

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 801.9 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 c8663f75f0c5f82e0f6053c9ddbddd97f956787bffb7f64cac1e40e0a21db89c
MD5 b96215301e10f1d622f994b6050fdb5b
BLAKE2b-256 1d905b8cf67512b9ee874a80aeecefd8e42935b7274fcd89b7d370ffb6080334

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for yara_python-4.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ec05d0b7cc46728119d450875382d5386305510b8cfb14bad3627060c9e6f199
MD5 b4906db7c3d80d38eb0dc926bf96cc35
BLAKE2b-256 f6b7e2889ed089c2e4d7f170391def1c34bc212a3f32ae18a671fcc9a0d93712

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 810.9 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 834d8fe2cdb5cf61d5e505d32c504b62891df5ce5af9f04dbd8c7575c1dbef30
MD5 7cbb0dff92698813640f8e205e45f1cf
BLAKE2b-256 fd7c2d9ff75405990fb49620d662eee46998717ef1332415d1f58256ad2e5335

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f0b7b2ea840638415a075a25860dbcb6466d83000a8367196188a6367b01af71
MD5 5cd624847a14ae1b28278474e1ad0e80
BLAKE2b-256 a1de9023fbdd4417ce4061d5cd5cf7627a100138101c02af3880f542cca64f48

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 810.8 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 c032ad4ec6698a4f485b3d9721e6223028953bb61362482bdd7eabb147271e80
MD5 dad88ef8b41da33b17532ac1d3968337
BLAKE2b-256 d63434218bd734e210cc08229e4f8978ef112da0d7edb76a6d60f239db365e3f

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 950377dd53d17870f66406f0db9ed9f6b04ac7e61c7f6fd5429459e2a00fd874
MD5 84d8b4ecd75dd207abf7216ea9906398
BLAKE2b-256 87fae703759bacdec072ee6286fa015fc1f652fb7cf38c5cb4fb22bf5a237f4c

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp38-cp38-win32.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 810.7 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 fd70fe0ba522d4ecd73cbf45e528872844e61e2febe8f66e8a94c2674751b831
MD5 8c9f82a0c1935a76713eb6f7ff15567f
BLAKE2b-256 af3a341160a3f5fb74eac61ed58533b9e18601e5c1b66056e9733ffc0396ffe2

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 fbf8281a6eb538b5c219a9c54c65a910806e7adf28a7d878f2cff551cbbd43ea
MD5 bced6498fa030f487c06275eb3bccfac
BLAKE2b-256 a82038839ce749558490374b9967023fa4556510f75b861b03e4d23121b2b21f

See more details on using hashes here.

File details

Details for the file yara_python-4.3.1-cp37-cp37m-win32.whl.

File metadata

  • Download URL: yara_python-4.3.1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 810.5 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for yara_python-4.3.1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8847bb5e74d2b33cf48f372bed02805876ab2e414aa7fd50c16a7c6150316601
MD5 14dfb8ce8441429dfd82abe358a8f716
BLAKE2b-256 10f164898cd8d346995b60eb59f4a8ad5b756fd72fa80dc0779b5ee03807db77

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