yara-python 2.0 don't have the iterator for yara.Rules implemented. You can upgrade to more recent version.
On Fri, Mar 4, 2016 at 2:50 PM, Wesley Shields <wshie...@gmail.com> wrote: > I don't recall exactly when it was added but probably is in newer versions > than what you have. > > -- WXS > > On Friday, March 4, 2016, Robert Giczewski <robert.giczew...@gmail.com> > wrote: > >> yara 3.2.0 >> yara-python 2.0 >> >> Am Freitag, 4. März 2016 14:35:21 UTC+1 schrieb Wesley Shields: >>> >>> What version of YARA are you using? That should work but I'm unable to >>> confirm right now. >>> >>> -- WXS >>> >>> On Friday, March 4, 2016, Robert Giczewski <robert.g...@gmail.com> >>> wrote: >>> >>>> That would be too easy ;-) >>>> >>>> TypeError: 'yara.Rules' object is not iterable >>>> >>>> >>>> Am Freitag, 4. März 2016 13:59:11 UTC+1 schrieb Wesley Shields: >>>>> >>>>> I believe there is support for this that was added a while back. >>>>> Totally untested but I believe it goes like this: >>>>> >>>>> for rule in rules: >>>>> print rule.identifier >>>>> >>>>> -- WXS >>>>> >>>>> On Friday, March 4, 2016, Robert Giczewski <robert.g...@gmail.com> >>>>> wrote: >>>>> >>>>>> Hi, >>>>>> I'm currently loading quite a lot of files containing even more yara >>>>>> rules. >>>>>> After loading the files, I'm compiling the rules so I can check files >>>>>> against the rules. (see the code below) >>>>>> >>>>>> print "[*] Loading rules (%s) ... " % (rules_dir) >>>>>> >>>>>> sigs = dict([(name.replace(".yara", "").split("/")[-1], name) for >>>>>> name in glob.glob(rules_dir + "/*.yara")]) >>>>>> rules = yara.compile(filepaths=sigs) >>>>>> >>>>>> >>>>>> Before checking any file, I want to see the names of every rule I >>>>>> successfully compiled. >>>>>> I'd love to have something like: >>>>>> >>>>>> >>>>>> for rule in rules.getNames(): >>>>>> print rule >>>>>> >>>>>> # badAss-1-rule >>>>>> # badAss-2-rule >>>>>> # ... >>>>>> # badAss-n-rule >>>>>> >>>>>> Any ideas? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Rob >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "YARA" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to yara-project+unsubscr...@googlegroups.com. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "YARA" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to yara-project+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "YARA" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to yara-project+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "YARA" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to yara-project+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "YARA" group. To unsubscribe from this group and stop receiving emails from it, send an email to yara-project+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.