Closed mogui closed 1 year ago
fixed
Hi @jmpews Still something wrong, it does not segfault anymore but function doesn't get swapped this is my output:
Hello from dylib!
[!] [/Users/runner/work/Dobby/Dobby/source/InterceptRouting/Routing/FunctionInlineHook/FunctionInlineHook.cc:8:DobbyHook]function address is 0x0
Hello, World! 6
Whats'wrong?
check DobbySymbolResolver(NULL, "nice_function");
return, it seems the symbol not resolved.
Yes there is something I have to specify better? I've posted the code I'm using, is it ok ? there is something else I should specify? like const char *image_name
is it right to be NULL?
Ok!, I was hooking wrong the symbol name. Now I got it but still got a segmentation fault
printf("Hello from dylib!\n");
void *sym_addr = DobbySymbolResolver(NULL, "_nice_function");
printf("sym_addr is: %p\n", sym_addr);
install_hook_nice_function(sym_addr);
syslog(LOG_ERR, "Dylib injection successful in %s\n", argv[0]);
DYLD_INSERT_LIBRARIES=inject2.dylib ./hello
Hello from dylib!
sym_addr is: 0x102ee7f3c
[1] 30335 segmentation fault DYLD_INSERT_LIBRARIES=inject2.dylib ./hello
int nice_function(){
return 6;
}
is shot function, the func body length not enough for trampoline, try build with "-DBUILD_EXAMPLE=ON", and test socket_example
binary.
Yay! I made it work, just by makeing teh function a bit longer ! Thanks a lot @jmpews
Just on more question, If I wanted to hook a dylib loaded by an executable I have to name it in DobbySymbolResolver(NULL, "_nice_function");
instead of NULL, is it right?
Hi there I'm trying to working it out but got a segmentation fault, maybe I'm doing something wrong. Here's the simple program I'm trying to inject:
This the lib I'm building to inject
Compiling with clang++ this is what I get
What am I foing wrong?