This is a code snippet that presents so many fiendish possibilities!
Muahahahahah!
Found here.
- (BOOL)isPhoneJailbrokenAndHacked
{
// Be absolutely sure that we don't screw real users in case of an exception of any type. We always return NO in catch block.
@try
{
// Grab a reference to the defaultManager
NSFileManager *fileMan = [NSFileManager defaultManager];
// Get the path to the MobileInstallation file that gets modded to allow illegal apps on the iPhone
NSString *filePath = @"/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation";
// Make sure the file exists
BOOL fileExists = [fileMan fileExistsAtPath:filePath];
if(fileExists)
{
// Grab the file attributes
NSDictionary *fileAttributes = [fileMan fileAttributesAtPath:filePath traverseLink:YES];
// Grab the NSFilePosixPermissions and make sure they are 493. If it isn't 493 it's probably hacked.
int posixPermission = [[fileAttributes objectForKey:NSFilePosixPermissions] intValue];
if(posixPermission != 493)
return YES;
}
}
@catch (NSError *error)
{
return NO;
}
return NO;
}
No comments:
Post a Comment