[DynInst_API:] Is DynInst_API the right tool for a simple binary rewriting task? If not, what is?


Date: Tue, 7 Jan 2014 19:02:38 -0600
From: Chad Renton <ratehead@xxxxxxxxx>
Subject: [DynInst_API:] Is DynInst_API the right tool for a simple binary rewriting task? If not, what is?
Hello,

This is very much a newbie question, and I apologize if this is the
incorrect forum for that.

I need to modify binary programs to insert arbitrary code before a
function is called (initially "main" would be good enough).

Well, I suppose I should take a step back.  I really wish to call a
script at that point in the binary, and am thinking the best way to do
this is to insert arbitrary code.  I'd like it if the script could
take the arguments to the function call, but it's not completely
necessary.

I've been looking at DynInst, and it appears to be the right tool.
I've also seen PatchAPI, but before I investigate further, can you
tell me whether I'm barking up the wrong tree?  I've not seen any
examples of such things after searching, so I want to be sure.

Also, if this is an easy task with Dyninst or PatchAPI, any help on
where to look (or how to do it) would be much appreciated.  An example
of the minimum (calling an arbitrary function before "main" begins
executing) would be especially useful.

Thanks,

Chad
[← Prev in Thread] Current Thread [Next in Thread→]