Questions tagged [yara]

YARA is a tool aimed at (but not limited to) helping malware researchers to identify and classify malware samples.

yara-python

With this library you can use 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:

>>> 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:

 $ pip install yara-python

But you can also get the source from GitHub and compile it yourself:

  $ 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:

$ sudo python setup.py install --dynamic-linking

For this option to work you must build and install YARA separately before installing yara-python.

Documentation

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

63 questions
0
votes
0 answers

how to create project hierarchical view in pyqt inside main window

I'm trying to implement a project structure viewer to view the structure of a specific programming language. and this project structure view should look like a the tree widget in PyQT , like project explorer in Eclipse. Example: if my code is : rule…
-1
votes
1 answer

Using YARA in windows machine WAZUH

Is there any Yara integration with WAZUH tutorial for windows I can refer to. Since running the yara.exe didnt have any effect on my windows machine.
jasmin
  • 3
  • 1
-1
votes
1 answer

DangerousPhp inside phpseclib when checking with YARA

When doing malware scanning inside the PHP app using YARA, yara -r ./php.yar -s /myapp DangerousPhp /myapp/phpseclib/Net/SSH2.php 0x1140c:$system: system 0x1083a:$: call_user_func 0x1671f:$: call_user_func 0x154:$: EXEC The malware finder tool…
mujuonly
  • 11,370
  • 5
  • 45
  • 75
1 2 3 4
5