|
|
@@ -0,0 +1,110 @@
|
|
|
+function trace(tag) {
|
|
|
+ Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
|
|
|
+}
|
|
|
+
|
|
|
+class Log {
|
|
|
+ static TAG = '[DG]'
|
|
|
+ static Debug = true
|
|
|
+ static format(...msg) {
|
|
|
+ let m = []
|
|
|
+ for (let i = 0; i < msg.length; i++) {
|
|
|
+ if (typeof msg[i] === 'object') {
|
|
|
+ m.push(msg[i] + '')
|
|
|
+ } else {
|
|
|
+ m.push(msg[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m = m.join(' ')
|
|
|
+ return m
|
|
|
+ }
|
|
|
+ static i(...msg) {
|
|
|
+ if (!this.Debug) return
|
|
|
+ console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
+ }
|
|
|
+ static w(...msg) {
|
|
|
+ console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
+ }
|
|
|
+ static e(...msg) {
|
|
|
+ console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
+ }
|
|
|
+ static s(...msg) {
|
|
|
+ console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+Java.perform(function () {
|
|
|
+ const classLoaders = Java.enumerateClassLoadersSync()
|
|
|
+ for (let i of classLoaders) {
|
|
|
+ Log.i(i)
|
|
|
+ if (i.toString().includes('app_dg_cache')) {
|
|
|
+ Log.s('Found DroidGuard ClassLoader:', i)
|
|
|
+ Java.classFactory.loader = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const DroidGuard = Java.use('com.google.ccc.abuse.droidguard.DroidGuard')
|
|
|
+ Log.i('DroidGuard:', DroidGuard)
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B')
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object')
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object', 'android.os.Bundle')
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object', 'boolean')
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object', 'android.os.Bundle', 'int')
|
|
|
+ // .overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object', 'boolean', 'android.os.Bundle')
|
|
|
+ DroidGuard.$init.overload('android.content.Context', 'java.lang.String', '[B').implementation = function (
|
|
|
+ context,
|
|
|
+ str,
|
|
|
+ bytes
|
|
|
+ ) {
|
|
|
+ Log.s('DroidGuard.$init1', str)
|
|
|
+ return this.$init(context, str, bytes)
|
|
|
+ }
|
|
|
+ DroidGuard.$init.overload('android.content.Context', 'java.lang.String', '[B', 'java.lang.Object').implementation =
|
|
|
+ function (context, str, bytes, obj) {
|
|
|
+ Log.s('DroidGuard.$init2', str, obj)
|
|
|
+ return this.$init(context, str, bytes, obj)
|
|
|
+ }
|
|
|
+ DroidGuard.$init.overload(
|
|
|
+ 'android.content.Context',
|
|
|
+ 'java.lang.String',
|
|
|
+ '[B',
|
|
|
+ 'java.lang.Object',
|
|
|
+ 'android.os.Bundle'
|
|
|
+ ).implementation = function (context, str, bytes, obj, bundle) {
|
|
|
+ Log.s('DroidGuard.$init3', str, obj, bundle)
|
|
|
+ for(let k of Object.keys(obj)){
|
|
|
+ Log.s('obj', k, obj[k])
|
|
|
+ }
|
|
|
+ return this.$init(context, str, bytes, obj, bundle)
|
|
|
+ }
|
|
|
+ DroidGuard.$init.overload(
|
|
|
+ 'android.content.Context',
|
|
|
+ 'java.lang.String',
|
|
|
+ '[B',
|
|
|
+ 'java.lang.Object',
|
|
|
+ 'boolean'
|
|
|
+ ).implementation = function (context, str, bytes, obj, bool) {
|
|
|
+ Log.s('DroidGuard.$init4', str, obj, bool)
|
|
|
+ return this.$init(context, str, bytes, obj, bool)
|
|
|
+ }
|
|
|
+ DroidGuard.$init.overload(
|
|
|
+ 'android.content.Context',
|
|
|
+ 'java.lang.String',
|
|
|
+ '[B',
|
|
|
+ 'java.lang.Object',
|
|
|
+ 'android.os.Bundle',
|
|
|
+ 'int'
|
|
|
+ ).implementation = function (context, str, bytes, obj, bundle, int) {
|
|
|
+ Log.s('DroidGuard.$init5', str, obj, bundle, int)
|
|
|
+ return this.$init(context, str, bytes, obj, bundle, int)
|
|
|
+ }
|
|
|
+ DroidGuard.$init.overload(
|
|
|
+ 'android.content.Context',
|
|
|
+ 'java.lang.String',
|
|
|
+ '[B',
|
|
|
+ 'java.lang.Object',
|
|
|
+ 'boolean',
|
|
|
+ 'android.os.Bundle'
|
|
|
+ ).implementation = function (context, str, bytes, obj, bool, bundle) {
|
|
|
+ Log.s('DroidGuard.$init6', str, obj, bool, bundle)
|
|
|
+ return this.$init(context, str, bytes, obj, bool, bundle)
|
|
|
+ }
|
|
|
+})
|