McareCrackCheck.swift 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //
  2. // McareCrackCheck.swift
  3. // MCareSwift
  4. //
  5. // Created by heesungkim on 2017. 2. 14..
  6. // Copyright © 2017년 idatabank. All rights reserved.
  7. //
  8. import Foundation
  9. import MCareFramework
  10. class TGfgWLPFSsedkMjVFwzECGIJlWLmXNHA {
  11. private let bundlePath:String = Bundle.main.bundlePath
  12. private var mcareLog:MCareLogger?
  13. public init(){
  14. mcareLog = MCareLogger.sharedInstance()
  15. }
  16. func RrSysWIEJNXJSjLdLYdkUhuSZCTsCzYc() -> String {
  17. var isCrack = false
  18. var result:String = ""
  19. if self.xFpMfiaKAJMDOeAxjLRgTogsUThgmSuV() {
  20. isCrack = true
  21. result = result.appending(", ").appending(McareConstants.CRACK_CODE_1002)
  22. }
  23. if self.emnbnWQtsROzpyBctpbxmXnFWVnYxWjK() {
  24. isCrack = true
  25. result = result.appending(", ").appending(McareConstants.CRACK_CODE_1003)
  26. }
  27. if self.oeylBwEWeIBxFIgKTodTecITfvuGKssm() {
  28. isCrack = true
  29. result = result.appending(", ").appending(McareConstants.CRACK_CODE_1004)
  30. }
  31. if self.EzfgObvemSSLKMuULiAFTLaLdNXhXTGf() {
  32. isCrack = true
  33. result = result.appending(", ").appending(McareConstants.CRACK_CODE_1005)
  34. }
  35. // if self.checkInfoFileDate() {
  36. // isCrack = true
  37. // result = result.appending(", ").appending(McareConstants.CRACK_CODE_1006)
  38. // }
  39. //
  40. // if self.checkAppNameDate() {
  41. // isCrack = true
  42. // result = result.appending(", ").appending(McareConstants.CRACK_CODE_1007)
  43. // }
  44. if isCrack {
  45. result = result.substring(from: result.index(result.startIndex, offsetBy: 2))
  46. }
  47. else {
  48. result = result.appending(McareConstants.CRACK_CODE_1001)
  49. }
  50. return result
  51. }
  52. func xFpMfiaKAJMDOeAxjLRgTogsUThgmSuV() -> Bool {
  53. let path:String = self.bundlePath.appending("/Info.plist")
  54. let fileInfo:NSDictionary = Bundle.main.infoDictionary! as NSDictionary
  55. let fileManager:FileManager = FileManager.default
  56. var fileAttr:NSDictionary!
  57. do {
  58. fileAttr = try fileManager.attributesOfItem(atPath: path) as NSDictionary
  59. } catch {
  60. mcareLog?.error(output:"")
  61. }
  62. if fileAttr != nil {
  63. let cSIDArr = ["Si", "gne", "rIde", "ntity"]
  64. let cSID:String = cSIDArr.joined()
  65. if fileInfo.value(forKey: cSID) != nil {
  66. return true
  67. }
  68. }
  69. return false
  70. }
  71. func emnbnWQtsROzpyBctpbxmXnFWVnYxWjK() -> Bool {
  72. let root:Int = Int(getpid())
  73. if root <= 10 {
  74. return true
  75. }
  76. return false
  77. }
  78. func oeylBwEWeIBxFIgKTodTecITfvuGKssm() -> Bool {
  79. let fileExists:Bool = FileManager.default.fileExists(atPath: bundlePath.appending("/_CodeSignature"))
  80. if !fileExists {
  81. return true
  82. }
  83. return false
  84. }
  85. func EzfgObvemSSLKMuULiAFTLaLdNXhXTGf() -> Bool {
  86. let fileExists:Bool = FileManager.default.fileExists(atPath: bundlePath.appending("/_CodeSignature/CodeResources"))
  87. if !fileExists {
  88. return true
  89. }
  90. return false
  91. }
  92. // func checkInfoFileDate() -> Bool {
  93. //
  94. // let infoPath:String = self.bundlePath.appending("/Info.plist")
  95. // var infoModifiedDate:Date? = nil
  96. // var pkgModifiedDate:Date? = nil
  97. // do {
  98. // infoModifiedDate = try FileManager.default.attributesOfItem(atPath: infoPath)[FileAttributeKey.modificationDate] as? Date
  99. // } catch {
  100. // mcareLog?.error(output: "infoModifiedDate Error")
  101. // }
  102. //
  103. // do {
  104. // pkgModifiedDate = try FileManager.default.attributesOfItem(atPath: (Bundle.main.resourcePath?.appending("/PkgInfo"))!)[FileAttributeKey.modificationDate] as? Date
  105. // } catch {
  106. // mcareLog?.error(output: "pkgModifiedDate Error")
  107. // }
  108. //
  109. // if fabs(infoModifiedDate!.timeIntervalSinceReferenceDate - pkgModifiedDate!.timeIntervalSinceReferenceDate) > 600 {
  110. // return true
  111. // }
  112. //
  113. // return true
  114. // }
  115. //
  116. // func checkAppNameDate() -> Bool {
  117. // let infoPath:String = self.bundlePath.appending("/mcare-pnuh")
  118. // mcareLog?.error(output: infoPath)
  119. // var infoModifiedDate:Date? = nil
  120. // var pkgModifiedDate:Date? = nil
  121. //
  122. // do {
  123. // infoModifiedDate = try FileManager.default.attributesOfItem(atPath: infoPath)[FileAttributeKey.modificationDate] as? Date
  124. // } catch {
  125. // mcareLog?.error(output: "infoModifiedDate Error")
  126. // return false
  127. // }
  128. //
  129. // do {
  130. // pkgModifiedDate = try FileManager.default.attributesOfItem(atPath: (Bundle.main.resourcePath?.appending("/PkgInfo"))!)[FileAttributeKey.modificationDate] as? Date
  131. // } catch {
  132. // mcareLog?.error(output: "pkgModifiedDate Error")
  133. // return false
  134. // }
  135. //
  136. // if fabs(infoModifiedDate!.timeIntervalSinceReferenceDate - pkgModifiedDate!.timeIntervalSinceReferenceDate) > 600 {
  137. // return true
  138. // }
  139. //
  140. // return true
  141. // }
  142. }