Created
August 19, 2009 17:32
-
-
Save landonf/170499 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <sys/stat.h> | |
#import <mach-o/dyld.h> | |
/** | |
* Returns YES if the device is (likely) jailbroken, no otherwise. | |
*/ | |
static BOOL isJailbroken () { | |
int score = 0; | |
/* Check for Cydia/Installer apt */ | |
struct stat sbuf; | |
if (stat("/var/lib/apt", &sbuf) < 0) { | |
NSLog(@"Probably not jailbroken: %s", strerror(errno)); | |
} else { | |
NSLog(@"Probably jailbroken (unless Apple shipped apt-get)"); | |
score++; | |
} | |
/* Check for runtime patches only available on jailbroken phones (ABFix, Winterboard, iBirthday, etc) */ | |
uint32_t imageCount = _dyld_image_count(); | |
for (uint32_t i = 0; i < imageCount; i++) { | |
NSLog(@"Image: %s", _dyld_get_image_name(i)); | |
// Add checks here | |
} | |
if (score > 1) | |
return YES; | |
return NO; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment