spoof_gms.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. function trace(tag) {
  2. Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
  3. }
  4. class Log {
  5. static TAG = '[GMS]'
  6. static Debug = false
  7. static format(...msg) {
  8. let m = []
  9. for (let i = 0; i < msg.length; i++) {
  10. if (typeof msg[i] === 'object') {
  11. m.push(msg[i] + '')
  12. } else {
  13. m.push(msg[i])
  14. }
  15. }
  16. m = m.join(' ')
  17. return m
  18. }
  19. static i(...msg) {
  20. if (!this.Debug) return
  21. console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  22. }
  23. static w(...msg) {
  24. console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  25. }
  26. static e(...msg) {
  27. console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  28. }
  29. static s(...msg) {
  30. console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  31. }
  32. }
  33. Java.perform(function () {
  34. const PhoneNumberVerification = Java.use('com.google.android.gms.constellation.PhoneNumberVerification')
  35. PhoneNumberVerification.$init.overload(
  36. 'java.lang.String',
  37. 'long',
  38. 'int',
  39. 'int',
  40. 'java.lang.String',
  41. 'android.os.Bundle',
  42. 'int',
  43. 'long'
  44. ).implementation = function (str, j, i, i2, str2, bundle, i3, l) {
  45. Log.e(`PhoneNumberVerification.$init(str=${str}, j=${j}, i=${i}, i2=${i2}, str2=${str2}, i3=${i3}, l=${l}`)
  46. // print bundle
  47. const keySet = bundle.keySet().toArray()
  48. for (let i = 0; i < keySet.length; i++) {
  49. const key = keySet[i]
  50. Log.i(`PhoneNumberVerification(key: ${key}, value: ${bundle.get(key)})`)
  51. }
  52. return this.$init(str, j, i, i2, str2, bundle, i3, l)
  53. }
  54. const VerifyPhoneNumberRequest = Java.use('com.google.android.gms.constellation.VerifyPhoneNumberRequest')
  55. VerifyPhoneNumberRequest.$init.overload(
  56. //String str, long j, IdTokenRequest idTokenRequest, Bundle bundle, List list, boolean z, int i, List list2
  57. 'java.lang.String',
  58. 'long',
  59. 'com.google.android.gms.constellation.IdTokenRequest',
  60. 'android.os.Bundle',
  61. 'java.util.List',
  62. 'boolean',
  63. 'int',
  64. 'java.util.List'
  65. ).implementation = function (str, j, idTokenRequest, bundle, list, z, i, list2) {
  66. Log.e(`VerifyPhoneNumberRequest.$init(
  67. str=${str}, j=${j}, idTokenRequest=${idTokenRequest}, bundle=${bundle}, list=${list}, z=${z}, i=${i}, list2=${list2})`)
  68. trace()
  69. // print bundle
  70. const keySet = bundle.keySet().toArray()
  71. for (let i = 0; i < keySet.length; i++) {
  72. const key = keySet[i]
  73. Log.i(`VerifyPhoneNumberRequest.Bundle(key=${key}, value=${bundle.get(key)})`)
  74. }
  75. return this.$init(str, j, idTokenRequest, bundle, list, z, i, list2)
  76. }
  77. const SetAsterismConsentRequest = Java.use('com.google.android.gms.asterism.SetAsterismConsentRequest')
  78. SetAsterismConsentRequest.$init.overload(
  79. 'int',
  80. 'int',
  81. 'int',
  82. '[I',
  83. 'java.lang.Long',
  84. 'int',
  85. 'android.os.Bundle',
  86. 'int',
  87. 'java.lang.String',
  88. 'java.lang.String',
  89. 'java.lang.String',
  90. 'java.lang.String',
  91. 'java.lang.String',
  92. 'java.lang.String',
  93. 'java.lang.String',
  94. 'java.lang.String',
  95. 'int'
  96. ).implementation = function (
  97. i,
  98. i2,
  99. i3,
  100. iArr,
  101. l,
  102. i4,
  103. bundle,
  104. i5,
  105. str,
  106. str2,
  107. str3,
  108. str4,
  109. str5,
  110. str6,
  111. str7,
  112. str8,
  113. i6
  114. ) {
  115. Log.i(
  116. `SetAsterismConsentRequest.$init(
  117. i=${i}, i2=${i2}, i3=${i3}, iArr=${iArr}, l=${l},
  118. i4=${i4}, bundle=${bundle}, i5=${i5}, str=${str},
  119. str2=${str2}, str3=${str3}, str4=${str4}, str5=${str5},
  120. str6=${str6}, str7=${str7}, str8=${str8}, i6=${i6})`
  121. )
  122. // print bundle
  123. const keySet = bundle.keySet().toArray()
  124. for (let i = 0; i < keySet.length; i++) {
  125. const key = keySet[i]
  126. Log.i(`SetAsterismConsentRequest.Bundle(key=${key}, value=${bundle.get(key)})`)
  127. }
  128. return this.$init(i, i2, i3, iArr, l, i4, bundle, i5, str, str2, str3, str4, str5, str6, str7, str8, i6)
  129. }
  130. const SetAsterismConsentResponse = Java.use('com.google.android.gms.asterism.SetAsterismConsentResponse')
  131. SetAsterismConsentResponse.$init.overload('int', 'java.lang.String', 'java.lang.String').implementation = function (
  132. i,
  133. str,
  134. str2
  135. ) {
  136. Log.i(`SetAsterismConsentResponse.$init(i=${i}, str=${str}, str2=${str2})`)
  137. return this.$init(i, str, str2)
  138. }
  139. const EventManager = Java.use('com.google.android.gms.constellation.EventManager')
  140. EventManager.onHandleIntent.overload('android.content.Intent').implementation = function (intent) {
  141. Log.i('EventManager.onHandleIntent(intent)')
  142. return this.onHandleIntent(intent)
  143. }
  144. })