|
7 | 7 | // |
8 | 8 |
|
9 | 9 | import Foundation |
10 | | -import UIKit |
| 10 | +import class UIKit.UIApplication |
11 | 11 |
|
12 | 12 | public final class BrightSide { |
13 | 13 |
|
@@ -44,30 +44,74 @@ public final class BrightSide { |
44 | 44 |
|
45 | 45 | private extension BrightSide { |
46 | 46 |
|
47 | | - /// Method will return true, if any of the files typical for the jailbreak exists |
48 | | - private static func isJailbreakDirectoriesExist() -> Bool { |
49 | | - let jailbreakDirectories = [ |
50 | | - "/Applications/Cydia.app", |
51 | | - "/Library/MobileSubstrate/MobileSubstrate.dylib", |
52 | | - "/bin/bash", |
53 | | - "/usr/sbin/sshd", |
54 | | - "/etc/apt", |
55 | | - "/private/var/lib/apt/" |
56 | | - ] |
57 | | - return jailbreakDirectories.map { FileManager.default.fileExists(atPath: $0) }.reduce(false, { $0 || $1 }) |
| 47 | + /// Method will return true, if any of the files or dir, typical for the jailbreak, exists |
| 48 | + static func isJailbreakDirectoriesExist() -> Bool { |
| 49 | + let jailbreakRelativelyFilesAndPaths = suspiciousSystemFiles |
| 50 | + + suspiciousAppsDir |
| 51 | + + suspiciousSystemDir |
| 52 | + return jailbreakRelativelyFilesAndPaths |
| 53 | + .allSatisfy(FileManager.default.fileExists(atPath:)) |
58 | 54 | } |
59 | 55 |
|
60 | 56 | /// Method will return true if we can open cydia package |
61 | | - private static func canOpenCydia() -> Bool { |
| 57 | + static func canOpenCydia() -> Bool { |
62 | 58 | guard let cydiaURL = URL(string: "cydia://package/com.example.package") else { |
63 | 59 | return false |
64 | 60 | } |
65 | 61 | return UIApplication.shared.canOpenURL(cydiaURL) |
66 | 62 | } |
67 | 63 |
|
68 | 64 | /// Method will return true if current device is simulator |
69 | | - private static func isSimulator() -> Bool { |
| 65 | + static func isSimulator() -> Bool { |
70 | 66 | return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil |
71 | 67 | } |
72 | 68 |
|
73 | 69 | } |
| 70 | + |
| 71 | +// MARK: - Suspicious dir |
| 72 | + |
| 73 | +extension BrightSide { |
| 74 | + |
| 75 | + static var suspiciousAppsDir: [String] { |
| 76 | + return [ |
| 77 | + "/Applications/Cydia.app", |
| 78 | + "/Applications/blackra1n.app", |
| 79 | + "/Applications/checkra1n.app", |
| 80 | + "/Applications/Zeon.app", |
| 81 | + "/Applications/FakeCarrier.app", |
| 82 | + "/Applications/Icy.app", |
| 83 | + "/Applications/IntelliScreen.app", |
| 84 | + "/Applications/MxTube.app", |
| 85 | + "/Applications/RockApp.app", |
| 86 | + "/Applications/SBSettings.app", |
| 87 | + "/Applications/WinterBoard.app" |
| 88 | + ] |
| 89 | + } |
| 90 | + |
| 91 | + static var suspiciousSystemDir: [String] { |
| 92 | + return [ |
| 93 | + "/private/var/lib/apt", |
| 94 | + "/private/var/lib/apt/", |
| 95 | + "/private/var/lib/cydia", |
| 96 | + "/private/var/mobile/Library/SBSettings/Themes", |
| 97 | + "/private/var/stash", |
| 98 | + "/usr/bin/sshd", |
| 99 | + "/usr/libexec/sftp-server", |
| 100 | + "/usr/sbin/sshd", |
| 101 | + "/etc/apt", |
| 102 | + "/bin/bash" |
| 103 | + ] |
| 104 | + } |
| 105 | + |
| 106 | + static var suspiciousSystemFiles: [String] { |
| 107 | + return [ |
| 108 | + "/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist", |
| 109 | + "/Library/MobileSubstrate/DynamicLibraries/Veency.plist", |
| 110 | + "/private/var/tmp/cydia.log", |
| 111 | + "/System/Library/LaunchDaemons/com.ikey.bbot.plist", |
| 112 | + "/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist", |
| 113 | + "/Library/MobileSubstrate/MobileSubstrate.dylib" |
| 114 | + ] |
| 115 | + } |
| 116 | + |
| 117 | +} |
0 commit comments