log_sms.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const mcc = '{{mcc}}'
  2. const mnc = '{{mnc}}'
  3. const simOperator = '{{simOperator}}'
  4. const networkOperator = '{{networkOperator}}'
  5. const simSerialNumber = '{{simSerialNumber}}'
  6. const iccId = '{{iccId}}'
  7. const number = '{{number}}'
  8. const imei = '{{imei}}'
  9. const imsi = '{{imsi}}'
  10. const countryIso = '{{countryIso}}'
  11. const subId = '{{subId}}'
  12. class Log {
  13. static TAG = '[SMS]'
  14. static Debug = true
  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. function trace(tag) {
  42. Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
  43. }
  44. setImmediate(() => {
  45. Java.perform(function () {
  46. const biyg = Java.use('biyg')
  47. biyg.al.overload('int').implementation = function (a) {
  48. const res = this.al(a)
  49. Log.w(`biyg.al(${a}) => ${res}`)
  50. if ('Config document received' === res) {
  51. trace('biyg.al')
  52. }
  53. return this.al(a)
  54. }
  55. })
  56. })