VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
646 stars 179 forks source link

CALLBACK_MSG_TOO_MANY_MATCHES now also passes rule identifier and rule namespace identifier to the callback #181

Closed metthal closed 3 years ago

metthal commented 3 years ago

There was no way to get back to the rule identifier when trying to get back the rule to which the string causing TOO_MANY_MATCHES belongs. This patch makes it so that rule namespace, rule identifier and string identifier are passed as namedtuple with 3 attributes - namespace, rule and string, all containing their respective identifier. This change breaks the current API contract as it changes the type of the argument passed to the callback so I'd understand if it is merged when 4.2.0 is closer to release.

One more change that I also sneaked in is changing the identifiers to be passed as strings and not as byte sequences.

Even though the support for Python 2 already ended, this PR also still keeps the compatibility with Python 2.6+.

Also needs VirusTotal/yara#1519 to be merged.