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

YARA-1553: Add operator in #204

Merged
merged 10 commits into from
Feb 17, 2022
Merged

YARA-1553: Add operator in #204

merged 10 commits into from
Feb 17, 2022

Conversation

TadeasKucera
Copy link
Contributor

This PR allows Yaramod to parse and accept conditions similar to these:
all of ($a*) in (filesize-500..filesize) introduced to YARA here:
VirusTotal/yara@24a5ad1
#a in (filesize-500..filesize) == 2 introduced to YARA here:
VirusTotal/yara@e718016

* all of ($str1, $str2) in (filesize-1000, filesize)
* @endcode
*/
class OfInRangeExpression : public ForExpression
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I wonder about is whether we really need a completely new type of an expression or whether it wouldn't be better to have it as an optional part of OfExpression. Have you though about this option? What are the pros/cons compared to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good idea, the pros would be, that it requires less code to be written (which was already written) but also less code to be maintained. I do not really see any cons, I can try to implement it in next commit so we can decide when we see the code.

*
* @return Builder.
*/
YaraExpressionBuilder ofInRange(const YaraExpressionBuilder& quantifier, const YaraExpressionBuilder& set, const YaraExpressionBuilder& range)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it necessarily need to remain as ofInRange instead of making overload for ofExpr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that you mean of and not ofExpr and I will try to make it its overload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it, it is much better I think. Thank you for the idea! 👍

@metthal
Copy link
Member

metthal commented Feb 17, 2022

Could you please resolve the conflict? You can merge it afterwards.

@TadeasKucera TadeasKucera merged commit 23b6b7d into master Feb 17, 2022
@TadeasKucera TadeasKucera deleted the yara42_in_operator branch February 17, 2022 16:34
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

Successfully merging this pull request may close these issues.

None yet

2 participants