Is there a way to implement system-wide OS X system infrastructure?

I need to be notified when an application (including a system application / server) calls the System Framework ( CoreServices.framework ). I'm not sure if Code Injection works within a system-wide framework.

Is it possible to replace the system structure with my own copy, and then forward the messages to the real one?

+6
source share
1 answer

You can use the DYLD_INSERT_LIBRARIES environment variable , but this only works with the applications you are running, and not with the system. More details here .

You can override system functions with mach_override , but this requires root privileges or the procmod group. Mach_override was released in MacHack 2003. With a quick glance, it looks as simple as a single function call.

 mach_override_ptr(&orginalFunction, &overrideFunction, NULL); 

Note that redefining the system as a whole is not recommended for non-debugging applications.

A related question .

+1
source

Source: https://habr.com/ru/post/979326/


All Articles