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

'yaramod.Rule' object has no attribute 'text_formatted' #226

Open
overdozzz2020 opened this issue Nov 28, 2022 · 1 comment
Open

'yaramod.Rule' object has no attribute 'text_formatted' #226

overdozzz2020 opened this issue Nov 28, 2022 · 1 comment

Comments

@overdozzz2020
Copy link

overdozzz2020 commented Nov 28, 2022

Hi,
I have a problem when wanna formatting my yara rules(rule.text remove my comments).
When we use parse_file() function it will create for us object from <class 'yaramod.YaraFile'>:

yara_file = yaramod.Yaramod().parse_file(in_path)

and when iterating over yara_file rules it will create <class 'yaramod.Rule'> object for us:

yara_file = yaramod.Yaramod().parse_file(in_path):
for rule in yara_file.rules:
         .....       

In my case, i create include file(include.yar) that contain multiple other yara file paths like below:

include "/path_to_rules/rule1.yar"
include "/path_to_rules/rule2.yar"
          .....

When i use rule.text it will give me formatted rule content as i want but it remove all the comments!

yara_file = yaramod.Yaramod().parse_file(in_path):
for rule in yara_file.rules:
   print(rule.text)

I need sth like text_formatted that we can use for yaramod.YaraFile object that don't remove yara rule comments when parsing.

I can't parse and use each yara file separately due to some rules use other rules and need to be included before.

@metthal
Copy link
Member

metthal commented Mar 2, 2023

Something like this is unfortunately not supported right now. If you'd like this kind of functionality, we're welcoming PRs but currently, it's not in our capacity to add this. Sorry.

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

2 participants