9

I'm interested in performing (dynamic) binary instrumentation using Python to be able to analyze the binary by instructions during execution for

  • Windows

  • Linux

    Can someone suggest such tool/framework? Does it even exist or possible?

2
  • 3
    Man ... that is going to be hella slow. – Rolf Rolles Jul 23 '13 at 20:53
  • I know, but currently I do not really care :) – PhoeniX Jul 23 '13 at 21:13
9

From https://code.google.com/p/processtap/ -

ProcessTap is a dynamic tracing framework for analyzing closed source-applications. ProcessTap is inspired by DTrace and SystemTap, but it is specific for analyzing closed-source user-space applications. ProcessTap leverages dynamic binary instrumentation to intercept the events of interest (e.g., function calls, system call, memory accesses, and conditional control transfers). Although the current implementation relies on PinTool, alternative back-ends for instrumentation (e.g., Valgrind, Qemu, or DynamoRIO) can be used. The language used in ProcessTap for writing scripts to instrument applications is Python.

4

Despite being an afternoon hack, this static binary instrumenter might get you part way there. However, consider these crucial limitations:

  • It's not dynamic insofar as it runs at compile time, not at runtime.
  • It is also not comprehensive, in the sense that shared and dynamically loaded libraries will not be instrumented by this.
  • It provides no mechanisms for maintaining state, except by linking in your own code (exampled in the gc directory and Makefile). There isn't a good way of connecting instrumentation to that code, except by perhaps declaring and using an extern symbol whose mangled name you know.

BUT, it is in python ;-)

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.