Contents

conmulligan/JailbreakDetector.swift

A super simple, configurable and (optionally) verbose jailbreak detector for iOS.

Getting Started

For basic usage, create a JailbreakDetector instance and invoke the isJailbroken() method:

import JailbreakDetector

let detector = JailbreakDetector()
if detector.isJailbroken() {
    print("This device might be jailbroken!")
}

If you need to dig deeper into the jailbreak detector results, use the detectJailbreak() method, which returns a Result enumeration:

let detector = JailbreakDetector()
switch detector.detectJailbreak() {
case .pass:
    print("Not jailbroken!")
case .fail(let reasons):
    print("Might be jailbroken because:")
    for reason in reasons {
        print("Reason: \(reason)")
    }
case .simulator:
    print("Running in the simulator!")
case .macCatalyst:
    print("Running on macOS!")
}

For finer control over the jailbreak detector's behaviour, use JailbreakDetectorConfiguration. Note: in most cases you'll want to use the default configuration as-is, or as a baseline, instead of initializing your own configuration from scratch.

// Start with the default configuration.
var configuration = JailbreakDetectorConfiguration.default

// Enable logging.
configuration.loggingEnabled = true

// Disable halt after failure. When disabled, the jailbreak detector will
// continue with its checks even after encountering a failure,
// and the `Result.fail` case may include multiple failure reasons.
configuration.haltAfterFailure = false

// Initialize the jailbreak detector with the custom configuration.
let detector = JailbreakDetector(using: configuration)

Installation

JailbreakDetector is available through the Swift Package Manager. To use JailbreakDetector with SPM, add https://github.com/conmulligan/JailbreakDetector.swift.git as a dependency.

License

JailbreakDetector is available under the MIT license. See the LICENSE file for more info.

Package Metadata

Repository: conmulligan/JailbreakDetector.swift

Stars: 15

Forks: 2

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

Topics: ios, ipados, jailbreak, swift

README: README.md