SecurityKit 1.0.3

SecurityKit 1.0.3

Mehran Kamalifard 维护。



SecurityKit

Security Kit

Security Kit 是一个轻量级框架,有助于构建安全层

示例用法安装许可证

示例

要运行示例项目,请运行 pod try SecurityKit

特性

  • 检测越狱设备
  • 安全背景层
  • 检测已执行的反编译工具。
  • 检查设备是模拟器还是真实设备。
  • 检查 VPN 是否正在运行。
  • 屏幕截图保护。
  • 使用 XOR 数据加密算法将敏感字符串进行加密。

需求

语言 分支 Pod版本 Xcode版本 iOS版本
Swift 5.0 master >= 1.0.x Xcode 10+ iOS 12.0+

CocoaPods

CocoaPods是一个Cocoa项目的依赖管理器。你可以使用以下命令安装它

$ gem install cocoapods

使用CocoaPods将SecurityKit集成到你的Xcode项目中,请在你的Podfile中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'SecurityKit'
end

然后,运行以下命令

$ pod install

安装

CocoaPods

pod 'SecurityKit'

使用方法

越狱设备检测

import SecurityKit

if SecurityKit.isDeviceJailBroken() {
         // Do Something
}else{
        // Do Something
}

检查设备是否为模拟器

import SecurityKit

if SecurityKit.isDeviceSimulator() {
      // Do Something
}else{
     // Do Something
}

逆向工程工具

import SecurityKit

if SecurityKit.isRevereseEngineeringToolsExecuted() {
       // Do Something
}else{
      // Do Something
}

检查VPN运行

import SecurityKit

if SecurityKit.isVPNConnected() {
     // Do Something
}else{
     // Do Something
}

安全屏幕截图

import SecurityKit

override func viewDidLoad() {
   super.viewDidLoad()
   ScreenCaptureProtection.shared.makeProtection(for: self.view)
}

override func viewWillAppear(_ animated: Bool) {
  super.viewWillAppear(false)
  ScreenCaptureProtection.shared.removeScreenProtection(for: self.view)
  }

安全背景层

import SecurityKit

var window: UIWindow?

func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).

guard let image = UIImage(named: "Placeholder") else {return}
SecurityKit.createSecureScreenShot(window: window, image: image)
}
    
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.

SecurityKit.removeSecureScreenShot(window: &window)
}

异或字符串混淆

import SecurityKit

// String Encryption
let encrypt = SecurityKit.StringEncryption(plainText: "plainText", encryptionKey: "key")

// String Decryption
let decrypt = SecurityKit.StringDecryption(cypherText: encrypt, decryptionKey: key)

许可

SecurityKit 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。