_spoof.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. const mcc = "310"
  2. const mnc = "999"
  3. const simOperator = "310999"
  4. const networkOperator = "310999"
  5. const simSerialNumber = "35833137600635493160"
  6. const iccId = "35833137600635493160"
  7. const number = "4782426591"
  8. const imei = "357923049200019"
  9. const imsi = "310999996203622"
  10. const countryIso = "us"
  11. const subId = "57"
  12. class Log {
  13. static TAG = "[SMS]"
  14. static Debug = false
  15. static format(...msg) {
  16. let m = []
  17. for (let i = 0; i < msg.length; i++) {
  18. if (typeof msg[i] === "object") {
  19. m.push(JSON.stringify(msg[i]))
  20. } else {
  21. m.push(msg[i])
  22. }
  23. }
  24. m = m.join(" ")
  25. return m
  26. }
  27. static i(...msg) {
  28. if (!this.Debug) return
  29. console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  30. }
  31. static w(...msg) {
  32. console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  33. }
  34. static e(...msg) {
  35. console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  36. }
  37. static s(...msg) {
  38. console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  39. }
  40. }
  41. setImmediate(() => {
  42. Java.perform(function () {
  43. const SmsManager = Java.use("android.telephony.SmsManager")
  44. SmsManager.getSmsManagerForSubscriptionId.overload(
  45. "int"
  46. ).implementation = function (i) {
  47. const _smsManager = this.getSmsManagerForSubscriptionId(i)
  48. Log.i(`SmsManager.getSmsManagerForSubscriptionId: ${i}`)
  49. return _smsManager
  50. }
  51. SmsManager.getDefault.overload().implementation = function () {
  52. const _smsManager = this.getDefault(i)
  53. Log.i(`SmsManager.getDefault`)
  54. return _smsManager
  55. }
  56. SmsManager.getDefaultSmsSubscriptionId.overload().implementation =
  57. function () {
  58. const _subId = this.getDefaultSmsSubscriptionId()
  59. Log.i(
  60. `spoof SmsManager.getDefaultSmsSubscriptionId: ${_subId} -> ${subId}`
  61. )
  62. return parseInt(subId)
  63. }
  64. SmsManager.getSubscriptionId.overload().implementation = function () {
  65. const _subId = this.getSubscriptionId()
  66. Log.i(`SmsManager.getSubscriptionId: ${_subId} -> ${subId}`)
  67. return parseInt(subId)
  68. }
  69. SmsManager.getCarrierConfigValues.overload().implementation =
  70. function () {
  71. const _config = this.getCarrierConfigValues()
  72. Log.i(`SmsManager.getCarrierConfigValues: ${_config}`)
  73. return _config
  74. }
  75. const CarrierConfigManager = Java.use(
  76. "android.telephony.CarrierConfigManager"
  77. )
  78. CarrierConfigManager.getConfigForSubId.overload("int").implementation =
  79. function (i) {
  80. const _config = this.getConfigForSubId(i)
  81. Log.i(`CarrierConfigManager.getConfigForSubId: ${i}`)
  82. return _config
  83. }
  84. const SubscriptionManager = Java.use(
  85. "android.telephony.SubscriptionManager"
  86. )
  87. SubscriptionManager.getActiveSubscriptionInfoCount.overload().implementation =
  88. function () {
  89. const _count = this.getActiveSubscriptionInfoCount()
  90. Log.i(
  91. `SubscriptionManager.getActiveSubscriptionInfoCount: ${_count}`
  92. )
  93. return _count
  94. }
  95. SubscriptionManager.getDefaultSubscriptionId.overload().implementation =
  96. function () {
  97. const _subId = this.getDefaultSubscriptionId()
  98. Log.i(
  99. `spoof SubscriptionManager.getDefaultSubscriptionId: ${_subId} -> ${subId}`
  100. )
  101. return parseInt(subId)
  102. }
  103. SubscriptionManager.getDefaultSmsSubscriptionId.overload().implementation =
  104. function () {
  105. const _subId = this.getDefaultSmsSubscriptionId()
  106. Log.i(
  107. `spoof SubscriptionManager.getDefaultSmsSubscriptionId: ${_subId} -> ${subId}`
  108. )
  109. return parseInt(subId)
  110. }
  111. SubscriptionManager.getDefaultVoiceSubscriptionId.overload().implementation =
  112. function () {
  113. const _subId = this.getDefaultVoiceSubscriptionId()
  114. Log.i(
  115. `spoof SubscriptionManager.getDefaultVoiceSubscriptionId: ${_subId} -> ${subId}`
  116. )
  117. return parseInt(subId)
  118. }
  119. SubscriptionManager.getActiveDataSubscriptionId.overload().implementation =
  120. function () {
  121. const _subId = this.getActiveDataSubscriptionId()
  122. Log.i(
  123. `spoof SubscriptionManager.getActiveDataSubscriptionId: ${_subId} -> ${subId}`
  124. )
  125. return parseInt(subId)
  126. }
  127. SubscriptionManager.getSlotIndex.overload("int").implementation =
  128. function (i) {
  129. const _slotIndex = this.getSlotIndex(i)
  130. Log.i(
  131. `spoof SubscriptionManager.getSlotIndex: ${_slotIndex} -> 0`
  132. )
  133. return 0
  134. }
  135. SubscriptionManager.isUsableSubscriptionId.overload(
  136. "int"
  137. ).implementation = function (i) {
  138. const _isUsable = this.isUsableSubscriptionId(i)
  139. Log.i(`SubscriptionManager.isUsableSubscriptionId: ${_isUsable}`)
  140. return _isUsable
  141. }
  142. SubscriptionManager.isValidSubscriptionId.overload(
  143. "int"
  144. ).implementation = function (i) {
  145. const _isValid = this.isValidSubscriptionId(i)
  146. Log.i(
  147. `spoof SubscriptionManager.isValidSubscriptionId(${i}): ${_isValid} -> true`
  148. )
  149. return true
  150. }
  151. SubscriptionManager.getPhoneNumber.overload("int").implementation =
  152. function (i) {
  153. Log.i(
  154. `spoof SubscriptionManager.getPhoneNumber(${i}): -> ${number}`
  155. )
  156. return number
  157. }
  158. SubscriptionManager.getPhoneNumber.overload(
  159. "int",
  160. "int"
  161. ).implementation = function (i, i2) {
  162. Log.i(
  163. `spoof SubscriptionManager.getPhoneNumber(${i},${i2}): -> ${number}`
  164. )
  165. return number
  166. }
  167. SubscriptionManager.getActiveSubscriptionInfoList.overload().implementation =
  168. function () {
  169. const _list = this.getActiveSubscriptionInfoList()
  170. Log.i(
  171. `SubscriptionManager.getActiveSubscriptionInfoList ${_list.size()}`
  172. )
  173. return _list
  174. }
  175. SubscriptionManager.getActiveSubscriptionIdList.overload().implementation =
  176. function () {
  177. const _list = this.getActiveSubscriptionIdList()
  178. Log.i(
  179. `spoof SubscriptionManager.getActiveSubscriptionIdList ${_list} -> ${subId}`
  180. )
  181. return [parseInt(subId)]
  182. }
  183. SubscriptionManager.getActiveSubscriptionInfo.overload(
  184. "int"
  185. ).implementation = function (i) {
  186. const _info = this.getActiveSubscriptionInfo(i)
  187. const simCount = this.getActiveSubscriptionInfoCountMax()
  188. let subInfo = null
  189. try {
  190. for (let i = 0; i < simCount; i++) {
  191. subInfo = this.getActiveSubscriptionInfoForSimSlotIndex(i)
  192. if (subInfo) {
  193. break
  194. }
  195. }
  196. Log.i(
  197. `spoof SubscriptionManager.getActiveSubscriptionInfo(${i})`
  198. )
  199. } catch (error) {
  200. console.error(
  201. `spoof error SubscriptionManager.getActiveSubscriptionInfo(${i})`
  202. )
  203. error.printStackTrace()
  204. }
  205. return subInfo
  206. }
  207. SubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex.overload(
  208. "int"
  209. ).implementation = function (i) {
  210. const _info = this.getActiveSubscriptionInfoForSimSlotIndex(i)
  211. Log.i(
  212. `SubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(${i}): ${
  213. _info ? "ok" : "null"
  214. }`
  215. )
  216. return _info
  217. }
  218. SubscriptionManager.isActiveSubscriptionId.overload(
  219. "int"
  220. ).implementation = function (i) {
  221. const _isActive = this.isActiveSubscriptionId(i)
  222. Log.i(
  223. `spoof SubscriptionManager.isActiveSubscriptionId(${i}): ${_isActive} -> true`
  224. )
  225. return true
  226. }
  227. const SubscriptionInfo = Java.use("android.telephony.SubscriptionInfo")
  228. SubscriptionInfo.getMcc.overload().implementation = function () {
  229. const _mcc = this.getMcc()
  230. Log.i(`spoof SubscriptionInfo.getMcc: ${_mcc} -> ${mcc}`)
  231. return parseInt(mcc)
  232. }
  233. SubscriptionInfo.getMnc.overload().implementation = function () {
  234. const _mnc = this.getMnc()
  235. Log.i(`spoof SubscriptionInfo.getMnc: ${_mnc} -> ${mnc}`)
  236. return parseInt(mnc)
  237. }
  238. SubscriptionInfo.getMccString.overload().implementation = function () {
  239. const _mccString = this.getMccString()
  240. Log.i(
  241. `spoof SubscriptionInfo.getMccString: ${_mccString} -> ${mcc}`
  242. )
  243. return mcc
  244. }
  245. SubscriptionInfo.getMncString.overload().implementation = function () {
  246. const _mncString = this.getMncString()
  247. Log.i(
  248. `spoof SubscriptionInfo.getMncString: ${_mncString} -> ${mnc}`
  249. )
  250. return mnc
  251. }
  252. SubscriptionInfo.getNumber.overload().implementation = function () {
  253. const _number = this.getNumber()
  254. Log.i(`spoof SubscriptionInfo.getNumber: ${_number} -> ${number}`)
  255. return number
  256. }
  257. SubscriptionInfo.getIccId.overload().implementation = function () {
  258. const _iccId = this.getIccId()
  259. Log.i(`spoof SubscriptionInfo.getIccId: ${_iccId} -> ${iccId}`)
  260. return iccId
  261. }
  262. SubscriptionInfo.getCountryIso.overload().implementation = function () {
  263. const _countryIso = this.getCountryIso()
  264. Log.i(
  265. `spoof SubscriptionInfo.getCountryIso: ${_countryIso} -> ${countryIso}`
  266. )
  267. return countryIso
  268. }
  269. SubscriptionInfo.getSubscriptionId.overload().implementation =
  270. function () {
  271. const _subId = this.getSubscriptionId()
  272. if (!subId) {
  273. Log.i(_subId)
  274. return _subId
  275. }
  276. Log.i(
  277. `spoof SubscriptionInfo.getSubscriptionId: ${_subId} -> ${subId}`
  278. )
  279. return parseInt(subId)
  280. }
  281. const TelephonyManager = Java.use("android.telephony.TelephonyManager")
  282. TelephonyManager.createForSubscriptionId.overload(
  283. "int"
  284. ).implementation = function (i) {
  285. Log.i(`spoof TelephonyManager.createForSubscriptionId: ${i}`)
  286. return this
  287. }
  288. TelephonyManager.getLine1Number.overload().implementation =
  289. function () {
  290. const _number = this.getLine1Number()
  291. Log.i(
  292. `spoof TelephonyManager.getLine1Number: ${_number} -> ${number}`
  293. )
  294. return number
  295. }
  296. TelephonyManager.getSimOperator.overload().implementation =
  297. function () {
  298. const _simOperator = this.getSimOperator()
  299. Log.i(
  300. `spoof TelephonyManager.getSimOperator: ${_simOperator} -> ${simOperator}`
  301. )
  302. return simOperator
  303. }
  304. TelephonyManager.getNetworkOperator.overload().implementation =
  305. function () {
  306. const _networkOperator = this.getNetworkOperator()
  307. Log.i(
  308. `spoof TelephonyManager.getNetworkOperator: ${_networkOperator} -> ${networkOperator}`
  309. )
  310. return networkOperator
  311. }
  312. TelephonyManager.getSimSerialNumber.overload().implementation =
  313. function () {
  314. const _simSerialNumber = this.getSimSerialNumber()
  315. Log.i(
  316. `spoof TelephonyManager.getSimSerialNumber: ${_simSerialNumber} -> ${simSerialNumber}`
  317. )
  318. return simSerialNumber
  319. }
  320. TelephonyManager.getSubscriberId.overload().implementation =
  321. function () {
  322. const _imsi = this.getSubscriberId()
  323. Log.i(
  324. `spoof TelephonyManager.getSubscriberId: ${_imsi} -> ${imsi}`
  325. )
  326. return imsi
  327. }
  328. TelephonyManager.getImei.overload().implementation = function () {
  329. const _imei = this.getImei()
  330. Log.i(`spoof TelephonyManager.getImei: ${_imei} -> ${imei}`)
  331. return imei
  332. }
  333. TelephonyManager.getNetworkCountryIso.overload().implementation =
  334. function () {
  335. const _countryIso = this.getNetworkCountryIso()
  336. Log.i(
  337. `spoof TelephonyManager.getNetworkCountryIso: ${_countryIso} -> ${countryIso}`
  338. )
  339. return countryIso
  340. }
  341. TelephonyManager.getSimCountryIso.overload().implementation =
  342. function () {
  343. const _countryIso = this.getSimCountryIso()
  344. Log.i(
  345. `spoof TelephonyManager.getSimCountryIso: ${_countryIso} -> ${countryIso}`
  346. )
  347. return countryIso
  348. }
  349. TelephonyManager.getSubscriptionId.overload().implementation =
  350. function () {
  351. const _subId = this.getSubscriptionId()
  352. if (!subId) {
  353. Log.i(_subId)
  354. return _subId
  355. }
  356. Log.i(
  357. `spoof TelephonyManager.getSubscriptionId: ${_subId} -> ${subId}`
  358. )
  359. return parseInt(subId)
  360. }
  361. TelephonyManager.getSimState.overload().implementation = function () {
  362. const _simState = this.getSimState()
  363. Log.i(`spoof TelephonyManager.getSimState: ${_simState} -> 5`)
  364. return 5
  365. }
  366. const PhoneNumberVerification = Java.use(
  367. "com.google.android.gms.constellation.PhoneNumberVerification"
  368. )
  369. PhoneNumberVerification.$init.overload(
  370. "java.lang.String",
  371. "long",
  372. "int",
  373. "int",
  374. "java.lang.String",
  375. "android.os.Bundle",
  376. "int",
  377. "long"
  378. ).implementation = function (str, l, i, i2, str2, bundle, i3, l2) {
  379. Log.i("PhoneNumberVerification.$init")
  380. Log.i(
  381. `str: ${str}, l: ${l}, i: ${i}, i2: ${i2}, str2: ${str2}, i3: ${i3}, l2: ${l2}`
  382. )
  383. // print bundle
  384. if (bundle) {
  385. const keySet = bundle.keySet().toArray()
  386. for (let i = 0; i < keySet.length; i++) {
  387. const key = keySet[i]
  388. Log.i(`key: ${key}, value: ${bundle.get(key)}`)
  389. }
  390. }
  391. return this.$init(str, l, i, i2, str2, bundle, i3, l2)
  392. }
  393. // const aays = Java.use("aays")
  394. // aays.d.overload("int", "boolean").implementation = function (i, z) {
  395. // Log.i("aays.d", i, z, Object.keys(this.f.value))
  396. // return number
  397. // }
  398. const SetAsterismConsentRequest = Java.use(
  399. "com.google.android.gms.asterism.SetAsterismConsentRequest"
  400. )
  401. SetAsterismConsentRequest.$init.overload(
  402. "int",
  403. "int",
  404. "int",
  405. "[I",
  406. "java.lang.Long",
  407. "int",
  408. "android.os.Bundle",
  409. "int",
  410. "java.lang.String",
  411. "java.lang.String",
  412. "java.lang.String",
  413. "java.lang.String",
  414. "java.lang.String",
  415. "java.lang.String",
  416. "java.lang.String",
  417. "java.lang.String"
  418. ).implementation = function (
  419. i,
  420. i2,
  421. i3,
  422. iArr,
  423. l,
  424. i4,
  425. bundle,
  426. i5,
  427. str,
  428. str2,
  429. str3,
  430. str4,
  431. str5,
  432. str6,
  433. str7,
  434. str8
  435. ) {
  436. Log.i(
  437. Java.use("android.util.Log").getStackTraceString(
  438. Java.use("java.lang.Throwable").$new()
  439. )
  440. )
  441. Log.i("SetAsterismConsentRequest.$init")
  442. Log.i(
  443. `i: ${i}, i2: ${i2}, i3: ${i3}, iArr: ${iArr}, l: ${l}, i4: ${i4}, i5: ${i5}, str: ${str}, str2: ${str2}, str3: ${str3}, str4: ${str4}, str5: ${str5}, str6: ${str6}, str7: ${str7}, str8: ${str8}`
  444. )
  445. // print bundle
  446. const keySet = bundle.keySet().toArray()
  447. for (let i = 0; i < keySet.length; i++) {
  448. const key = keySet[i]
  449. Log.i(`key: ${key}, value: ${bundle.get(key)}`)
  450. }
  451. return this.$init(
  452. i,
  453. i2,
  454. i3,
  455. iArr,
  456. l,
  457. i4,
  458. bundle,
  459. i5,
  460. str,
  461. str2,
  462. str3,
  463. str4,
  464. str5,
  465. str6,
  466. str7,
  467. str8
  468. )
  469. }
  470. const SetAsterismConsentResponse = Java.use(
  471. "com.google.android.gms.asterism.SetAsterismConsentResponse"
  472. )
  473. SetAsterismConsentResponse.$init.overload(
  474. "int",
  475. "java.lang.String",
  476. "java.lang.String"
  477. ).implementation = function (i, str, str2) {
  478. Log.i(
  479. Java.use("android.util.Log").getStackTraceString(
  480. Java.use("java.lang.Throwable").$new()
  481. )
  482. )
  483. Log.i("SetAsterismConsentResponse.$init")
  484. Log.i(`i: ${i}, str: ${str}, str2: ${str2}`)
  485. // return this.$init(
  486. // 1,
  487. // "c4q5zP5Ft4A:APA91bEASr50HwwOY789LSZrcHPT8aG_fT19xlelS35qgIJeC3UBYypAHmmL9IygzlphzTKKz0wCdiQwuoPZMJKvgKPmGi3_imdr1CY0s7fs8qa_LMgNDFfvWEnpTCReAYc7IjThhFQq",
  488. // "c4q5zP5Ft4A"
  489. // )
  490. return this.$init(i, str, str2)
  491. }
  492. // spoof sim to exist
  493. const bjsf = Java.use("bjsf")
  494. bjsf.s.overload("android.content.Context").implementation = function (
  495. c
  496. ) {
  497. Log.i("bjsf.s spoof sim to exist")
  498. return true
  499. }
  500. })
  501. })