Created
July 1, 2019 15:41
-
-
Save malonehedges/d8ab1fd559b5bae7fdca0c4c795d1e5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isJailbroken() -> Bool { | |
#if !targetEnvironment(simulator) | |
if FileManager.default.fileExists(atPath: "/Applications/Cydia.app") || | |
FileManager.default.fileExists(atPath: "/Library/MobileSubstrate/MobileSubstrate.dylib") || | |
FileManager.default.fileExists(atPath: "/bin/bash") || | |
FileManager.default.fileExists(atPath: "/usr/sbin/sshd") || | |
FileManager.default.fileExists(atPath: "/etc/apt") || | |
FileManager.default.fileExists(atPath: "/private/var/lib/apt/") { | |
return true | |
} | |
let stringToWrite = "howdy" | |
do { | |
try stringToWrite.write(toFile: "/private/JailbreakTest.txt", atomically: true, encoding: String.Encoding.utf8) | |
return true | |
} catch { | |
return false | |
} | |
#else | |
return false | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment