-
Notifications
You must be signed in to change notification settings - Fork 24
Extend
Luca Borzacchiello edited this page Oct 6, 2020
·
10 revisions
Models are necessary to handle external functions and system calls. Models are written in Python, the template of a model is the following:
def sample_model(state: seninja.State, bv: binaryninja.BinaryView):
# [...]
return BVV(0, 64)
a model receives in input the current state and the BinaryView of the current binary. It has to modify the state according to the semantics of the function it is modeling. The return value of the model must be a bitvector, which will be saved in the current register according to the architecture (e.g., eax for x86).
To get the function parameters, use the function get_arg_k
so that the model works on different architectures.
To add a model to SENinja, simply write the handler, add it under the models
folder, and update the dictionary in models/function_models.py
.