├── Hook
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── acap
│ │ └── hook
│ │ ├── OnAfterHookedMethod.java
│ │ ├── OnBeforeHookedMethod.java
│ │ ├── compat
│ │ └── HandlerCompat.java
│ │ ├── interior
│ │ ├── HookLogs.java
│ │ ├── ClientTransactionHelper.java
│ │ └── Utils.java
│ │ ├── runtime
│ │ └── LifecycleStateRequest.java
│ │ ├── HookModel.java
│ │ └── bean
│ │ └── ActivityThread.java
├── proguard-rules.pro
└── build.gradle
├── app
├── .gitignore
├── android.jks
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── themes.xml
│ │ │ └── colors.xml
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ └── layout
│ │ │ ├── activity_2.xml
│ │ │ ├── activity_compliance.xml
│ │ │ └── activity_1.xml
│ │ ├── java
│ │ └── com
│ │ │ └── acap
│ │ │ └── demo
│ │ │ ├── utils
│ │ │ ├── LocationUtils.java
│ │ │ ├── PackageList.java
│ │ │ ├── AndroidId.java
│ │ │ └── GetMac.java
│ │ │ ├── base
│ │ │ └── App.java
│ │ │ ├── Activity2.java
│ │ │ ├── Activity1.java
│ │ │ └── ComplianceActivity.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── .idea
├── .name
├── .gitignore
├── compiler.xml
├── misc.xml
├── jarRepositories.xml
├── inspectionProfiles
│ └── Project_Default.xml
└── dbnavigator.xml
├── Runtime
├── .gitignore
├── build.gradle
└── src
│ └── main
│ └── java
│ └── android
│ ├── os
│ └── Parcelable.java
│ └── app
│ └── servertransaction
│ ├── BaseClientRequest.java
│ ├── ActivityTransactionItem.java
│ ├── ActivityLifecycleItem.java
│ └── ClientTransactionItem.java
├── Monitor_WFMA
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ ├── stack
│ │ └── ActivityFinishStack.java
│ │ └── com
│ │ └── acap
│ │ └── wfma
│ │ ├── structure
│ │ └── LimitList.java
│ │ ├── record
│ │ ├── BaseRecord.java
│ │ ├── FinishCallRecord.java
│ │ ├── UnknownRecord.java
│ │ ├── MessageDispatchRecord.java
│ │ └── MessageDestroyRecord.java
│ │ ├── interior
│ │ └── Logs.java
│ │ └── WFMA.java
├── proguard-rules.pro
└── build.gradle
├── Monitor_Privacy_Compliance
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ ├── stack
│ │ └── PrivacyComplianceStack.java
│ │ └── com
│ │ └── acap
│ │ └── compliance
│ │ ├── interior
│ │ └── Logs.java
│ │ └── Compliance.java
├── proguard-rules.pro
└── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── settings.gradle
├── README.md
├── gradle.properties
├── .gitignore
├── gradlew.bat
├── ActivityThread$H.md
├── gradlew
└── LICENSE
/Hook/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Hook/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | AndoridMonitor
--------------------------------------------------------------------------------
/Runtime/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Monitor_WFMA/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Monitor_WFMA/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Monitor_Privacy_Compliance/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Monitor_Privacy_Compliance/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/app/android.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ftmtshuashua/AndroidMonitor/HEAD/app/android.jks
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/10/13 18:44 9 | *10 | */ 11 | public interface Parcelable { 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/src/main/java/android/app/servertransaction/BaseClientRequest.java: -------------------------------------------------------------------------------- 1 | package android.app.servertransaction; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/10/13 18:45 9 | *10 | */ 11 | interface BaseClientRequest { 12 | } 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 13 14:22:34 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /Runtime/src/main/java/android/app/servertransaction/ActivityTransactionItem.java: -------------------------------------------------------------------------------- 1 | package android.app.servertransaction; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/10/13 18:43 9 | *10 | */ 11 | public abstract class ActivityTransactionItem extends ClientTransactionItem { 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/src/main/java/android/app/servertransaction/ActivityLifecycleItem.java: -------------------------------------------------------------------------------- 1 | package android.app.servertransaction; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/10/13 18:42 9 | *10 | */ 11 | public abstract class ActivityLifecycleItem extends ActivityTransactionItem{ 12 | 13 | } 14 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 |
6 | * Tip: 7 | * 8 | * 9 | * Created by A·Cap on 2021/10/13 18:43 10 | *11 | */ 12 | public abstract class ClientTransactionItem implements BaseClientRequest, Parcelable{ 13 | } 14 | -------------------------------------------------------------------------------- /Monitor_WFMA/src/main/java/stack/ActivityFinishStack.java: -------------------------------------------------------------------------------- 1 | package stack; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/11/12 17:50 9 | *10 | * @author A·Cap 11 | */ 12 | public class ActivityFinishStack extends RuntimeException { 13 | public ActivityFinishStack(String message) { 14 | super(message); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Monitor_Privacy_Compliance/src/main/java/stack/PrivacyComplianceStack.java: -------------------------------------------------------------------------------- 1 | package stack; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by ACap on 2021/11/13 14:32 9 | *10 | * 11 | * @author A·Cap 12 | */ 13 | public class PrivacyComplianceStack extends RuntimeException { 14 | public PrivacyComplianceStack(String message) { 15 | super(message); 16 | } 17 | } -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/OnAfterHookedMethod.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook; 2 | 3 | import de.robv.android.xposed.XC_MethodHook; 4 | 5 | /** 6 | *
7 | * Tip: 8 | * 9 | * 10 | * Created by A·Cap on 2021/10/13 10:26 11 | *12 | */ 13 | @FunctionalInterface 14 | public interface OnAfterHookedMethod { 15 | void call(XC_MethodHook.MethodHookParam param) throws Throwable; 16 | } 17 | -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/OnBeforeHookedMethod.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook; 2 | 3 | import de.robv.android.xposed.XC_MethodHook; 4 | 5 | /** 6 | *
7 | * Tip: 8 | * 9 | * 10 | * Created by A·Cap on 2021/10/13 10:26 11 | *12 | */ 13 | @FunctionalInterface 14 | public interface OnBeforeHookedMethod { 15 | void call(XC_MethodHook.MethodHookParam param) throws Throwable; 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 |
8 | * Tip: 9 | * 10 | * 11 | * Created by A·Cap on 2021/10/27 16:29 12 | *13 | */ 14 | public class LocationUtils { 15 | 16 | public static void getLocation(Context context){ 17 | LocationManager systemService = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/acap/demo/utils/PackageList.java: -------------------------------------------------------------------------------- 1 | package com.acap.demo.utils; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *
11 | * Tip: 12 | * 13 | * 14 | * Created by A·Cap on 2021/10/27 15:59 15 | *16 | */ 17 | public class PackageList { 18 | 19 | public static void getList(Context context){ 20 | context.getPackageManager().getInstalledPackages(0); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/acap/demo/base/App.java: -------------------------------------------------------------------------------- 1 | package com.acap.demo.base; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.acap.compliance.Compliance; 7 | import com.acap.wfma.WFMA; 8 | 9 | /** 10 | *
11 | * Tip: 12 | * 13 | * 14 | * Created by A·Cap on 2021/10/13 14:38 15 | *16 | */ 17 | public class App extends Application { 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | WFMA.start(); 23 | // Compliance.start(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/acap/demo/Activity2.java: -------------------------------------------------------------------------------- 1 | package com.acap.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | /** 7 | *
8 | * Tip: 9 | * 10 | * Created by A·Cap on 2021/10/13 15:31 11 | *12 | */ 13 | public class Activity2 extends Activity { 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_2); 18 | findViewById(R.id.view_FinishSelf).setOnClickListener(v -> finish()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Monitor_WFMA/src/main/java/com/acap/wfma/structure/LimitList.java: -------------------------------------------------------------------------------- 1 | package com.acap.wfma.structure; 2 | 3 | import java.util.concurrent.CopyOnWriteArrayList; 4 | 5 | /** 6 | *
7 | * Tip: 8 | * 9 | * 10 | * Created by A·Cap on 2021/11/12 17:54 11 | *12 | * @author A·Cap 13 | */ 14 | public class LimitList
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/11/12 17:35 9 | *10 | * 11 | * @author A·Cap 12 | */ 13 | public abstract class BaseRecord
11 | * Tip: 12 | * 13 | * 14 | * Created by A·Cap on 2021/11/12 17:51 15 | *16 | * @author A·Cap 17 | */ 18 | public class FinishCallRecord extends BaseRecord
11 | * Tip: 12 | * 13 | * 14 | * Created by A·Cap on 2021/11/12 17:51 15 | *16 | * @author A·Cap 17 | */ 18 | public class UnknownRecord extends BaseRecord
5 | * Tip: 6 | * 7 | * 8 | * Created by ACap on 2021/11/13 0:24 9 | *10 | * 11 | * @author A·Cap 12 | */ 13 | public interface HandlerCompat { 14 | 15 | interface P { 16 | int WHAT_EXECUTE_TRANSACTION = 159; 17 | } 18 | 19 | interface Default { 20 | int LAUNCH_ACTIVITY = 100; // to onResume 21 | int PAUSE_ACTIVITY = 101; 22 | int PAUSE_ACTIVITY_FINISHING= 102; 23 | int STOP_ACTIVITY_SHOW = 103; 24 | int STOP_ACTIVITY_HIDE = 104; // onStop 25 | int RESUME_ACTIVITY = 107; 26 | int DESTROY_ACTIVITY = 109; // onDestroy 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /Hook/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/interior/HookLogs.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook.interior; 2 | 3 | import android.util.Log; 4 | 5 | import java.text.MessageFormat; 6 | 7 | /** 8 | *
9 | * Tip: 10 | * 11 | * 12 | * Created by A·Cap on 2021/11/12 16:44 13 | *14 | */ 15 | public class HookLogs { 16 | private static final String TAG = "HooK"; 17 | 18 | private static void i(String tag, String msg) { 19 | Log.i(MessageFormat.format("{0}-{1}", TAG, tag), msg); 20 | } 21 | 22 | private static void e(String tag, String msg, Throwable e) { 23 | Log.e(MessageFormat.format("{0}-{1}", TAG, tag), msg, e); 24 | } 25 | 26 | public static void i(String msg) { 27 | i("i", msg); 28 | } 29 | 30 | public static void e(Throwable e) { 31 | e("e", "", e); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Monitor_WFMA/src/main/java/com/acap/wfma/record/MessageDispatchRecord.java: -------------------------------------------------------------------------------- 1 | package com.acap.wfma.record; 2 | 3 | import android.os.Build; 4 | import android.os.Message; 5 | 6 | import stack.ActivityFinishStack; 7 | 8 | /** 9 | *
10 | * Tip: 11 | * 12 | * 13 | * Created by A·Cap on 2021/11/12 17:58 14 | *15 | * 16 | * @author A·Cap 17 | */ 18 | public class MessageDispatchRecord extends BaseRecord
9 | * Tip: 10 | * 11 | * 12 | * Created by A·Cap on 2021/11/15 14:29 13 | *14 | */ 15 | public class ClientTransactionHelper { 16 | 17 | public static Object getLifecycleStateRequest(Object clientTransaction) { 18 | return XposedHelpers.callMethod(clientTransaction, "getLifecycleStateRequest"); 19 | } 20 | 21 | public static String getLifecycleType(Object lifecycleStateRequest) { 22 | if (lifecycleStateRequest == null) { 23 | return "null"; 24 | } 25 | return lifecycleStateRequest.getClass().getName(); 26 | } 27 | 28 | public static boolean isFinish(Object destroyActivityItem) { 29 | return (boolean) XposedHelpers.getObjectField(destroyActivityItem, "mFinished"); 30 | } 31 | 32 | /** 33 | * 客户端活动在事务执行后的最终生命周期状态 34 | */ 35 | public static String getLifecycleState(Object clientTransaction) { 36 | try { 37 | Object mDestroyActivityItem = XposedHelpers.callMethod(clientTransaction, "getLifecycleStateRequest"); 38 | Object mLifecycleState = XposedHelpers.callMethod(mDestroyActivityItem, "getTargetState"); 39 | return LifecycleStateRequest.format((Integer) mLifecycleState); 40 | } catch (Throwable e) { 41 | return "GET-ERROR"; 42 | } 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 |
14 | * Tip: 15 | * 16 | * 17 | * Created by A·Cap on 2021/10/27 15:29 18 | *19 | */ 20 | public class AndroidId { 21 | 22 | public static String getAndroidId (Context context) { 23 | String ANDROID_ID = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID); 24 | return ANDROID_ID; 25 | } 26 | 27 | public static String getUUID(){ 28 | return UUID.randomUUID().toString(); 29 | } 30 | 31 | @SuppressLint("MissingPermission") 32 | public static String getIMEI(Context context) { 33 | TelephonyManager tm = (TelephonyManager) context.getSystemService(Service.TELEPHONY_SERVICE); 34 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 35 | return tm.getImei(); 36 | } else { 37 | return tm.getDeviceId(); 38 | } 39 | } 40 | 41 | 42 | /** 43 | * 获取手机IMSI 44 | */ 45 | public static String getIMSI(Context context){ 46 | TelephonyManager telephonyManager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); 47 | //获取IMSI号 48 | String imsi=telephonyManager.getSubscriberId(); 49 | if(null==imsi){ 50 | imsi=""; 51 | } 52 | return imsi; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 |
11 | * Tip: 12 | * 13 | * 14 | * Created by A·Cap on 2021/11/12 16:44 15 | *16 | */ 17 | public class Logs { 18 | 19 | // Who finish my activity ! 20 | private static final String TAG = "HooK-Compliance"; 21 | 22 | private static void i(String tag, String msg) { 23 | Log.i(MessageFormat.format("{0}-{1}", TAG, tag), msg); 24 | } 25 | 26 | private static void e(String tag, String msg, Throwable e) { 27 | Log.e(MessageFormat.format("{0}-{1}", TAG, tag), msg, e); 28 | } 29 | 30 | public static void i(String msg) { 31 | i("i", msg); 32 | } 33 | 34 | public static void e(Throwable e) { 35 | e("e", "", e); 36 | } 37 | 38 | /** 39 | * 清理 Throwable 中的无关调用栈 40 | */ 41 | public static void trim(Throwable tr) { 42 | String[] split = getString(tr).split("\n"); 43 | StringBuffer SB = new StringBuffer(); 44 | for (String s : split) { 45 | String trim = s.trim(); 46 | if (trim.startsWith("at com.acap.compliance")) { 47 | continue; 48 | } 49 | if (trim.startsWith("at de.robv.android.xposed.XC_MethodHook")) { 50 | continue; 51 | } 52 | if (trim.startsWith("at com.swift.sandhook.")) { 53 | continue; 54 | } 55 | if (trim.startsWith("at com.acap.hook.")) { 56 | continue; 57 | } 58 | SB.append(s).append("\n"); 59 | } 60 | i(SB.toString()); 61 | } 62 | 63 | public static String getString(Throwable tr) { 64 | return Log.getStackTraceString(tr); 65 | } 66 | 67 | public static void call(String msg) { 68 | trim(new PrivacyComplianceStack(msg)); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/runtime/LifecycleStateRequest.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook.runtime; 2 | 3 | /** 4 | *
5 | * Tip: 6 | * 7 | * 8 | * Created by A·Cap on 2021/10/13 18:45 9 | *10 | * 11 | * @author A·Cap 12 | */ 13 | public class LifecycleStateRequest { 14 | public static final int UNDEFINED = -1; 15 | public static final int PRE_ON_CREATE = 0; 16 | public static final int ON_CREATE = 1; 17 | public static final int ON_START = 2; 18 | public static final int ON_RESUME = 3; 19 | public static final int ON_PAUSE = 4; 20 | public static final int ON_STOP = 5; 21 | public static final int ON_DESTROY = 6; 22 | public static final int ON_RESTART = 7; 23 | 24 | public static final String STR_UNDEFINED = "UNDEFINED"; 25 | public static final String STR_PRE_ON_CREATE = "PRE_ON_CREATE"; 26 | public static final String STR_ON_CREATE = "ON_CREATE"; 27 | public static final String STR_ON_START = "ON_START"; 28 | public static final String STR_ON_RESUME = "ON_RESUME"; 29 | public static final String STR_ON_PAUSE = "ON_PAUSE"; 30 | public static final String STR_ON_STOP = "ON_STOP"; 31 | public static final String STR_ON_DESTROY = "ON_DESTROY"; 32 | public static final String STR_ON_RESTART = "ON_RESTART"; 33 | 34 | public static String format(int type) { 35 | switch (type) { 36 | case PRE_ON_CREATE: 37 | return STR_PRE_ON_CREATE; 38 | case ON_CREATE: 39 | return STR_ON_CREATE; 40 | case ON_START: 41 | return STR_ON_START; 42 | case ON_RESUME: 43 | return STR_ON_RESUME; 44 | case ON_PAUSE: 45 | return STR_ON_PAUSE; 46 | case ON_STOP: 47 | return STR_ON_STOP; 48 | case ON_DESTROY: 49 | return STR_ON_DESTROY; 50 | case ON_RESTART: 51 | return STR_ON_RESTART; 52 | case UNDEFINED: 53 | default: 54 | return STR_UNDEFINED; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/acap/demo/ComplianceActivity.java: -------------------------------------------------------------------------------- 1 | package com.acap.demo; 2 | 3 | import android.app.Activity; 4 | import android.app.Dialog; 5 | import android.os.Bundle; 6 | import android.widget.Button; 7 | 8 | import com.acap.demo.utils.AndroidId; 9 | import com.acap.demo.utils.GetMac; 10 | import com.acap.demo.utils.PackageList; 11 | 12 | /** 13 | *
14 | * Tip: 15 | * 16 | * 17 | * Created by ACap on 2021/11/12 23:43 18 | *19 | * 20 | * @author A·Cap 21 | */ 22 | public class ComplianceActivity extends Activity { 23 | 24 | private interface Action { 25 | void call() throws Throwable; 26 | } 27 | 28 | private void setButton(int id, String txt, Action runnable) { 29 | Button viewById = findViewById(id); 30 | viewById.setText(txt); 31 | viewById.setOnClickListener(v -> { 32 | try { 33 | runnable.call(); 34 | } catch (Throwable throwable) { 35 | throwable.printStackTrace(); 36 | } 37 | }); 38 | } 39 | 40 | @Override 41 | protected void onCreate(Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.activity_compliance); 44 | 45 | setButton(R.id.view_1, "获得Mac", () -> GetMac.getLocalMacAddressFromIp()); 46 | setButton(R.id.view_2, "获得AndroidId", () -> AndroidId.getAndroidId(this)); 47 | setButton(R.id.view_2, "获得PakcageList", () -> PackageList.getList(this)); 48 | } 49 | 50 | private void getMacAddress() { 51 | tryCatch(() -> GetMac.getNewMac()); 52 | tryCatch(() -> GetMac.getLocalMacAddressFromIp()); 53 | tryCatch(() -> GetMac.tryGetWifiMac(this)); 54 | 55 | tryCatch(() -> AndroidId.getAndroidId(this)); 56 | tryCatch(() -> AndroidId.getUUID()); 57 | tryCatch(() -> AndroidId.getIMEI(this)); 58 | tryCatch(() -> AndroidId.getIMSI(this)); 59 | 60 | tryCatch(() -> PackageList.getList(this)); 61 | 62 | new Dialog(this).show(); 63 | // Lifecycle 64 | } 65 | 66 | 67 | private void tryCatch(Runnable runnable) { 68 | try { 69 | runnable.run(); 70 | } catch (Exception e) { 71 | } 72 | } 73 | 74 | @FunctionalInterface 75 | public interface Runnable { 76 | void run() throws Exception; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Monitor_WFMA/src/main/java/com/acap/wfma/record/MessageDestroyRecord.java: -------------------------------------------------------------------------------- 1 | package com.acap.wfma.record; 2 | 3 | import android.app.Activity; 4 | import android.os.Binder; 5 | import android.os.Build; 6 | import android.os.IBinder; 7 | import android.os.Message; 8 | 9 | import com.acap.hook.bean.ActivityThread; 10 | import com.acap.hook.interior.ClientTransactionHelper; 11 | import com.acap.hook.runtime.LifecycleStateRequest; 12 | import com.acap.wfma.interior.Logs; 13 | import com.swift.sandhook.xposedcompat.utils.ApplicationUtils; 14 | 15 | import java.text.MessageFormat; 16 | 17 | import de.robv.android.xposed.XposedHelpers; 18 | import stack.ActivityFinishStack; 19 | 20 | /** 21 | *
22 | * Tip: 23 | * 24 | * 25 | * Created by A·Cap on 2021/11/12 17:58 26 | *27 | * 28 | * @author A·Cap 29 | */ 30 | public class MessageDestroyRecord extends BaseRecord
9 | * Tip: 10 | * 11 | * 12 | * Created by A·Cap on 2021/11/12 16:44 13 | *14 | */ 15 | public class Logs { 16 | 17 | // Who finish my activity ! 18 | private static final String TAG = "HooK-WFMA"; 19 | 20 | private static void i(String tag, String msg) { 21 | Log.i(MessageFormat.format("{0}-{1}", TAG, tag), msg); 22 | } 23 | 24 | private static void e(String tag, String msg, Throwable e) { 25 | Log.e(MessageFormat.format("{0}-{1}", TAG, tag), msg, e); 26 | } 27 | 28 | public static void i(String msg) { 29 | i("i", msg); 30 | } 31 | 32 | public static void e(Throwable e) { 33 | e("e", "", e); 34 | } 35 | 36 | public static void onCreate(Class> cls) { 37 | i("onCreate", cls.getName()); 38 | } 39 | 40 | public static void onStart(Class> cls) { 41 | i("onStart", cls.getName()); 42 | } 43 | 44 | public static void onResume(Class> cls) { 45 | i("onResume", cls.getName()); 46 | } 47 | 48 | public static void onPause(Class> cls) { 49 | i("onPause", cls.getName()); 50 | } 51 | 52 | public static void onStop(Class> cls) { 53 | i("onStop", cls.getName()); 54 | } 55 | 56 | public static void onDestroy(Class> cls) { 57 | i("onDestroy", cls.getName()); 58 | } 59 | 60 | 61 | /** 62 | * 清理 Throwable 中的无关调用栈 63 | */ 64 | public static void trim(Throwable tr) { 65 | String[] split = getString(tr).split("\n"); 66 | StringBuffer SB = new StringBuffer(); 67 | for (String s : split) { 68 | String trim = s.trim(); 69 | if (trim.startsWith("at com.acap.wfma")) { 70 | continue; 71 | } 72 | if (trim.startsWith("at de.robv.android.xposed.XC_MethodHook")) { 73 | continue; 74 | } 75 | if (trim.startsWith("at com.swift.sandhook.")) { 76 | continue; 77 | } 78 | if (trim.startsWith("at com.acap.hook.")) { 79 | continue; 80 | } 81 | SB.append(s).append("\n"); 82 | } 83 | i(SB.toString()); 84 | } 85 | 86 | public static String getString(Throwable tr) { 87 | return Log.getStackTraceString(tr); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/HookModel.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook; 2 | 3 | 4 | import com.acap.hook.interior.HookLogs; 5 | import com.swift.sandhook.xposedcompat.XposedCompat; 6 | 7 | import java.util.Arrays; 8 | 9 | import de.robv.android.xposed.XC_MethodHook; 10 | import de.robv.android.xposed.XposedHelpers; 11 | 12 | /** 13 | *
14 | * Tip: 15 | * findAndHookMethod(Class> clazz, String methodName, Object... parameterTypesAndCallback) 16 | * 17 | * Created by A·Cap on 2021/10/13 10:24 18 | *19 | * 20 | * @author A·Cap 21 | */ 22 | public class HookModel { 23 | private final Class> clazz; 24 | private String methodName; 25 | private Object[] methodParamsType; 26 | 27 | public static Class> getClass(String clazz) { 28 | return XposedHelpers.findClass(clazz, XposedCompat.classLoader); 29 | } 30 | 31 | public HookModel(String clazz) { 32 | this.clazz = getClass(clazz); 33 | } 34 | 35 | public HookModel(Class> clazz) { 36 | this.clazz = clazz; 37 | } 38 | 39 | public HookModel setMethod(String methodName, Object... parameterType) { 40 | this.methodName = methodName; 41 | this.methodParamsType = parameterType; 42 | return this; 43 | } 44 | 45 | public void findAndHookMethod(OnBeforeHookedMethod before) { 46 | findAndHookMethod(new XC_MethodHook() { 47 | @Override 48 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable { 49 | super.beforeHookedMethod(param); 50 | try { 51 | before.call(param); 52 | } catch (Throwable e) { 53 | HookLogs.e(e); 54 | } 55 | } 56 | }); 57 | } 58 | 59 | public void findAndHookMethod(OnAfterHookedMethod after) { 60 | findAndHookMethod(new XC_MethodHook() { 61 | @Override 62 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 63 | super.afterHookedMethod(param); 64 | try { 65 | after.call(param); 66 | } catch (Throwable e) { 67 | HookLogs.e(e); 68 | } 69 | } 70 | }); 71 | } 72 | 73 | public void findAndHookMethod(XC_MethodHook xc) { 74 | try { 75 | Object[] objects = Arrays.copyOf(methodParamsType, methodParamsType.length + 1); 76 | objects[objects.length - 1] = xc; 77 | XposedHelpers.findAndHookMethod(clazz, methodName, objects); 78 | } catch (Throwable e) { 79 | HookLogs.e(e); 80 | } 81 | 82 | 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/bean/ActivityThread.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook.bean; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.IBinder; 6 | 7 | import com.acap.hook.interior.HookLogs; 8 | import com.swift.sandhook.xposedcompat.XposedCompat; 9 | 10 | import java.lang.reflect.Field; 11 | import java.lang.reflect.Method; 12 | import java.util.Map; 13 | 14 | import de.robv.android.xposed.XposedHelpers; 15 | 16 | /** 17 | *
18 | * Tip: 19 | * 20 | * 21 | * Created by ACap on 2021/11/13 0:54 22 | *23 | * 24 | * @author A·Cap 25 | */ 26 | public class ActivityThread { 27 | private static ActivityThread mInstance; 28 | 29 | private Object mCurrentActivityThread; 30 | private Object mActivities; 31 | 32 | public ActivityThread() { 33 | try { 34 | mCurrentActivityThread = getActivityThread(); 35 | this.mActivities = XposedHelpers.findField(mCurrentActivityThread.getClass(), "mActivities").get(mCurrentActivityThread); 36 | } catch (Throwable e) { 37 | HookLogs.e(e); 38 | } 39 | } 40 | 41 | public Activity getActivity(IBinder binder) { 42 | try { 43 | Object ActivityClientRecord = Map.class.getMethod("get", Object.class).invoke(mActivities, binder); 44 | Object activity = XposedHelpers.getObjectField(ActivityClientRecord, "activity"); 45 | return (Activity) activity; 46 | } catch (Throwable e) { 47 | HookLogs.e(e); 48 | } 49 | return null; 50 | } 51 | 52 | public static ActivityThread getInstance() { 53 | if (mInstance == null) { 54 | synchronized (ActivityThread.class) { 55 | if (mInstance == null) { 56 | mInstance = new ActivityThread(); 57 | } 58 | } 59 | } 60 | return mInstance; 61 | } 62 | 63 | private static Object getActivityThread() { 64 | try { 65 | Context context = XposedCompat.context; 66 | Class> activityThread = Class.forName("android.app.ActivityThread"); 67 | Method m = activityThread.getMethod("currentActivityThread", new Class[0]); 68 | m.setAccessible(true); 69 | Object mCurrentActivityThread = m.invoke(null, new Object[0]); 70 | if ((mCurrentActivityThread == null) && (context != null)) { 71 | Field mLoadedApk = context.getClass().getField("mLoadedApk"); 72 | mLoadedApk.setAccessible(true); 73 | Object apk = mLoadedApk.get(context); 74 | Field mActivityThreadField = apk.getClass().getDeclaredField("mActivityThread"); 75 | mActivityThreadField.setAccessible(true); 76 | mCurrentActivityThread = mActivityThreadField.get(apk); 77 | } 78 | return mCurrentActivityThread; 79 | } catch (Throwable ignore) { 80 | HookLogs.e(ignore); 81 | } 82 | return null; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Hook/src/main/java/com/acap/hook/interior/Utils.java: -------------------------------------------------------------------------------- 1 | package com.acap.hook.interior; 2 | 3 | import android.app.ActivityManager; 4 | import android.content.Context; 5 | import android.os.Process; 6 | 7 | import com.acap.hook.runtime.LifecycleStateRequest; 8 | 9 | import java.lang.reflect.Field; 10 | import java.lang.reflect.Method; 11 | import java.text.MessageFormat; 12 | import java.util.List; 13 | 14 | import de.robv.android.xposed.XposedHelpers; 15 | 16 | /** 17 | *
18 | * Tip: 19 | * 20 | * 21 | * Created by A·Cap on 2021/11/12 18:05 22 | *23 | */ 24 | public class Utils { 25 | 26 | 27 | public static boolean isMainProcess(Context context) { 28 | return context.getPackageName().equals(getCurrentProcessName(context)); 29 | } 30 | 31 | private static String getCurrentProcessName(Context context) { 32 | ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 33 | if (am == null) { 34 | return null; 35 | } 36 | List
16 | * Tip: 17 | * 获得Mac地址 18 | * 19 | * Created by A·Cap on 2021/10/27 15:18 20 | *21 | */ 22 | public class GetMac { 23 | 24 | /** 25 | * 通过网络接口取 26 | * 27 | * @return 28 | */ 29 | public static String getNewMac() throws Exception { 30 | ArrayList
23 | * Tip: 24 | * 合规检测 25 | * 26 | * Created by ACap on 2021/11/13 14:09 27 | *28 | * 29 | * @author A·Cap 30 | */ 31 | public class Compliance { 32 | 33 | private static boolean mInit = false; 34 | 35 | private Compliance() { 36 | } 37 | 38 | /** 39 | * Start the monitor, It tells you who shut down your activity 40 | */ 41 | public static void start() { 42 | if (mInit) { 43 | throw new IllegalStateException("The monitor is started!"); 44 | } 45 | mInit = true; 46 | Logs.i("Monitor starting ,Privacy compliance!"); 47 | 48 | try { 49 | init(); 50 | } catch (Throwable e) { 51 | Logs.e(e); 52 | } 53 | 54 | moinitorMac(); 55 | moinitorAndroidId(); 56 | moinitorOaid(); 57 | moinitorPackageList(); 58 | moinitorGps(); 59 | } 60 | 61 | private static void init() throws Throwable { 62 | XposedCompat.classLoader = ClassLoader.getSystemClassLoader(); 63 | } 64 | 65 | private static void moinitorMac() { 66 | new HookModel(WifiInfo.class).setMethod("getMacAddress") 67 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("Mac -> WifiInfo.getMacAddress()")); 68 | new HookModel(NetworkInterface.class).setMethod("getHardwareAddress") 69 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("Mac -> NetworkInterface.getHardwareAddress()")); 70 | new HookModel(WifiManager.class).setMethod("getScanResults") 71 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("Mac -> WifiManager.getScanResults()")); 72 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 73 | new HookModel(BluetoothLeScanner.class).setMethod("startScan", ScanCallback.class) 74 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("Mac -> BluetoothLeScanner.startScan()")); 75 | } 76 | } 77 | 78 | private static void moinitorAndroidId() { 79 | new HookModel(Settings.System.class).setMethod("getString", ContentResolver.class, String.class) 80 | .findAndHookMethod((OnBeforeHookedMethod) param -> { 81 | if (Settings.System.ANDROID_ID.equals(param.args[1])) { 82 | Logs.call("AndroidId -> Settings.System.getString(Settings.System.ANDROID_ID)"); 83 | } 84 | }); 85 | new HookModel(UUID.class).setMethod("randomUUID") 86 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> UUID.randomUUID()")); 87 | new HookModel(TelephonyManager.class).setMethod("getImei") 88 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> TelephonyManager.getImei()")); 89 | new HookModel(TelephonyManager.class).setMethod("getDeviceId") 90 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> TelephonyManager.getDeviceId()")); 91 | new HookModel(TelephonyManager.class).setMethod("getMeid") 92 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> TelephonyManager.getMeid()")); 93 | new HookModel(TelephonyManager.class).setMethod("getSimSerialNumber") 94 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> TelephonyManager.getSimSerialNumber()")); 95 | new HookModel(TelephonyManager.class).setMethod("getSubscriberId") //IMSI 96 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("AndroidId -> TelephonyManager.getSubscriberId()")); 97 | } 98 | 99 | private static void moinitorOaid() { 100 | try { 101 | new HookModel("com.bun.miitmdid.core.MdidSdkHelper") 102 | .setMethod("InitSdk", Context.class, boolean.class, HookModel.getClass("com.bun.miitmdid.interfaces.IIdentifierListener")) 103 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("Oaid -> MdidSdkHelper.InitSdk()")); 104 | } catch (Throwable e) { 105 | Logs.e(e); 106 | } 107 | } 108 | 109 | 110 | private static void moinitorPackageList() { 111 | try { 112 | new HookModel("android.app.ApplicationPackageManager") 113 | .setMethod("getInstalledPackages", int.class) 114 | .findAndHookMethod((OnBeforeHookedMethod) param -> Logs.call("PacakgeList -> PackageManager.getInstalledPackages()")); 115 | } catch (Throwable e) { 116 | Logs.e(e); 117 | } 118 | } 119 | 120 | private static void moinitorGps() { 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /Monitor_WFMA/src/main/java/com/acap/wfma/WFMA.java: -------------------------------------------------------------------------------- 1 | package com.acap.wfma; 2 | 3 | import android.app.Activity; 4 | import android.content.res.Configuration; 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import android.os.Message; 8 | import android.os.MessageQueue; 9 | 10 | import com.acap.hook.HookModel; 11 | import com.acap.hook.OnAfterHookedMethod; 12 | import com.acap.hook.OnBeforeHookedMethod; 13 | import com.acap.hook.compat.HandlerCompat; 14 | import com.acap.hook.interior.ClientTransactionHelper; 15 | import com.acap.hook.runtime.LifecycleStateRequest; 16 | import com.acap.wfma.interior.Logs; 17 | import com.acap.wfma.record.FinishCallRecord; 18 | import com.acap.wfma.record.MessageDestroyRecord; 19 | import com.acap.wfma.record.UnknownRecord; 20 | import com.acap.wfma.structure.LimitList; 21 | import com.swift.sandhook.xposedcompat.XposedCompat; 22 | 23 | import java.text.MessageFormat; 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | /** 28 | *
29 | * Tip: 30 | * Who finish my activity ! 31 | * 32 | * Created by A·Cap on 2021/11/12 16:39 33 | *34 | * 35 | * @author A·Cap 36 | */ 37 | public final class WFMA { 38 | 39 | 40 | private static boolean mInit = false; 41 | 42 | private static final LimitList