forked from Elsonsingh1992/Taurine-Haxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileproviderctl_internal.m
44 lines (40 loc) · 1.47 KB
/
fileproviderctl_internal.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <mach-o/dyld.h>
#import <IOKit/IOKitLib.h>
#import "TSUtil.h"
#import "SBFApplication.h"
BOOL isJailbroken(void);
char* getBootArgs(void);
int main (int __unused argc, char* argv[]) {
char* bootArgs = getBootArgs();
if (bootArgs) {
if (strstr(bootArgs, "no_untether") != NULL) {
printf("no_untether boot arg found");
return -1;
}
}
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString* TaurinePath = [NSString stringWithFormat:@"%@/Taurine", [[SBFApplication alloc] initWithApplicationBundleIdentifier: @"org.coolstar.taurine"].bundleURL.path];
if (!isJailbroken() && [fileManager fileExistsAtPath: @"/var/mobile/.untether"]) {
sleep(5);
spawnRoot(TaurinePath, @[@"jailbreak"]);
}
}
BOOL isJailbroken(void) {
for (int i = 0; i <= _dyld_image_count(); i++) {
char* name = (char*)_dyld_get_image_name(i);
if (name) {
if (strcmp(name, "/usr/lib/pspawn_payload-stg2.dylib") == 0) {
return true;
}
}
}
return false;
}
char* getBootArgs(void) {
io_registry_entry_t entry = IORegistryEntryFromPath(MACH_PORT_NULL, "IODeviceTree:/options");
CFStringRef cfNvramVar = IORegistryEntryCreateCFProperty(entry, CFSTR("boot-args"), kCFAllocatorDefault, 0);
char* nvramVar = (char*)CFStringGetCStringPtr(cfNvramVar, kCFStringEncodingUTF8);
return nvramVar;
}