Skip to content

Merged code in the issue #157 does not work #174

Description

@rakovskij-stanislav

Summary: the Issue #157 was about printing all the warnings with "error_on_warning" enabled. But at the example below we can see that it does not work at the newest version of yara-python.

Yara ruleset:

rule bad_rule1
{
    meta:
        author = "Rakovskij Stanislav / disasm.me"
        date = "01.03.2021"
        description = "Rule that uses bad wilecards to raise yara warning"
    strings:
        $ = {00 [32] 00}
    condition:
        any of them
}

rule bad_rule2
{
    meta:
        author = "Rakovskij Stanislav / disasm.me"
        date = "01.03.2021"
        description = "Rule that uses bad wilecards to raise yara warning"
    strings:
        $ = {00 [32] 00}
    condition:
        any of them
}

Output:

/m/d/test_yara_speed> ./yara64.exe bad_rule.yar random_100Mb.bin
bad_rule.yar(8): warning in rule "bad_rule1": $ is slowing down scanning
bad_rule.yar(20): warning in rule "bad_rule2": $ is slowing down scanning
bad_rule1 random_100Mb.bin
bad_rule2 random_100Mb.bin
/m/d/test_yara_speed> python3 -c "import yara; yara.compile('bad_rule.yar', error_on_warning=True)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
yara.WarningError: bad_rule.yar(20): $ is slowing down scanning  // <- expected two warnings - on lines 8 and 20, got only the last one. 
/m/d/test_yara_speed [1]> ./yara64.exe -v
4.0.5
/m/d/test_yara_speed> python3 -m pip install yara-python
Requirement already satisfied: yara-python in /home/user/.local/lib/python3.8/site-packages (4.0.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions