.. image:: https://travis-ci.org/VirusTotal/yara-python.svg
:target: https://travis-ci.org/VirusTotal/yara-python
.. image:: https://ci.appveyor.com/api/projects/status/gidnb9ulj3rje5s2?svg=true
:target: https://ci.appveyor.com/project/plusvic/yara-python
yara-python
===========
With this library you can use `YARA <https://github.com/VirusTotal/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:
.. code-block:: python
>>> 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``:
.. code-block:: bash
$ pip install yara-python
But you can also get the source from GitHub and compile it yourself:
.. code-block:: bash
$ 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:
.. code-block:: bash
$ sudo python setup.py install --dynamic-linking
For this option to work you must build and install
`YARA <https://github.com/VirusTotal/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.
Raw data
{
"_id": null,
"home_page": "https://github.com/VirusTotal/yara-python",
"name": "yara-python-and",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Victor M. Alvarez",
"author_email": "dmitry.kotoww@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7e/d0/01f4bbcedb2bb1fc05bead12815c9260d167ecd43b25ba6853a8f900182d/yara-python-and-3.11.0.tar.gz",
"platform": null,
"description": ".. image:: https://travis-ci.org/VirusTotal/yara-python.svg\n :target: https://travis-ci.org/VirusTotal/yara-python\n.. image:: https://ci.appveyor.com/api/projects/status/gidnb9ulj3rje5s2?svg=true\n :target: https://ci.appveyor.com/project/plusvic/yara-python\n\nyara-python\n===========\n\nWith this library you can use `YARA <https://github.com/VirusTotal/yara>`_ from\nyour Python programs. It covers all YARA's features, from compiling, saving\nand loading rules to scanning files, strings and processes.\n\nHere it goes a little example:\n\n.. code-block:: python\n\n >>> import yara\n >>> rule = yara.compile(source='rule foo: bar {strings: $a = \"lmn\" condition: $a}')\n >>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz')\n >>> print(matches)\n [foo]\n >>> print(matches[0].rule)\n foo\n >>> print(matches[0].tags)\n ['bar']\n >>> print(matches[0].strings)\n [(10L, '$a', 'lmn')]\n\n\nInstallation\n------------\n\nThe easiest way of installing YARA is by using ``pip``:\n\n.. code-block:: bash\n\n $ pip install yara-python\n\nBut you can also get the source from GitHub and compile it yourself:\n\n.. code-block:: bash\n\n $ git clone --recursive https://github.com/VirusTotal/yara-python\n $ cd yara-python\n $ python setup.py build\n $ sudo python setup.py install\n\nNotice the ``--recursive`` option used with ``git``. This is important because\nwe need to download the ``yara`` subproject containing the source code for\n``libyara`` (the core YARA library). It's also important to note that the two\nmethods above link ``libyara`` statically into yara-python. If you want to link\ndynamically against a shared ``libyara`` library use:\n\n.. code-block:: bash\n\n $ sudo python setup.py install --dynamic-linking\n\nFor this option to work you must build and install\n`YARA <https://github.com/VirusTotal/yara>`_ separately before installing\n``yara-python``.\n\n\nDocumentation\n-------------\n\nFind more information about how to use yara-python at\nhttps://yara.readthedocs.org/en/latest/yarapython.html.\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Python interface for YARA",
"version": "3.11.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ce4b04c22c36940b000dd2f660ae68e1",
"sha256": "368a10ce7b4c2837ff6ca00ee67193aa2436380584d898277e545cd1c89535f3"
},
"downloads": -1,
"filename": "yara-python-and-3.11.0.tar.gz",
"has_sig": false,
"md5_digest": "ce4b04c22c36940b000dd2f660ae68e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 379014,
"upload_time": "2022-12-30T21:24:04",
"upload_time_iso_8601": "2022-12-30T21:24:04.371454Z",
"url": "https://files.pythonhosted.org/packages/7e/d0/01f4bbcedb2bb1fc05bead12815c9260d167ecd43b25ba6853a8f900182d/yara-python-and-3.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-30 21:24:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "VirusTotal",
"github_project": "yara-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"appveyor": true,
"lcname": "yara-python-and"
}