007.代码判断设备是否越狱

it2023-01-11  58

007.代码判断设备是否越狱

Swift import UIKit public struct Jailbreak { private enum JailbreakType : String { case dydia = "/Applications/Cydia.app" //存在 越狱 case limera1n = "/Applications/limera1n.app" //存在 越狱 case greenpois0n = "/Applications/greenpois0n.app" //存在 越狱 case blackra1n = "/Applications/blackra1n.app" //存在 越狱 case blacksn0w = "/Applications/blacksn0w.app" //存在 越狱 case redsn0w = "/Applications/redsn0w.app" //存在 越狱 case absinthe = "/Applications/Absinthe.app" //存在 越狱 case bash = "/bin/bash" //存在 越狱 case sshd = "/usr/sbin/sshd" //存在 越狱 case etc_apt = "/etc/apt" //存在 越狱 case lib_apt = "/private/var/lib/apt" //存在 越狱 case substrate = "/Library/MobileSubstrate/MobileSubstrate.dylib" //存在 越狱 case libsystem_kernel = "/usr/lib/system/libsystem_kernel.dylib" //不存在 越狱 } /// 是否越狱 public static var isJailbreakForFilePath : Bool { guard FileManager.default.fileExists(atPath: JailbreakType.dydia.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.limera1n.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.greenpois0n.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.blackra1n.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.blacksn0w.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.redsn0w.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.absinthe.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.bash.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.sshd.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.etc_apt.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.lib_apt.rawValue) else { return true } guard FileManager.default.fileExists(atPath: JailbreakType.substrate.rawValue) else { return true } guard !FileManager.default.fileExists(atPath: JailbreakType.libsystem_kernel.rawValue) else { return true } return false } } OC if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/greenpois0n.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/blacksn0w.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/redsn0w.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Absinthe.app"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/bin/bash"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/usr/sbin/sshd"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/etc/apt"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/private/var/lib/apt"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Library/MobileSubstrate/MobileSubstrate.dylib"]) { NSLog(@"此设备已越狱"); } else if ([[NSFileManager defaultManager] fileExistsAtPath:@"/usr/lib/system/libsystem_kernel.dylib"]) { NSLog(@"此设备未越狱"); }else { NSLog(@"此设备未越狱"); }

XMind - Trial Version

最新回复(0)