3

IDA screen shot

How do I get the 8B 45 FC corresponding to the mov eax, [rbp+var_4] etc. via idapython?

I did not come up with a better solution than

  1. Getting the instruction via idautils.DecodeInstruction()
  2. Getting the instruction's size in bytes
  3. Looping over all bytes of the instruction and fetching the content via idc.Byte()

Is there a better solution, e.g. an api call (which I did not find)?

1 Answer 1

8

Another solution:

ea = ScreenEA() # Or whatever you want
buf = idc.GetManyBytes(ea, ItemSize(ea))
1
  • Much better than my try. If there is really no particular api function, this may be the best solution. Feb 11, 2016 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.