diff options
-rw-r--r-- | cydo.cpp | 30 | ||||
-rw-r--r-- | entitlements.xml | 59 | ||||
-rw-r--r-- | genent.xml | 7 | ||||
-rw-r--r-- | makefile | 8 | ||||
-rw-r--r-- | postinst.mm | 21 |
5 files changed, 89 insertions, 36 deletions
@@ -37,6 +37,35 @@ struct timeval _ltv; bool _itv; +#include <dlfcn.h> +/* Set platform binary flag */ +#define FLAG_PLATFORMIZE (1 << 1) + +void patch_setuidandplatformize() { + void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); + if (!handle) return; + + // Reset errors + dlerror(); + + typedef void (*fix_setuid_prt_t)(pid_t pid); + fix_setuid_prt_t setuidptr = (fix_setuid_prt_t)dlsym(handle, "jb_oneshot_fix_setuid_now"); + + typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); + fix_entitle_prt_t entitleptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); + + setuidptr(getpid()); + + setuid(0); + + const char *dlsym_error = dlerror(); + if (dlsym_error) { + return; + } + + entitleptr(getpid(), FLAG_PLATFORMIZE); +} + typedef Function<void, const char *, launch_data_t> LaunchDataIterator; void launch_data_dict_iterate(launch_data_t data, LaunchDataIterator code) { @@ -46,6 +75,7 @@ void launch_data_dict_iterate(launch_data_t data, LaunchDataIterator code) { } int main(int argc, char *argv[]) { + patch_setuidandplatformize(); auto request(launch_data_new_string(LAUNCH_KEY_GETJOBS)); auto response(launch_msg(request)); launch_data_free(request); diff --git a/entitlements.xml b/entitlements.xml index fbcca6a..2beffeb 100644 --- a/entitlements.xml +++ b/entitlements.xml @@ -1,37 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>com.apple.coreaudio.allow-amr-decode</key> - <true/> - - <key>com.apple.coremedia.allow-protected-content-playback</key> - <true/> - - <key>com.apple.managedconfiguration.profiled-access</key> - <true/> - - <key>com.apple.springboard.opensensitiveurl</key> - <true/> - - <key>dynamic-codesigning</key> - <true/> - - <key>com.apple.springboard.launchapplications</key> - <true/> - - <key>keychain-access-groups</key> - <array> - <string>com.apple.cfnetwork</string> - <string>com.apple.identities</string> - <string>com.apple.mobilesafari</string> - </array> - - <key>platform-application</key> - <true/> - - <key>com.apple.CommCenter.fine-grained</key> - <array> - <string>spi</string> - </array> + <key>com.apple.CommCenter.fine-grained</key> + <array> + <string>spi</string> + </array> + <key>com.apple.coreaudio.allow-amr-decode</key> + <true/> + <key>com.apple.coremedia.allow-protected-content-playback</key> + <true/> + <key>com.apple.managedconfiguration.profiled-access</key> + <true/> + <key>com.apple.private.security.no-container</key> + <true/> + <key>com.apple.private.skip-library-validation</key> + <true/> + <key>com.apple.springboard.launchapplications</key> + <true/> + <key>com.apple.springboard.opensensitiveurl</key> + <true/> + <key>keychain-access-groups</key> + <array> + <string>com.apple.cfnetwork</string> + <string>com.apple.identities</string> + <string>com.apple.mobilesafari</string> + </array> + <key>platform-application</key> + <true/> </dict> </plist> diff --git a/genent.xml b/genent.xml new file mode 100644 index 0000000..d833045 --- /dev/null +++ b/genent.xml @@ -0,0 +1,7 @@ +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>platform-application</key> + <true/> +</dict> +</plist> @@ -292,19 +292,19 @@ MobileCydia: $(object) entitlements.xml $(lapt) cfversion: cfversion.mm $(cycc) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation - @ldid -T0 -S $@ + @ldid -T0 -Sgenent.xml $@ setnsfpn: setnsfpn.cpp $(cycc) -o $@ $(filter %.cpp,$^) $(flag) $(link) - @ldid -T0 -S $@ + @ldid -T0 -Sgenent.xml $@ cydo: cydo.cpp $(cycc) $(plus) -o $@ $(filter %.cpp,$^) $(flag) $(link) -Wno-deprecated-writable-strings - @ldid -T0 -S $@ + @ldid -T0 -Sgenent.xml $@ postinst: postinst.mm CyteKit/stringWith.mm CyteKit/stringWith.h CyteKit/UCPlatform.h $(cycc) $(plus) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation -framework Foundation -framework UIKit - @ldid -T0 -S $@ + @ldid -T0 -Sgenent.xml $@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn cydo $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup sudo rm -rf _ diff --git a/postinst.mm b/postinst.mm index 3cd8cdf..1b24c6d 100644 --- a/postinst.mm +++ b/postinst.mm @@ -9,6 +9,25 @@ #include <Menes/ObjectHandle.h> +/* Set platform binary flag */ +#include <dlfcn.h> +#define FLAG_PLATFORMIZE (1 << 1) + +void platformize_me() { + void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); + if (!handle) return; + + // Reset errors + dlerror(); + typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); + fix_entitle_prt_t ptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); + + const char *dlsym_error = dlerror(); + if (dlsym_error) return; + + ptr(getpid(), FLAG_PLATFORMIZE); +} + void Finish(const char *finish) { if (finish == NULL) return; @@ -181,6 +200,8 @@ int main(int argc, const char *argv[]) { if (argc < 2 || strcmp(argv[1], "configure") != 0) return 0; + platformize_me(); + NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); bool restart(false); |