user31929
user31929

Reputation: 1145

Jailbreak check method, apple will approve this?

In my app i need to check sometimes if the running device is a jailbreak device or not. This is the most complete method i have found:

BOOL Jail=NO;
if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/Library/MobileSubstrate/MobileSubstrate.dylib"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/bin/bash"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/usr/sbin/sshd"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/etc/apt"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/private/var/lib/apt/"] ||
   [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://package/com.example.package"]])  {
  Jail= YES;
}

FILE *f = NULL ;
if ((f = fopen("/bin/bash", "r")) ||
   (f = fopen("/Applications/Cydia.app", "r")) ||
   (f = fopen("/Library/MobileSubstrate/MobileSubstrate.dylib", "r")) ||
   (f = fopen("/usr/sbin/sshd", "r")) ||
   (f = fopen("/etc/apt", "r")))  {
  fclose(f);
  Jail= YES;
}
fclose(f);

NSError *error;
NSString *stringToBeWritten = @"This is a test.";
[stringToBeWritten writeToFile:@"/private/jailbreak.txt" atomically:YES encoding:NSUTF8StringEncoding error:&error];
[[NSFileManager defaultManager] removeItemAtPath:@"/private/jailbreak.txt" error:nil];
if(error == nil)
{
  Jail= YES;
}

What i haven't found, it's a clear answer to the question: "Apple will approve this code?" , in guidelines i can read:

"Apps that read or write data outside its designated container area will be rejected".

However it's clear that i'm trying to write or read only to check if the device is jailbroken... So there's someone that have successfully submitted this code to apple?

Upvotes: 0

Views: 1709

Answers (2)

thelaws
thelaws

Reputation: 8001

Maybe.

Many developer's have been rejected for including jailbreak checking, and many have not. If you submit with a jailbreak check, you should NOT expect to be approved (although you may get through the review process this time).

Upvotes: 0

Leonardo
Leonardo

Reputation: 1750

This is the code of a submitted app

BOOL bash = NO;

FILE *f = fopen("/bin/bash", "r");
if (f != NULL)
{
    bash = YES;
}
fclose(f);

return bash;

So, I believe your code will be accepted too

Upvotes: 2

Related Questions