Okay so this is a crazy thought I had.
Not quite sure how to implement it assume a C++ compiled target win32 x86.
A DLL once injected and given a memory range in the code section will locate functions, identify their calling convention and args, hook them dynamically and log when they are called, what the args contain and returned value.
All at runtime, okay static analysis assisted might be fine too.
Yes I know we can just use a static analyzer or debugger and do them on our own one by one but how might a program be developed to help automate this tedious process?
With a disassembly engine it could process the bytes back into opcodes and run scans for patterns of interest there are also some nifty ones that have good attempts at "decompiling" it back into code.
Even better if it can auto locate vtables, generate signatures to scan for the function addresses in modified versions of the executable target and provide an API to hook them.
Ideally the end product scenario is, once a user has a list of all functions and have seen some interesting things in the args they could simply select the ones they are interested in from a list and click a button to generate C++ source for a dll base to further build on containing all of the typedefs and hook functions that just call the original method by default.
Also I can't seem to get the hang of hooking vardic functions either (variable number of args e.g. think sprintf with the ... and a format string) getting the number of arguments seems tricky?
TLDR; How could a program know how many arguments a function has at and where those arguments come from, construct the relevant hook and log them at runtime then use that information to generate C++ hook template source.
Or am I just being silly?
Not quite sure how to implement it assume a C++ compiled target win32 x86.
A DLL once injected and given a memory range in the code section will locate functions, identify their calling convention and args, hook them dynamically and log when they are called, what the args contain and returned value.
All at runtime, okay static analysis assisted might be fine too.
Yes I know we can just use a static analyzer or debugger and do them on our own one by one but how might a program be developed to help automate this tedious process?
With a disassembly engine it could process the bytes back into opcodes and run scans for patterns of interest there are also some nifty ones that have good attempts at "decompiling" it back into code.
Even better if it can auto locate vtables, generate signatures to scan for the function addresses in modified versions of the executable target and provide an API to hook them.
Ideally the end product scenario is, once a user has a list of all functions and have seen some interesting things in the args they could simply select the ones they are interested in from a list and click a button to generate C++ source for a dll base to further build on containing all of the typedefs and hook functions that just call the original method by default.
Also I can't seem to get the hang of hooking vardic functions either (variable number of args e.g. think sprintf with the ... and a format string) getting the number of arguments seems tricky?
TLDR; How could a program know how many arguments a function has at and where those arguments come from, construct the relevant hook and log them at runtime then use that information to generate C++ hook template source.
Or am I just being silly?