Skip to content

Commit

Permalink
Add new dir on check jailbreak
Browse files Browse the repository at this point in the history
  • Loading branch information
Stampoo committed Mar 19, 2022
1 parent 9380395 commit ed480c6
Showing 1 changed file with 58 additions and 14 deletions.
72 changes: 58 additions & 14 deletions Utils/Utils/BrightSide/BrightSide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import UIKit
import class UIKit.UIApplication

public final class BrightSide {

Expand Down Expand Up @@ -44,30 +44,74 @@ public final class BrightSide {

private extension BrightSide {

/// Method will return true, if any of the files typical for the jailbreak exists
private static func isJailbreakDirectoriesExist() -> Bool {
let jailbreakDirectories = [
"/Applications/Cydia.app",
"/Library/MobileSubstrate/MobileSubstrate.dylib",
"/bin/bash",
"/usr/sbin/sshd",
"/etc/apt",
"/private/var/lib/apt/"
]
return jailbreakDirectories.map { FileManager.default.fileExists(atPath: $0) }.reduce(false, { $0 || $1 })
/// Method will return true, if any of the files or dir, typical for the jailbreak, exists
static func isJailbreakDirectoriesExist() -> Bool {
let jailbreakRelativelyFilesAndPaths = suspiciousSystemFiles
+ suspiciousAppsDir
+ suspiciousSystemDir
return jailbreakRelativelyFilesAndPaths
.allSatisfy(FileManager.default.fileExists(atPath:))
}

/// Method will return true if we can open cydia package
private static func canOpenCydia() -> Bool {
static func canOpenCydia() -> Bool {
guard let cydiaURL = URL(string: "cydia://package/com.example.package") else {
return false
}
return UIApplication.shared.canOpenURL(cydiaURL)
}

/// Method will return true if current device is simulator
private static func isSimulator() -> Bool {
static func isSimulator() -> Bool {
return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil
}

}

// MARK: - Suspicious dir

extension BrightSide {

static var suspiciousAppsDir: [String] {
return [
"/Applications/Cydia.app",
"/Applications/blackra1n.app",
"/Applications/checkra1n.app",
"/Applications/Zeon.app",
"/Applications/FakeCarrier.app",
"/Applications/Icy.app",
"/Applications/IntelliScreen.app",
"/Applications/MxTube.app",
"/Applications/RockApp.app",
"/Applications/SBSettings.app",
"/Applications/WinterBoard.app"
]
}

static var suspiciousSystemDir: [String] {
return [
"/private/var/lib/apt",
"/private/var/lib/apt/",
"/private/var/lib/cydia",
"/private/var/mobile/Library/SBSettings/Themes",
"/private/var/stash",
"/usr/bin/sshd",
"/usr/libexec/sftp-server",
"/usr/sbin/sshd",
"/etc/apt",
"/bin/bash"
]
}

static var suspiciousSystemFiles: [String] {
return [
"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",
"/Library/MobileSubstrate/DynamicLibraries/Veency.plist",
"/private/var/tmp/cydia.log",
"/System/Library/LaunchDaemons/com.ikey.bbot.plist",
"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
"/Library/MobileSubstrate/MobileSubstrate.dylib"
]
}

}

0 comments on commit ed480c6

Please sign in to comment.