Implement CALLBACK_MSG_MODULE_IMPORTED.
Implement a callback to handle module data. It will be given a dictionary which contains all the information stored in the module that is fit for consumption. Things like functions are left out. You can now do things like this: ``` import yara import json from pprint import pprint def modules_callback(d): try: pprint(d) # This will not work if you have non-ASCII in your strings. #print json.dumps(d, indent=4) except Exception as e: print "Exception: %s" % e return yara.CALLBACK_CONTINUE rules = yara.compile(source='import "pe" rule always_false { condition: false }') with open('foo.exe') as f: rules.match(data=f.read(), modules_callback=modules_callback) ```
Showing
Please
register
or
sign in
to comment