Skip to content

Instantly share code, notes, and snippets.

@landonf
Created August 19, 2009 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save landonf/170499 to your computer and use it in GitHub Desktop.
Save landonf/170499 to your computer and use it in GitHub Desktop.
#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