Skip to content

Commit

Permalink
chore: add simple README file for YARA-X Python.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Apr 29, 2024
1 parent fb51ce2 commit ae3d906
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions py/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This Python package allows using [YARA-X](https://virustotal.github.com/yara-x)
from your Python programs.

```python
import yara_x

rules = yara_x.compile('''
rule test {
strings:
$a = "foobar"
condition:
$a
}''')

results = rules.scan(b"foobar")

assert results.matching_rules[0].identifier == "test"
assert results.matching_rules[0].patterns[0].identifier == "$a"
assert results.matching_rules[0].patterns[0].matches[0].offset == 0
assert results.matching_rules[0].patterns[0].matches[0].length == 6
```

0 comments on commit ae3d906

Please sign in to comment.