maat.EventManager class

An EventManager manages event hooks for a MaatEngine. Hooks can be set on many different events, such as register access, memory access, branch operations, path constraints, etc. Checkout EVENT for the complete list of supported events. Each hook can have custom callbacks that are called everytime it is triggered. A callback must be a function accepting a single MaatEngine parameter and returning an ACTION value. For example:

def example_callback(m: MaatEngine) -> ACTION:
    print(m.info.reg_access)
    m.cpu.eax = 42
    return ACTION.CONTINUE

❱   Methods

add( EVENT event, WHEN when, Optional[str] name=None, Optional[Union[int,tuple]] filter=None, list callbacks=[], Optional[str] group=None)

Add a new event hook

Parameters
event Event to hook
when When to trigger the hook (before or after the event)
name Unique name to identify the hook
filter (Optional) Specific address range on which to trigger the hook. It is used only for memory access events and the EVENT.EXEC event. The parameter can be a single integer to monitor a single address, or a tuple of two integers to monitor a range of addresses
callbacks (Optional) List of callbacks to be called every time the hook is triggered
group (Optional) Group of the hook

disable(str hook_name)

Disable hook named hook_name

disable_all()

Disable all hooks

disable_group(str group)

Disable all hooks in group group

enable(str hook_name)

Enable hook named hook_name

enable_group(str group)

Enable all hooks in group group