-
Add support for exposing runtime warnings via a callback. (#160) · d20e6f16
Add support for a "warnings_callback" argument to Rules.match(). If provided the function definition needs to be: def warnings_callback(warning_type, message) The callback will be called with a warning type of yara.WARNING_TOO_MANY_MATCHES and the message will be a string indicating which rule caused the warning. I think a warning type and a message is reasonably flexible in case we introduce other runtime warnings in the future. If a callback is not provided we print a warning on stderr using the normal python warning system. It's worth noting the function I'm using was introduced in python 3.2. I can switch it to something more portable if you don't want to pull support for 2.x yet. While I'm here, also chase the renaming of rules_list_head and other list variables so that it can compile with latest yara master.
Wesley Shields authored
×