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
Feb 23, 2016
by
Victor M. Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve README file
parent
d296f5d4
Show 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
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 string
s.
and loading rules to scanning files, strings and processe
s.
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
-------------
-------------
...
...
setup.py
View file @
891c74a4
...
@@ -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'
,
...
...
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