yara-python

This is library for using YARA from Python. You can use it to compile, save and load YARA rules, and to scan files or data strings.

Here it goes a little example:


>>> import yara
>>> rule = yara.compile(source='rule foo {strings: $a = "lmn" condition: $a}')
>>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz')
>>> for m in matches:
...     print m.rule
...     print m.strings
...
foo
[(10L, '$a', 'lmn')]

Installation

Before installing yara-python you'll need to install YARA, except if you plan to link YARA statically into yara-python. If you don't have a specific reason for using the static linking method, just install YARA as described in the documentation and then:


$ pip install yara-python

Documentation

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