Skip to content

Instantly share code, notes, and snippets.

@malonehedges
Created July 1, 2019 15:41
Show Gist options
  • Save malonehedges/d8ab1fd559b5bae7fdca0c4c795d1e5d to your computer and use it in GitHub Desktop.
Save malonehedges/d8ab1fd559b5bae7fdca0c4c795d1e5d to your computer and use it in GitHub Desktop.
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