简体   繁体   中英

Jailbreak detection mechanism not detecting jailbreak device

In my app I wanna detect whether the device is Jailbroken or not. If it is jailbroken, it should not allow user to use the app. I added a function to detect but its not detecting jailbroken devices

Attaching the code for reference

JailbrokenDetector.swift

func isJailBroked() -> Bool {
    let pathsArray = ["/bin/bash", "/usr/sbin/sshd", "/etc/apt", "/private/var/lib/apt/", "/Applications/Cydia.app", "/Library/MobileSubstrate/MobileSubstrate.dylib", "/Library/SBSettings/Themes/", "/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist/", "/private/var/lib/cydia/private/var/mobile/Library/SBSettings/Themes/", "/var/cache/apt/", "/var/lib/cydia/", "/var/log/syslog/", "/var/tmp/cydia.log/", "/bin/bash/", "/bin/sh/", "/usr/sbin/sshd/", "/usr/bin/sshd/", "/usr/libexec/sftp-server/", "/etc/ssh/sshd_config/", "/etc/apt/", "/Applications/Cydia.app/", "/Applications/WinterBoard.app/", "/Applications/SBSettings.app/", "//private/var/lib/cydia/private/var/mobile/Library/SBSettings/Themes/", "/usr/libexec/ssh-keysign/", "/Applications/blackra1n.app", "/Applications/FakeCarrier.app", "/Applications/Icy.app", "/Applications/IntelliScreen.app", "/Applications/MxTube.app", "/Applications/RockApp.app", "/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist", "/Library/MobileSubstrate/DynamicLibraries/Veency.plist", "/private/var/stash", "/private/var/tmp/cydia.log", "/System/Library/LaunchDaemons/com.ikey.bbot.plist"]
    
    for pathString in pathsArray {
        if FileManager.default.fileExists(atPath: pathString) {
            return true
        }
    }
            
    let dummyString = “Testing”
    
    do {
        try dummyString.write(toFile:"/private/JailbreakTest.txt", atomically:true, encoding:String.Encoding.utf8)
        return true
    } catch {
        return false
    }

  if (UIApplication.shared.canOpenURL(URL(string: "cydia://package/com.example.package")!) || UIApplication.shared.canOpenURL(URL(string: "Cydia://")!) || UIApplication.shared.canOpenURL(URL(string: "cydia://")!)) {
        return true
    }
    
    if self.canOpen(path: "/Applications/Cydia.app") ||
        self.canOpen(path: "/Library/MobileSubstrate/MobileSubstrate.dylib") ||
        self.canOpen(path: "/bin/bash") ||
        self.canOpen(path: "/usr/sbin/sshd") ||
        self.canOpen(path: "/etc/apt") ||
        self.canOpen(path: "/usr/bin/ssh") {
        return true
    }
}

In Appdelegate.m (Obj c)

if ([JailbrokenDetector isDeviceJailBroken]) {
    exit(0);
    return NO;
}

As of iOS 14 apps cannot do these fs checks outside of its own bundle so the method you have above will not work.

Additionally, jailbreak detection is not worth it, that check can be patched to not work with just 6 lines at most, it's a lost battle people need to stop fighting.

True, is not worth even trying, Jailbreak/Tweak Developers are very talented and can bypass all jailbreak detectors, I jailbreak and I have every app bypassed, I don't even understand why are you trying to stop us using your apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM