SecurityCheckManager.swift 1.3 KB

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