【发布时间】: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。