// 常见越狱文件
const char *examineBreak_Tool_pathes[] = {
"/Applications/Cydia.app",
"/Library/MobileSubstrate/MobileSubstrate.dylib",
"/bin/bash",
"/usr/sbin/sshd",
"/etc/apt"
};
char *printEnv(void){
char *env = getenv("DYLD_INSERT_LIBRARIES");
return env;
}
判断是否越狱的常用集中判断方式:
+ (BOOL)isBreakOutPrison{
// 方式1.判断是否存在越狱文件
for (int i = 0; i < 5; i++) {
if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithUTF8String:examineBreak_Tool_pathes[i]]]){
return YES;
}
}
// 方式2.判断是否存在cydia应用
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]]){
return YES;
}
// 方式3.读取系统所有的应用名称
if ([[NSFileManager defaultManager] fileExistsAtPath:@"/User/Applications/"]){
return YES;
}
// 方式4.读取环境变量
if(printEnv()){
return YES;
}
return NO;
}
参考:
http://blog.csdn.net/sakulafly/article/details/21159257
http://blog.csdn.net/FlyingKuiKui/article/details/52838147