SWRoute
SWRoute copied to clipboard
PoC of function hooking in Swift
I haven't touched this since the first Swift ßeta, so let's see what we have now.
Due to compiler optimizations, some class methods and functions are inlined/removed, so we're unable to get their addresses to route. `rd_get_func_imp()` returns some value for these ones though, but it's...
So the following code generates a compiler error > **Error:** Partial application of struct method is not allowed ``` swift var err = SwiftRoute.replace(function: String().substringFromIndex, with: { ^^^^^^^^^^^^^^^^^^^^^^^^^^ (index :...
AFAIK, setters and getters are shared between all instances of a class in Swift. They seem to have the following structure: ``` c const int foo_offset = 0x48; int getFoo(void...
For now, we don't pass a third argument `original_ptr` to the `rd_route()` call: ``` swift rd_route(rd_get_func_impl(targetMethod), rd_get_func_impl(replacement), nil) ``` so we lose an original implementation — that's a big problem,...
I've added iOS target to verify that at compiles and the tests pass.