From 7be1947e67f416cfe17e1700dcd5308e25ce44e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E6=99=A8=E9=BE=99?= Date: Mon, 1 Aug 2022 19:20:16 +0800 Subject: [PATCH 1/2] add agentFile description for different parameters with the same function --- insight-agent/agent/index.ts | 312 +++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) diff --git a/insight-agent/agent/index.ts b/insight-agent/agent/index.ts index 44a94fe..0c9e3d3 100755 --- a/insight-agent/agent/index.ts +++ b/insight-agent/agent/index.ts @@ -332,6 +332,7 @@ Java.perform(() => { "java.lang.String" ).implementation = function (key: string, def: string) { const signature = `[android.os.SystemProperties get] key: ${key}, def: ${def}`; + send(signature); printStackTrace(getStackTrace()); InsightApi.getInstance().flush( @@ -348,6 +349,54 @@ Java.perform(() => { ContextImpl.sendBroadcast.overload("android.content.Intent").implementation = function (intent: any) { const signature = `[android.app.ContextImpl sendBroadcast] intent: ${intent}`; + const description = `发送系统广播:参数为intent`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.sendBroadcast(intent); + }; + + + ContextImpl.sendBroadcast.overload("android.content.Intent","java.lang.String").implementation = + function (intent: any,receiverPermission:any) { + const signature = `[android.app.ContextImpl sendBroadcast] intent: ${intent}`; + const description = `发送系统广播:参数为intent,receiverPermission`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.sendBroadcast(intent); + }; + + ContextImpl.sendBroadcast.overload("android.content.Intent","java.lang.String","android.os.Bundle").implementation = + function (intent: any,receiverPermission: any,options: any) { + const signature = `[android.app.ContextImpl sendBroadcast] intent: ${intent}`; + const description = `发送系统广播:参数为intent,receiverPermission,options`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.sendBroadcast(intent); + }; + + ContextImpl.sendBroadcast.overload("android.content.Intent","java.lang.String","int").implementation = + function (intent: any,receiverPermission:any,appOp:any) { + const signature = `[android.app.ContextImpl sendBroadcast] intent: ${intent}`; + const description = `发送系统广播:参数为intent,receiverPermission,appOp`; + send(description); send(signature); printStackTrace(getStackTrace()); InsightApi.getInstance().flush( @@ -539,6 +588,7 @@ Java.perform(() => { ); this.$init(); }; + LocationManager.requestLocationUpdates.overload( "java.lang.String", "long", @@ -553,6 +603,38 @@ Java.perform(() => { looper: any ) { const signature = `[android.location.LocationManager requestLocationUpdates] provider: ${provider}`; + const description = `获取本地位置信息更新:参数为provider,minTimeMs,minDistanceM,listener,looper`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + provider, + minTimeMs, + minDistanceM, + listener, + looper + ); + }; + + LocationManager.requestLocationUpdates.overload( + "java.lang.String", + "long", + "float", + "android.location.LocationListener" + ).implementation = function ( + provider: any, + minTimeMs: any, + minDistanceM: any, + listener: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] provider: ${provider}`; + const description = `获取本地位置信息更新:参数为provider,minTimeMs,minDistanceM,listener`; + send(description); send(signature); printStackTrace(getStackTrace()); InsightApi.getInstance().flush( @@ -564,11 +646,241 @@ Java.perform(() => { provider, minTimeMs, minDistanceM, + listener + ); + }; + + LocationManager.requestLocationUpdates.overload( + "android.location.LocationRequest", + "android.app.PendingIntent" + ).implementation = function ( + locationRequest: any, + pendingIntent: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] locationRequest: ${locationRequest}`; + const description = `获取本地位置信息更新: 参数为locationRequest,pendingIntent`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + locationRequest, + pendingIntent + ); + }; + + LocationManager.requestLocationUpdates.overload( + "android.location.LocationRequest", + "java.util.concurrent.Executor", + "android.location.LocationListener" + ).implementation = function ( + locationRequest: any, + executor: any, + listener: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] locationRequest: ${locationRequest}`; + const description = `获取本地位置信息更新: 参数为locationRequest,executor,listener`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + locationRequest, + executor, + listener + ); + }; + + LocationManager.requestLocationUpdates.overload( + "android.location.LocationRequest", + "android.location.LocationListener", + "android.os.Looper" + ).implementation = function ( + locationRequest: any, + listener: any, + looper: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] locationRequest: ${locationRequest}`; + const description = `获取本地位置信息更新: 参数为locationRequest,listener,looper`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + locationRequest, + listener, + looper + ); + }; + + LocationManager.requestLocationUpdates.overload( + "long", + "float", + "android.location.Criteria", + "android.app.PendingIntent" + ).implementation = function ( + minTimeMs: any, + minDistanceM: any, + criteria: any, + pendingIntent: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] minTimeMs: ${minTimeMs}`; + const description = `获取本地位置信息更新: 参数为 minTimeMs,minDistanceM,criteria,pendingIntent`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + minTimeMs, + minDistanceM, + criteria, + pendingIntent + ); + }; + + LocationManager.requestLocationUpdates.overload( + "java.lang.String", + "long", + "float", + "android.app.PendingIntent" + ).implementation = function ( + provider: any, + minTimeMs: any, + minDistanceM: any, + pendingIntent: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] provider: ${provider}`; + const description = `获取本地位置信息更新: 参数为 provider,minTimeMs,minDistanceM,pendingIntent`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + provider, + minTimeMs, + minDistanceM, + pendingIntent + ); + }; + + LocationManager.requestLocationUpdates.overload( + "long", + "float", + "android.location.Criteria", + "java.util.concurrent.Executor", + "android.location.LocationListener" + ).implementation = function ( + minTimeMs: any, + minDistanceM: any, + criteria: any, + executor: any, + listener: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] minTimeMs: ${minTimeMs}`; + const description = `获取本地位置信息更新: 参数为 minTimeMs,minDistanceM,criteria,executor,listener`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + minTimeMs, + minDistanceM, + criteria, + executor, + listener + ); + }; + + LocationManager.requestLocationUpdates.overload( + "long", + "float", + "android.location.Criteria", + "android.location.LocationListener", + "android.os.Looper" + ).implementation = function ( + minTimeMs: any, + minDistanceM: any, + criteria: any, + listener: any, + looper: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] minTimeMs: ${minTimeMs}`; + const description = `获取本地位置信息更新: 参数为 minTimeMs,minDistanceM,criteria,listener,looper`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + minTimeMs, + minDistanceM, + criteria, listener, looper ); }; + LocationManager.requestLocationUpdates.overload( + "java.lang.String", + "long", + "float", + "java.util.concurrent.Executor", + "android.location.LocationListener" + ).implementation = function ( + provider: any, + minTimeMs: any, + minDistanceM: any, + executor: any, + listener: any + ) { + const signature = `[android.location.LocationManager requestLocationUpdates] minTimeMs: ${minTimeMs}`; + const description = `获取本地位置信息更新: 参数为 provider, minTimeMs,minDistanceM,executor,listener`; + send(description); + send(signature); + printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + signature, + formatStackTrace(getStackTrace()) + ); + this.requestLocationUpdates( + provider, + minTimeMs, + minDistanceM, + executor, + listener + ); + }; + + + LocationManager.getLastKnownLocation.implementation = function ( provider: any ) { From 8a4190c06f5b206d62fdbc004af41152707ec025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E6=99=A8=E9=BE=99?= Date: Wed, 3 Aug 2022 10:43:25 +0800 Subject: [PATCH 2/2] flush description for different parameters with the same func --- insight-agent/agent/index.ts | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/insight-agent/agent/index.ts b/insight-agent/agent/index.ts index 0c9e3d3..d893ac3 100755 --- a/insight-agent/agent/index.ts +++ b/insight-agent/agent/index.ts @@ -353,6 +353,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -369,6 +374,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -384,6 +394,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -399,6 +414,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -607,6 +627,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -637,6 +662,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -662,6 +692,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -687,6 +722,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -713,6 +753,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -741,6 +786,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -770,6 +820,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -801,6 +856,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -833,6 +893,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature, @@ -865,6 +930,11 @@ Java.perform(() => { send(description); send(signature); printStackTrace(getStackTrace()); + InsightApi.getInstance().flush( + API_BASE_URL + "/flush", + description, + formatStackTrace(getStackTrace()) + ); InsightApi.getInstance().flush( API_BASE_URL + "/flush", signature,