SecurityCheckManager.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // SecurityCheckManager.swift
  3. // Runner
  4. //
  5. // Created by FancyLou on 2023/9/1.
  6. //
  7. import Foundation
  8. class SecurityCheckManager {
  9. static let shared : SecurityCheckManager = {
  10. return SecurityCheckManager()
  11. }()
  12. private init() {}
  13. ///判断是否存在越狱的软件
  14. func isJailBroken() -> Bool {
  15. //判断设备上是否安装了这些程序
  16. let apps = ["/APPlications/Cydia.app",
  17. "/Library/MobileSubstrate/MobileSubstrate.dylib",
  18. "/bin/bash",
  19. "/usr/sbin/sshd",
  20. "/etc/apt",
  21. "/usr/bin/ssh",
  22. "/APPlications/limera1n.app",
  23. "/APPlications/greenpois0n.app",
  24. "/APPlications/blackra1n.app",
  25. "/APPlications/blacksn0w.app",
  26. "/APPlications/redsn0w.app",
  27. "/APPlications/Absinthe.app"]
  28. for app in apps {
  29. //通过文件管理器,判断在指定的目录下,是否在对应的应用程序。如果存在的话。就表示当前设备为越狱设备。
  30. if FileManager.default.fileExists(atPath: app){
  31. return true
  32. }
  33. }
  34. return false
  35. }
  36. }