Skip to content
Luca Borzacchiello edited this page Oct 7, 2020 · 10 revisions

Add a new model

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). Example of models can be found in the models folder.

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 in the models folder, and update the dictionary in models/function_models.py.

Add a new architecture

todo

Clone this wiki locally