Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another problem with minuses/dashes parsing in condition terms #115

Open
rakovskij-stanislav opened this issue Mar 9, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@rakovskij-stanislav
Copy link

rule bad_parsed_subtraction{
    meta:
        author = "Rakovskij Stanislav / disasm.me"
        date = "09.03.2021"
        description = "test rule in which we have bad parsing of minus sign between two variables"
    strings:
        $a = "Test"
        $b = "Test 2"
    condition:
         @a-@b<128
}


rule good_parsed_addiction{
    meta:
        author = "Rakovskij Stanislav / disasm.me"
        date = "09.03.2021"
        description = "test rule in which we have bad parsing of minus sign between two variables"
    strings:
        $a = "Test"
        $b = "Test 2"
    condition:
         @a+@b<128
}
>>> parser = plyara.Plyara(); rules = parser.parse_string(open("bad_parse.yar").read())
>>> rules[0]["condition_terms"]
['@a-', '@b', '<', '128']
>>> rules[1]["condition_terms"]
['@a', '+', '@b', '<', '128']
@rakovskij-stanislav
Copy link
Author

And totally "wow" case with extra empty line!

rule rule_extra_empty_line
{
    meta:
        author = "Rakovskij Stanislav / disasm.me"
        date = "09.03.2021"
        description = "actually magic"
    strings:
        $a = "hello"
        $b = "world"
    condition:
        @b-@a<128
}
>>> rules[0]["condition_terms"]
['@b', '-', '', '@a', '<', '128']

@utkonos utkonos self-assigned this Mar 29, 2021
@utkonos utkonos added the bug Something isn't working label Mar 29, 2021
@utkonos
Copy link
Member

utkonos commented Mar 29, 2021

Thanks for the report. Will get this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants