An unified product for check many topics about integrity & security.
[Add the Swift Package to your project from url: https://github.com/CodeNationDev/IntegritySwift.git
This product has been developd as class type with @objc flags for allow the usage from swift and ObjC.
@objc public static var isSecure: Bool
When you request the value of this variable, the result (true/false) is generated besed on all security checks passed in that moment.
@objc public static var globalControlsResults: [SecurityResult]
This object return an array with the object (defined at models file) that contains the results of all checks evaluated, and it have following structure:
@objc public enum SecurityControlType: Int {
case jailbreak = 0
case simulator = 1
case debugger = 2
case reverse = 3
}
@objc public class SecurityResult: NSObject {
@objc public var passed: Bool = true
@objc public var reason: String = ""
@objc public var type: SecurityControlType
@objc public init(_ passed: Bool, _ reason: String, _ type: SecurityControlType) {
self.passed = passed
self.reason = reason
self.type = type
}
}
Also, you can request the state of any individual check of all available.
Global Jailbreak passchecks
@objc public static var isDeviceJailbroken: Bool
The object array with check results.
@objc public static var jailbreakControlsResults: [SecurityResult]
Sandbox violation passcheck. Check existence of files that are common for jailbroken devices
@objc public static func jailbreakSuspiciousFilesCheck() -> SecurityResult
If we can execute a Cyda urlScheme, the device is jailbroken
@objc public static func jailbreakUrlSchemes() -> SecurityResult
This check looks for the exist of suspicious dylibs.
@objc public static func jailbreakDYLD() -> SecurityResult
This check detects a forked proccess.
public static func jailbreakFork() -> SecurityResult
Global Debugger state passchecks
@objc public static func amIDebugged() -> SecurityResult
Function for deny debug mode
@objc public static func denyDebugger()
Global checks for Reverse Engineering
@objc public static func amIReverseEngineered() -> Bool
The object array with check results.
public static var antiReverseControlsResults: [SecurityResult]
Checks for suspicious libraries.
public static func checkDYLD() -> SecurityResult
Check suspicious files
public static func checkExistenceOfSuspiciousFiles() -> SecurityResult
Check opened ports
public static func checkOpenedPorts() -> SecurityResult
Check if we can open a local connection in a specific port.
public static func canOpenLocalConnection(port: Int) -> SecurityResult
Global check for simulatoir discoverer.
@objc public static func isRunningInSimulator() -> Bool
Simply get the isSecure value:
//
import UIKit
import IntegirtySwift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if !IntegrityManager.isSecure {
//do something if device device is not secure.
}
if !JailbreakDiscoverer.isDeviceJailbroken {
//do something if device jailbroken
}
if DebuggerDiscoverer.amIDebugged().passed {
//do something if the device is a simulator
}
return true
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (!SecurityManager.isSecure) {
//do something if device is not secure.
}
}
David Martin Saiz – @deividmarshall – davms81@gmail.com
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/CodeNationDev/
- 1.0.0
- First implementation with main features.