Dev:Libundirect

libundirect is a patchfinding and rebinding 64-bit library that provides directives to hook Objective-C direct methods. With the feature called  introduced in Xcode 12 and iOS 14.0, these direct methods are stripped when compiled - being unexported C functions and thus their signature and name are missing.

As a patchfinder,  can find the address of the function to hook by providing unique bytes within the function and the name of the binary or library that the function resides. You need to perform reverse engineering on the binary that you are working with in order to determine the bytes to use. See libundirect's note on patchfinding or johnzaro's guide to using libundirect for more details.

As a rebinder,  can re-add Objective-C method signature to the function that you hook. This provides backward compatibility for earlier iOS versions that the signature is still intact - and that you have to import  to make   aware of direct methods and turn itself into   (because it is just a C-like function now).

How to use this library
Headers are available from libundirect's GitHub project or from Theos' headers project. The library can be installed to  by running   script inside libundirect repository.

Makefile
Add to your Makefile:



Packaging
Add to your package's control file:


 * to the  field.

Hooking (and rebinding) a direct Objective-C method (MobileSafari)
We will use the code in SafariPlus by opa334 as an example.

Hooking an unnamed C function (libicucore)
We will use the code in EmojiAttributes by PoomSmart as an example.