用于 YARA 的 Python 接口
使用此库,您可以使用 YARA
您的 Python 程序。它涵盖了 YARA 的所有功能,从编译、保存
并将加载规则应用于扫描文件、字符串和进程。
这里有一个小例子:
.. code-block:: Python
import yara rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}') matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') print(matches) print(matches[0].rule) foo print(matches[0].tags) print(matches[0].strings) print(matches[0].strings[0].identifier) $a print(matches[0].strings[0].instances) print(matches[0].strings[0].instances[0].offset) print(matches[0].strings[0].instances[0].matched_length) 安装
安装 YARA 的最简单方法是使用 "pip": .. code-block:: bash $ pip install yara-Python
但是,您也可以从 GitHub 获取源代码并自行编译:
要使此选项正常工作,您必须在安装 yara-Python 之前单独构建和安装 YARA _。
[foo] ['bar'] [$a] [lmn] 10 3
暂无开放 Issues,或尚未同步最近议题。