2

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)?

7

Another solution:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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