Getting address from instruction #2143
-
I am trying to get the function at a certain address.
however, when trying to get the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There's several ways to do this. The simplest is to just pull out the last argument, wrap it in str and int:
Note that I'm using The better solution though would be to get the IL at that location and simply ask for the destination of the call. This will work better if the argument is a register for example whose value is known. Notice that I have to use Also, if you've got the address of that instruction you can use something like:
to directly get the LLIL instruction. Note that MLIL will be functionally similar except it will also have handy things like Does that help? |
Beta Was this translation helpful? Give feedback.
There's several ways to do this. The simplest is to just pull out the last argument, wrap it in str and int:
int(str(current_basic_block[1][0][-1]), 16)
Note that I'm using
current_basic_block[1][0]
to get the instruction tokens here.The better solution though would be to get the IL at that location and simply ask for the destination of the call. This will work better if the argument is a register for example whose value is known.
For example:
Notice that I have to use
.value.value
at the call because the first.value
asks for the constant-data-flow representation. There are other possible types besides constant values (could be any of https://api.binary.ninja/binaryninja.enums-module.h…