Commit 891c74a4 by Victor M. Alvarez

Improve README file

parent d296f5d4
yara-python yara-python
=========== ===========
This is library for using `YARA <https://github.com/plusvic/yara>`_ from Python. With this library you can use `YARA <https://github.com/plusvic/yara>`_ from
You can use it to compile, save and load YARA rules, and to scan files or your Python programs. It covers all YARA's features, from compiling, saving
data strings. and loading rules to scanning files, strings and processes.
Here it goes a little example: Here it goes a little example:
.. code-block:: python .. code-block:: python
>>> import yara >>> import yara
>>> rule = yara.compile(source='rule foo {strings: $a = "lmn" condition: $a}') >>> rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}')
>>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') >>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz')
>>> for m in matches: >>> print(matches)
... print m.rule [foo]
... print m.strings >>> print(matches[0].rule)
...
foo foo
>>> print(matches[0].tags)
['bar']
>>> print(matches[0].strings)
[(10L, '$a', 'lmn')] [(10L, '$a', 'lmn')]
Installation Installation
------------ ------------
Before installing yara-python you'll need to install YARA, except if you plan The easiest way of installing YARA is by using ``pip``:
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 <http://yara.readthedocs.org/en/latest/gettingstarted.html#compiling-and-installing-yara>`_
and then:
.. code-block:: bash .. code-block:: bash
$ pip install yara-python $ 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/plusvic/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](http://github.com/plusvic/yara) separately before installing
``yara-python``.
Documentation Documentation
------------- -------------
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
from distutils.command.build import build from distutils.command.build import build
from setuptools import setup, Extension from setuptools import setup, Extension
from codecs import open
import distutils.errors import distutils.errors
import distutils.ccompiler import distutils.ccompiler
...@@ -186,9 +187,15 @@ class BuildCommand(build): ...@@ -186,9 +187,15 @@ class BuildCommand(build):
build.run(self) build.run(self)
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup( setup(
name='yara-python', name='yara-python',
version='3.4.0.00', version='3.4.0.0',
description='Python interface for YARA',
long_description=readme,
license='Apache 2.0',
author='Victor M. Alvarez', author='Victor M. Alvarez',
author_email='plusvic@gmail.com;vmalvarez@virustotal.com', author_email='plusvic@gmail.com;vmalvarez@virustotal.com',
url='https://github.com/plusvic/yara-python', url='https://github.com/plusvic/yara-python',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment