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

Support for new operators introduced in 4.1.0 #117

Open
jgrunzweig opened this issue May 18, 2021 · 3 comments
Open

Support for new operators introduced in 4.1.0 #117

jgrunzweig opened this issue May 18, 2021 · 3 comments

Comments

@jgrunzweig
Copy link

With the release of 4.1.0, a number of new operators were introduced (https://github.com/VirusTotal/yara/releases/tag/v4.1.0). At present, these operators do not appear to be supported in plyara:

> cat test.yar
import "vt"

rule test
{
    condition: 
        file_name contains "something" or 
        file_name icontains "something else"
}
>>> import plyara
>>> from plyara.utils import rebuild_yara_rule
>>> p = plyara.Plyara()
>>> parsed_rule = p.parse_string(open('test.yar', 'r').read())
>>> print(rebuild_yara_rule(parsed_rule[0]))
import "vt"

rule test
{
	condition:
		file_name contains "something" or file_nameicontains"something else"
}

I humbly request support for the icontains, endswith, iendswith, startswith, and istartswith operators that were introduced in 4.1.0.

My understanding is that it would simply required adding them to the keywords in https://github.com/plyara/plyara/blob/master/plyara/core.py#L79, but on the off chance more is required, I figured I'd raise an issue.

Appreciate any help you can provide.

Thanks

@utkonos
Copy link
Member

utkonos commented May 20, 2021

@jgrunzweig Thanks for the heads up! I'll get this done as soon as possible. If you have a PR for this, I can take a look. There are a couple more places than that one location where these operators will need to be implemented, and then a test case added. But it doesn't look too complicated.

@robert-phe
Copy link

I've took the liberty of creating a PR for this issue. PR #121

@ruppde
Copy link
Contributor

ruppde commented Mar 4, 2024

@utkonos ćould you please have a look at this PR? I just ran into the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants