Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yara-python
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
yara-python
Commits
891c74a4
Commit
891c74a4
authored
9 years ago
by
Victor M. Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve README file
parent
d296f5d4
master
…
v4.4.0
v4.3.1
v4.3.0
v4.2.3
v4.2.0
v4.1.3
v4.1.2
v4.1.0
v4.0.5
v4.0.4
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.11.0
v3.10.0
v3.9.0
v3.8.1
v3.8.0
v3.7.0
v3.6.3
v3.6.2
v3.6.1
v3.6.0
v3.5.0
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
14 deletions
+42
-14
README.rst
README.rst
+34
-13
setup.py
setup.py
+8
-1
No files found.
README.rst
View file @
891c74a4
yara-python
===========
This is library for using `YARA <https://github.com/plusvic/yara>`_ from Python.
You can use it to compile, save and load YARA rules, and to scan files or
data string
s.
With this library you can use `YARA <https://github.com/plusvic/yara>`_ from
your Python programs. It covers all YARA's features, from compiling, saving
and loading rules to scanning files, strings and processe
s.
Here it goes a little example:
.. code-block:: python
>>> 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')
>>> for m in matches:
... print m.rule
... print m.strings
...
>>> print(matches)
[foo]
>>> print(matches[0].rule)
foo
>>> print(matches[0].tags)
['bar']
>>> print(matches[0].strings)
[(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 <http://yara.readthedocs.org/en/latest/gettingstarted.html#compiling-and-installing-yara>`_
and then:
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/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
-------------
...
...
This diff is collapsed.
Click to expand it.
setup.py
View file @
891c74a4
...
...
@@ -16,6 +16,7 @@
from
distutils.command.build
import
build
from
setuptools
import
setup
,
Extension
from
codecs
import
open
import
distutils.errors
import
distutils.ccompiler
...
...
@@ -186,9 +187,15 @@ class BuildCommand(build):
build
.
run
(
self
)
with
open
(
'README.rst'
,
'r'
,
'utf-8'
)
as
f
:
readme
=
f
.
read
()
setup
(
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_email
=
'plusvic@gmail.com;vmalvarez@virustotal.com'
,
url
=
'https://github.com/plusvic/yara-python'
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment