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

Rule location should contain the whole rule #128

Open
MatejKastak opened this issue Aug 17, 2020 · 0 comments
Open

Rule location should contain the whole rule #128

MatejKastak opened this issue Aug 17, 2020 · 0 comments

Comments

@MatejKastak
Copy link
Member

In order to keep consistency, rule location should encapsulate the whole rule (the string case is similar).

  • rule.location.begin should be first character of the rule (can be even modifiers)
  • rule.location.end should be the last character of the rule }
  • rule.token_name can be exposed to provide access to the (probably) commonly accessed token the rule name
    def test_rule_location(self):
        ymod = yaramod.Yaramod()
        yara_file = ymod.parse_string(r'''rule rule1 : Tag1 {
    strings:
        $1 = "Hello World!"
    condition:
        false
}
''')
        r = yara_file.rules[0]
        self.assertEqual(r.location.begin.line, 1)
        self.assertEqual(r.location.begin.column, 1)
        self.assertEqual(r.location.end.line, 6)
        self.assertEqual(r.location.end.column, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant