Question

As an academic and mental exercise, how would one download a precompiled binary file and execute methods in it on an iOS device?

I understand this violates Apple's License Agreement, section 3.2.2, but I am asking for personal projects and to learn more about the iOS runtime.

Goal

What I've tried

I haven't attempted anything concrete, but I would imagine that it would be possible to do something along the lines of...

void *myDownloadedLibrary = dlopen("/path/to/newly/downloaded/framework/MyCoolBinary.framework")
dlsym(myDownloadedLibrary)

Any examples or pointers on what kind of libraries this would work with would be appreciated.
Thanks.

Was it helpful?

Solution

Try something like

void *uikit = dlopen("path_to_dylib", RTLD_LAZY);
id (*FunctionName)(id) = dlsym(uikit, "FunctionName");
FunctionName(arg1);
dlclose(uikit);

For more information you can read about dynamic loading here: http://en.wikipedia.org/wiki/Dynamic_loading

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top