【问题标题】:Jailbreak detection mechanism not detecting jailbreak device越狱检测机制未检测到越狱设备
【发布时间】:2020-10-23 00:53:26
【问题描述】:

在我的应用中,我想检测设备是否越狱。如果已越狱,则不应允许用户使用该应用程序。我添加了一个功能来检测但它不检测越狱设备

附上代码供参考

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
    }
}

在 Appdelegate.m (Obj c)中

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

【问题讨论】:

  • JailbrokenDetector 来自哪里?你为什么要在 AppDelegate 中用 Objective-C 编写代码?
  • JailbrokenDetector 是一个辅助类(在 Swift 中),项目在 Obj c 中
  • 你从哪里得到的代码?是什么让您认为它会检测到越狱?为什么要首先防止越狱设备?
  • 而“不能可靠地完成”这个答案还不够?
  • 不要这样做——这是一场失败的战斗,你在浪费时间。我在这种情况下,银行申请,他们坚持越狱检测。我不得不这样做,但它太不可靠了,以至于我今天不再接受客户的这种要求。如果有人想使用这个应用程序,他们可以轻松地强制你的isJailBroked 函数返回false。此外,这个exit(0) 肯定不会通过 App Review。

标签: ios swift jailbreak cydia


【解决方案1】:

从 iOS 14 开始,应用程序无法在其自己的包之外进行这些 fs 检查,因此上述方法将不起作用。

另外,越狱检测是不值得的,这个检查最多只能用 6 行来修补,这是一场失败的战斗,人们需要停止战斗。

【讨论】:

  • 那么有什么选择呢?让应用程序在所有设备上运行,包括那些越狱设备?
猜你喜欢
  • 2014-01-12
  • 1970-01-01
  • 2012-09-02
  • 2021-07-17
  • 2018-03-08
  • 2019-01-24
  • 1970-01-01
  • 1970-01-01
  • 2012-12-24
相关资源
最近更新 更多