Python interface for YARA
Project description
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)
[(10L, '$a', 'lmn')]
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:
$ sudo python setup.py install --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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for yara-python-3.9.0.macosx-10.13-intel.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdca98be31d41c3f0c36461d5df322543011d99cdf04f949d65307b80167be72 |
|
MD5 | 2dbec0a6ea7ba2fe7231dffe9188a5cd |
|
BLAKE2b-256 | 497c8a3a7c2be23fd9f22a226bbfd3c66ef8cc9bda4b52c7adbfb8b25a7ce056 |
Hashes for yara_python-3.9.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7936c10c8802fc279802dcdda8270d3fda5c3d3c8fbe6bb02010934ed30b8929 |
|
MD5 | 36fa06e5752fa070f218003ec51ceb06 |
|
BLAKE2b-256 | e9487815d4ec5c5742648350d965b1b4b15afd2bb76c20ff320d7e4c98868829 |
Hashes for yara_python-3.9.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2031ac6ac01754dbc82b5a47b69cb91302c6b66ea9d9f2f27cc2eaf771e19c14 |
|
MD5 | 24e000d63d993e85e945042925110578 |
|
BLAKE2b-256 | c5f93ae95300dcabe1c7b065d64cc01d2d3d6efd25d4e085b5494eb6790e61e6 |
Hashes for yara_python-3.9.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 468a9770e6b578f0562a540b6cb5cafd4122bea989404b53440d4eb065d54eda |
|
MD5 | b80c2cf2a2860e53626fbbfd99230b68 |
|
BLAKE2b-256 | c0f46d2bd500d99cf74ceea4b23ce8dcb8b598619b6bb44ed263554b2890546e |
Hashes for yara_python-3.9.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 755406cb5fa944d5e0dd097a4b25c3fcdd5ba244f0367114afed1ba30ccd2a12 |
|
MD5 | e61a1b31e34c24a83fa8a91f3f45b409 |
|
BLAKE2b-256 | 261ca989e9b89423c446ba7f1e5e3409c9bc35ff09997d0e0a21b46f3b43d2e2 |
Hashes for yara_python-3.9.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 228a96efc86c766d968c984bd80f5ebb0bb775afb9045c10fb632e2b7275c9c1 |
|
MD5 | 2b00b23586224fd23e47ab3c48b88108 |
|
BLAKE2b-256 | 8d417838108d408cdc1b849e98ffa53c254b1495d5d6a81bd9ba2bcf44f80231 |
Hashes for yara_python-3.9.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 752d12a795159b806cd74ab7f0fd7c3a14cb6e17c9e4a818511dc7a4932b15df |
|
MD5 | ec78a8a3002ef18308d7c212c40fdcf9 |
|
BLAKE2b-256 | 437a1e4ab6576f19313a4d72df36e2a37a01a33c98f3b0620294ed58a57aa533 |
Hashes for yara_python-3.9.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d002170b2f2c56ff75c846ad1e6765f59d4569e81494c76f15243197e4a974c |
|
MD5 | 94a2727eb8a327680a37915b1f30c439 |
|
BLAKE2b-256 | 65e17ac693860c3d4e33e9d5f234b46a3e74331a829bd1f0f8049d5d23d72460 |
Hashes for yara_python-3.9.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd00cfb7bcbe862b0793f91b5393bad3fb37da78883af19924059367ba80f51 |
|
MD5 | 4f617fdd8d29c27203ae83f1cb24eb2a |
|
BLAKE2b-256 | 65bb0158c6afc50f658fac2a964ff3b5d963c702d17e3e1645f04eb408d95cf1 |
Hashes for yara_python-3.9.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16be7c7623685b4b2813db33a39553d6faef236ddffa0758c08e2071ab11ed84 |
|
MD5 | f28eaff5f4252bfdce729079f4b6ee20 |
|
BLAKE2b-256 | 5601379e46e352654008c4a94bb176001b20334c7d5296b43abcfca87d32f9ba |
Hashes for yara_python-3.9.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c8d39ee5938744dbd8e0153ec6d466f8a4ed11b8ac7b1068f498c26a292b65 |
|
MD5 | 1e6e5ef9e5c4f5d128a74a6245a30f1b |
|
BLAKE2b-256 | 01a4d7fd7260def5fc37c9d7307ac168ddcdf4039e2360bc1f862bae5e28bfd2 |