spoof_phone3.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. })
  48. })