spoof_phone3.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. class Log {
  2. static TAG = '[Phone]'
  3. static Debug = true
  4. static format(...msg) {
  5. let m = []
  6. for (let i = 0; i < msg.length; i++) {
  7. if (typeof msg[i] === 'object') {
  8. m.push(JSON.stringify(msg[i]))
  9. } else {
  10. m.push(msg[i])
  11. }
  12. }
  13. m = m.join(' ')
  14. return m
  15. }
  16. static i(...msg) {
  17. if (!this.Debug) return
  18. console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  19. }
  20. static w(...msg) {
  21. console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  22. }
  23. static e(...msg) {
  24. console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  25. }
  26. static s(...msg) {
  27. console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
  28. }
  29. }
  30. function trace(tag) {
  31. Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
  32. }
  33. setImmediate(() => {
  34. Java.perform(function () {
  35. const SubscriptionController = Java.use('com.android.internal.telephony.SubscriptionController')
  36. SubscriptionController.getSubscriptionInfo.overload('int').implementation = function (slotIndex) {
  37. Log.e('getSubscriptionInfo()')
  38. return this.getSubscriptionInfo(slotIndex)
  39. }
  40. SubscriptionController.getActiveSubscriptionInfoList.overload(
  41. 'java.lang.String',
  42. 'java.lang.String'
  43. ).implementation = function (callingPackage, callingFeature) {
  44. Log.e(`getActiveSubscriptionInfoList(${callingPackage}, ${callingFeature})`)
  45. return this.getActiveSubscriptionInfoList(callingPackage, callingFeature)
  46. }
  47. const SubscriptionInfo = Java.use('android.telephony.SubscriptionInfo')
  48. SubscriptionInfo.getCarrierId.overload().implementation = function () {
  49. const carrierId = this.getCarrierId()
  50. Log.e(`getCarrierId()=${carrierId}`)
  51. return carrierId
  52. }
  53. SubscriptionInfo.getMccString.overload().implementation = function () {
  54. const mcc = this.getMccString()
  55. Log.e(`getMccString()=${mcc}`)
  56. return mcc
  57. }
  58. SubscriptionInfo.getMcc.overload().implementation = function () {
  59. const mcc = this.getMcc()
  60. Log.e(`getMcc()=${mcc}`)
  61. return mcc
  62. }
  63. const TelephoneyManager = Java.use('android.telephony.TelephonyManager')
  64. TelephoneyManager.getSimCarrierId.overload().implementation = function () {
  65. const carrierId = this.getSimCarrierId()
  66. Log.e(`getSimCarrierId()=${carrierId}`)
  67. return carrierId
  68. }
  69. })
  70. })