Skip to content

Instantly share code, notes, and snippets.

@AbodiDawoud
Created December 5, 2025 00:31
Show Gist options
  • Select an option

  • Save AbodiDawoud/7e33a0bb30822bc3bbad47695762e56b to your computer and use it in GitHub Desktop.

Select an option

Save AbodiDawoud/7e33a0bb30822bc3bbad47695762e56b to your computer and use it in GitHub Desktop.
import Foundation
var Jailbroken = false //when the app open the iphone state is not jailbroken because the script has not yet run
var simulate = false //when the app open the simulator state is not true because the script has not yet run
func IsJailbroken() { //name of the function
#if targetEnvironment(simulator) //just check if the app run on the simulator and change the variable "simulate to true "
simulate = true
#endif
// array of all the possible locations where jailbroken files may be stored
let jbFilePaths = [
"/private/var/lib/apt",
"/Applications/Cydia.app", // if you can open cydia
"/Applications/Zebra.app",
"/Applications/iCleaner.app", // if you can open jailbroken app
"/Applications/Sileo.app",
"/Applications/Filza.app", // if you can open Filza
"/Library/PreferenceLoader/",
"/Library/MobileSubstrate/MobileSubstrate.dylib",
"/Library/MobileSubstrate/DynamicLibraries/PreferenceLoader.dylib",
"/Library/MobileSubstrate/DynamicLibraries/PreferenceLoader.plist",
"/Library/MobileSubstrate/DynamicLibraries/RocketBootstrap.dylib",
"/Library/MobileSubstrate/DynamicLibraries/RocketBootstrap.plist",
"/bin/bash",
"/usr/sbin/sshd",
"/etc/apt",
"/usr/bin/ssh"
]
for path in jbFilePaths where FileManager.default.fileExists(atPath: path) {
Jailbroken = true // if this is true the iphone has a jailbroken app installed which is not possible on a "factory" iphone so the iphone is jilbroken
return // only need to set `Jailbroken = true` once
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment