cell.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 = '[Cell]'
  6. static Debug = true
  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 classLoaders = Java.enumerateClassLoadersSync()
  35. for (let i of classLoaders) {
  36. if (i.toString().includes('TeleService.apk')) {
  37. Java.classFactory.loader = i
  38. break
  39. }
  40. }
  41. const PhoneInterfaceManager = Java.use('com.android.phone.PhoneInterfaceManager')
  42. PhoneInterfaceManager.getAllCellInfo.overload('java.lang.String', 'java.lang.String').implementation = function (
  43. arg1,
  44. arg2
  45. ) {
  46. Log.i(`getAllCellInfo(${arg1}, ${arg2})`)
  47. return this.getAllCellInfo(arg1, arg2)
  48. }
  49. PhoneInterfaceManager.getCallState.overload().implementation = function () {
  50. Log.i(`getCallState()`)
  51. return this.getCallState()
  52. }
  53. PhoneInterfaceManager.getCallStateForSubscription.overload(
  54. 'int',
  55. 'java.lang.String',
  56. 'java.lang.String'
  57. ).implementation = function (arg1, arg2, arg3) {
  58. Log.i(`getCallStateForSubscription(${arg1}, ${arg2}, ${arg3})`)
  59. return this.getCallStateForSubscription(arg1, arg2, arg3)
  60. }
  61. })