【问题标题】:Detect JailBroken Phone in IOS with xCon packages Installed在安装了 xCode 包的 IOS 中检测 JailBroken Iphone
【发布时间】:2017-08-15 13:10:31
【问题描述】:

我发现多个帖子解释了检测越狱电话方法的通用方法。

其中一个密切的参考是:https://github.com/masbog/isJB

但是在安装了 xCon 的设备上测试时没有检测到越狱。

任何导致我们如何检测的方法,因为如果设备是 JB 并且即使安装了 xCon,我们也需要阻止金融应用程序。

非常感谢任何帮助。

【问题讨论】:

  • 类似的问题还没有答案,但是我们看到其他金融应用程序能够检测到:stackoverflow.com/questions/40697765/…
  • 正如您链接到的帖子中所述,这实际上是不可能的。您的应用程序甚至可以在它开始运行之前进行修补。你怎么可能防止这种情况发生?

标签: ios objective-c iphone xcode jailbreak


【解决方案1】:
  • 快速越狱检查:

    static func isJailbroken() -> Bool {
    
    guard let cydiaUrlScheme = NSURL(string: "cydia://package/com.example.package") else { return false }
    if UIApplication.shared.canOpenURL(cydiaUrlScheme as URL) {
        return false
    }
    
    #if arch(i386) || arch(x86_64)
        // This is a Simulator not an idevice
        return false
    #endif
    let fileManager = FileManager.default
    if fileManager.fileExists(atPath: "/Applications/Cydia.app") ||
        fileManager.fileExists(atPath: "/Library/MobileSubstrate/MobileSubstrate.dylib") ||
        fileManager.fileExists(atPath: "/bin/bash") ||
        fileManager.fileExists(atPath: "/usr/sbin/sshd") ||
        fileManager.fileExists(atPath: "/etc/apt") ||
        fileManager.fileExists(atPath: "/usr/bin/ssh") ||
        fileManager.fileExists(atPath: "/private/var/lib/apt") {
        return true
    }
    if canOpen(path: "/Applications/Cydia.app") ||
        canOpen(path: "/Library/MobileSubstrate/MobileSubstrate.dylib") ||
        canOpen(path: "/bin/bash") ||
        canOpen(path: "/usr/sbin/sshd") ||
        canOpen(path: "/etc/apt") ||
        canOpen(path: "/usr/bin/ssh") {
        return true
    }
    let path = "/private/" + NSUUID().uuidString
    do {
        try "anyString".write(toFile: path, atomically: true, encoding: String.Encoding.utf8)
        try fileManager.removeItem(atPath: path)
        return true
    } catch {
        return false
    }
    }
    
    static func canOpen(path: String) -> Bool {
        let file = fopen(path, "r")
        guard file != nil else { return false }
        fclose(file)
        return true
    }
    

【讨论】:

    猜你喜欢
    • 2012-03-28
    • 2012-03-27
    • 2013-12-11
    • 1970-01-01
    • 2019-02-25
    • 1970-01-01
    • 2014-01-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多