Java Code Examples for de.robv.android.xposed.XposedBridge#hookAllMethods()

The following examples show how to use de.robv.android.xposed.XposedBridge#hookAllMethods() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OneWeather.java    From MinMinGuard with GNU General Public License v3.0 6 votes vote down vote up
public static boolean handleLoadPackage(final String packageName, LoadPackageParam lpparam)
{
    try
    {
        Class<?> adView = XposedHelpers.findClass("com.handmark.expressweather.billing.BillingUtils", lpparam.classLoader);
        XposedBridge.hookAllMethods(adView, "isPurchased", new XC_MethodHook()
        {

            @Override
            protected void beforeHookedMethod(MethodHookParam param)
            {

                param.setResult(Boolean.valueOf(true));
            }
        });
    }
    catch (ClassNotFoundError e)
    {
        return false;
    }
    return true;
}
 
Example 2
Source File: StepHook.java    From XposedWechatHelper with GNU General Public License v2.0 6 votes vote down vote up
public static void hook(ClassLoader classLoader) {

        try {
            //4.4 nexus 通过
            Class clazz = XposedHelpers.findClass("android.hardware.SystemSensorManager$SensorEventQueue", classLoader);
            XposedBridge.hookAllMethods(clazz, "dispatchSensorEvent", new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                    reload();
                    if (fakeStep) {
                        ((float[]) param.args[1])[0] = (((float[]) param.args[1])[0]) * Integer.valueOf(step);
                    }
                    super.beforeHookedMethod(param);
                }

            });
        } catch (Error | Exception e) {
            e.printStackTrace();
        }
    }
 
Example 3
Source File: BootCompletedHack.java    From AppOpsXposed with GNU General Public License v3.0 6 votes vote down vote up
@TargetApi(19)
private void patchActivityManagerService(ClassLoader classLoader) throws Throwable
{
	final Class<?> amServiceClazz = classLoader.loadClass(
			"com.android.server.am.ActivityManagerService");

	final Class<?> procRecordClazz = classLoader.loadClass(
			"com.android.server.am.ProcessRecord");

	final Class<?> iIntentRecvrClazz = classLoader.loadClass(
			"android.content.IIntentReceiver");

	XposedBridge.hookAllMethods(amServiceClazz, "broadcastIntentLocked", new XC_MethodHook() {

		@Override
		protected void beforeHookedMethod(MethodHookParam param) throws Throwable
		{
			if(Manifest.permission.RECEIVE_BOOT_COMPLETED.equals(param.args[8]))
			{
				param.args[9] = OP_BOOT_COMPLETED;
				log("broadcastIntentLocked called; setting op to OP_BOOT_COMPLETED");
				log("  processRecord=" + param.args[0]);
			}
		}
	});
}
 
Example 4
Source File: FakeSignatures.java    From FakeGApps with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initZygote(StartupParam startupParam) throws Throwable {

    final Class<?> PackageParser = XposedHelpers.findClass("android.content.pm.PackageParser", null);
    XposedBridge.hookAllMethods(PackageParser, "generatePackageInfo", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            PackageInfo pi = (PackageInfo) param.getResult();
            if (pi != null) {
                String packageName = pi.packageName;
                if (packageName.contains("com.google.android.gms") || packageName.contains("com.android.vending")) {

                    try {
                        PackageNameServiceManager manager = PackageNameServiceManager.getService();
                        String callerPackageName = manager.getPackageName(Binder.getCallingUid());

                        XposedBridge.log("FakeGApps: returning fake signature to " + callerPackageName);
                    } catch (NullPointerException e) {
                        XposedBridge.log("FakeGApps: caught the NullPointerException");
                    }

                    String sig = "308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a";
                    
                    Signature[] signatures = new Signature[]{new Signature(sig)};
                    pi.signatures = signatures;
                    param.setResult(pi);
                }
            }
        }
    });
}
 
Example 5
Source File: MainHook.java    From SqlCipherHook with Apache License 2.0 5 votes vote down vote up
private void hookSqlCipher(ClassLoader classLoader) {

        Log.d(TAG, "Hooking SqlCipher libraries for: " + currentPackageName);

        /* We can simply hook all calls to "openDatabase(...)", and handle the slight differences */
        Class<?> clazz = findClass(SQLCIPHER_CLASS_NAME, classLoader);
        XC_MethodHook hook =  new XC_MethodHook() {

            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

                /* Param 1 will always be a string. */
                String path = (String)param.args[0];

                /* Param 2 can be either a char[] or a String. */
                String password = "ERROR";
                Object inPassword = param.args[1];

                if (inPassword instanceof String) {
                    password = (String)inPassword;
                } else if (inPassword instanceof char[]) {
                    password = String.valueOf((char[])inPassword);
                }

                Log.d(TAG, "[" + currentPackageName + "] SqlCipher openDatabase( ... ) called!");
                Log.d(TAG, "[" + currentPackageName + "] Password Used: " + password);
                Log.d(TAG, "[" + currentPackageName + "] DB Path: " + path);
            }
        };

        /* Perform the hook */
        XposedBridge.hookAllMethods(clazz, "openDatabase", hook);
    }
 
Example 6
Source File: FixOpsPruneHack.java    From AppOpsXposed with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleLoadFrameworkPackage(LoadPackageParam lpparam) throws Throwable
{
	final Class<?> appOpsSvcClazz = lpparam.classLoader.loadClass(
			"com.android.server.AppOpsService");
	// This is extremely crude, but should suffice for a temporary fix. See
	// 9bb3f6785d6 in CyanogenMod/android_frameworks_base for an infinitely more
	// elegant solution.
	XposedBridge.hookAllMethods(appOpsSvcClazz, "systemReady",
			XC_MethodReplacement.DO_NOTHING);
}
 
Example 7
Source File: FixWakeLock.java    From AppOpsXposed with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void handleLoadAnyPackage(LoadPackageParam lpparam) throws Throwable
{
	if(AppOpsManagerWrapper.OP_WAKE_LOCK == -1)
		return;

	// On some (HTC) ROMs, an IllegalArgumentException thrown by the PowerManagerService
	// (because the lock is not actually held) is not ignored in setWorkSource().

	final Class<?> clazz = loadClass("android.os.PowerManager$WakeLock");
	XposedBridge.hookAllMethods(clazz, "setWorkSource", new ExceptionEater(IllegalArgumentException.class));
}
 
Example 8
Source File: GeneralHacks.java    From AppOpsXposed with GNU General Public License v3.0 5 votes vote down vote up
private void fixPmCrash() throws Throwable
{
	final Class<?> pmSvcClazz = loadClass("com.android.server.pm.PackageManagerService");
	XposedBridge.hookAllMethods(pmSvcClazz, "addPackageHoldingPermissions",
			new XC_MethodHook(XC_MethodHook.PRIORITY_LOWEST) {
				@Override
				protected void afterHookedMethod(MethodHookParam param) throws Throwable
				{
					final Throwable t = param.getThrowable();
					if(t != null && (t instanceof NullPointerException))
						param.setResult(null);
				}
	});
}
 
Example 9
Source File: MiuiHacks.java    From AppOpsXposed with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void handleLoadFrameworkPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable
{
	try
	{
		final Class<?> appOpsSvcClazz = loadClass("com.android.server.AppOpsService");
		XposedBridge.hookAllMethods(appOpsSvcClazz, "isMiuiAllowed",
				XC_MethodReplacement.returnConstant(true));
		XposedBridge.hookAllMethods(appOpsSvcClazz, "inMiuiAllowedBlackList",
				XC_MethodReplacement.returnConstant(false));

		XposedHelpers.findAndHookMethod(appOpsSvcClazz, "checkSystemApp",
				new Class<?>[] { int.class, int.class, String.class }, new XC_MethodHook() {
					@Override
					protected void afterHookedMethod(MethodHookParam param) throws Throwable
					{
						Boolean result = (Boolean) param.getResult();
						if(result == null || result)
							return;

						if(Constants.MODULE_PACKAGE.equals(param.args[2]))
							param.setResult(true);
					}
				}
		);

		log("Hooked: isMiuiAllowed, inMiuiAllowedBlackList, checkSystemApp");
	}
	catch(Throwable t)
	{
		Util.log(t);
	}
}
 
Example 10
Source File: LogHooks.java    From BadIntent with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void hookLogs(){
    XposedBridge.hookAllMethods(Log.class, "d", new XposedAndroidLogMethodHook("debug"));
    XposedBridge.hookAllMethods(Log.class, "v", new XposedAndroidLogMethodHook("verbose"));
    XposedBridge.hookAllMethods(Log.class, "i", new XposedAndroidLogMethodHook("info"));
    XposedBridge.hookAllMethods(Log.class, "w", new XposedAndroidLogMethodHook("warning"));
    XposedBridge.hookAllMethods(Log.class, "e", new XposedAndroidLogMethodHook("exception"));
    XposedBridge.hookAllMethods(Log.class, "wtf", new XposedAndroidLogMethodHook("wtf"));
}
 
Example 11
Source File: QQPluginHook.java    From XposedManyMoney with GNU General Public License v2.0 5 votes vote down vote up
public static void hook(ClassLoader classLoader) {
    xsp = new XSharedPreferences(BuildConfig.APPLICATION_ID, SettingLabelView.DEFAULT_PREFERENCES_NAME);
    xsp.makeWorldReadable();
    try {
        final Class qvipPayAccountActivityClazz = XposedHelpers.findClass("com.qwallet.activity.QvipPayAccountActivity", classLoader);
        handleHook(qvipPayAccountActivityClazz);
        Method[] methods = qvipPayAccountActivityClazz.getMethods();
        for (Method method : methods) {
            if (method.getParameterTypes().length == 1
                    && method.getParameterTypes()[0] == qvipPayAccountActivityClazz
                    && method.getReturnType() == TextView.class) {

                XposedBridge.hookAllMethods(qvipPayAccountActivityClazz, method.getName(), new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        Object object = param.getResult();
                        if (object != null && object.getClass() == TextView.class) {
                            handleHook((TextView) object);
                        }
                        super.afterHookedMethod(param);
                    }
                });
            }
        }
    } catch (Error | Exception e) {
        e.printStackTrace();
    }
}
 
Example 12
Source File: XposedWrapper.java    From XposedSmsCode with GNU General Public License v3.0 5 votes vote down vote up
public static Set<XC_MethodHook.Unhook> hookAllMethods(Class<?> hookClass, String methodName, XC_MethodHook callback) {
    try {
        return XposedBridge.hookAllMethods(hookClass, methodName, callback);
    } catch (Throwable t) {
        XLog.e("Error in hookAllMethods: %s", hookClass.getName(), t);
        return null;
    }
}
 
Example 13
Source File: XLua.java    From XPrivacyLua with GNU General Public License v3.0 5 votes vote down vote up
private void hookApplication(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
    final int uid = Process.myUid();
    Class<?> at = Class.forName("android.app.LoadedApk", false, lpparam.classLoader);
    XposedBridge.hookAllMethods(at, "makeApplication", new XC_MethodHook() {
        private boolean made = false;

        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            try {
                if (!made) {
                    made = true;
                    Context context = (Application) param.getResult();

                    // Check for isolate process
                    int userid = Util.getUserId(uid);
                    int start = Util.getUserUid(userid, 99000);
                    int end = Util.getUserUid(userid, 99999);
                    boolean isolated = (uid >= start && uid <= end);
                    if (isolated) {
                        Log.i(TAG, "Skipping isolated " + lpparam.packageName + ":" + uid);
                        return;
                    }

                    hookPackage(lpparam, uid, context);
                }
            } catch (Throwable ex) {
                Log.e(TAG, Log.getStackTraceString(ex));
                XposedBridge.log(ex);
            }
        }
    });
}
 
Example 14
Source File: AliBillPlugin.java    From Hook with Apache License 2.0 5 votes vote down vote up
@Override
public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context ctx) {
    Log.i("tag","AliBillPlugin");


    XposedBridge.hookAllMethods(XposedHelpers.findClass(Constans.ALI_SQL, loadPackageParam.classLoader), "insertMessageInfo", new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            Log.i("tag","123");
            String str1 = (String) XposedHelpers.callMethod(param.args[0], "toString");

            String str2 = str1.replace("content='", "'");
            if ((str2.contains("二维码收款")) || (str2.contains("收到一笔转账"))) {
                JSONObject localJSONObject = JSONObject.parseObject(str2);
                String str3 = localJSONObject.getString("content").replace("¥", "");
                String str4 = localJSONObject.getString("assistMsg2");
                String str5 = str1.replace("tradeNO=", "&");
                // g.a("收到支付宝支付订单:" + str5 + "==" + str3 + "==" + str4);
                Intent localIntent = new Intent();
                localIntent.putExtra(Constans.BILL_NO, str5);
                localIntent.putExtra(Constans.BILL_MONEY, str3);
                localIntent.putExtra(Constans.BILL_MARK, str4);
                localIntent.putExtra(Constans.BILL_TYPE, Constans.ALIPAY);
                localIntent.setAction(Constans.ACTION_PAY_SUCCESS);
                ctx.sendBroadcast(localIntent);
            }

        }
    });





}
 
Example 15
Source File: MainHook.java    From ZhihuXposed with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 去除答案页面WebView内广告
 * @param loadPackageParam lpparam
 */
private void hookAnswerPageAdvert(final XC_LoadPackage.LoadPackageParam loadPackageParam) {
    try {
        XposedBridge.hookAllMethods(findClass(ZhihuConstant.CLASS_ANSWER_APP_VIEW, loadPackageParam.classLoader), "processHtmlContent", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                if (!(param.args[0] instanceof String)) {
                    return;
                }
                String src = (String)param.args[0];

                int index = src.indexOf("</body></html>");
                if(index < 0){
                    XposedBridge.log("ZhihuXposed: 找不到HTML结尾");
                    return;
                }
                String result = src.substring(0, index);
                result += "<script>" +
                        "window.onload = function () {" +
                        "  document.getElementsByClassName(\"AnswerRecomReading\")[0].parentElement.remove();" +
                        "  document.getElementsByClassName(\"AnswerFooter\")[0].innerText += \"・Xposed已生效\";" + //这条在无广告的时候不会显示(上一行报错)
                        "}" +
                        "</script></body></html>";
                param.args[0] = result;
            }
        });
    } catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError e) {
        XposedBridge.log("ZhihuXposed:" + e.toString());
    }
}
 
Example 16
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static Set<XC_MethodHook.Unhook> hookAllMethods(Class<?> hookClass, String methodName, XC_MethodHook callback) {
    try {
        return XposedBridge.hookAllMethods(hookClass, methodName, callback);
    } catch (Throwable t) {
        log(t);
    }
    return null;
}
 
Example 17
Source File: ModLedControl.java    From GravityBox with Apache License 2.0 4 votes vote down vote up
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        XposedBridge.hookAllMethods(
                XposedHelpers.findClass(CLASS_NOTIF_DATA, classLoader),
                "shouldFilterOut", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                StatusBarNotification sbn = (StatusBarNotification)param.args[0];
                Notification n = sbn.getNotification();

                // whether to hide persistent everywhere
                if (!sbn.isClearable() && n.extras.getBoolean(NOTIF_EXTRA_HIDE_PERSISTENT)) {
                    param.setResult(true);
                    return;
                }

                // whether to hide during keyguard
                if (ModStatusBar.getStatusBarState() != StatusBarState.SHADE) {
                    VisibilityLs vls = n.extras.containsKey(NOTIF_EXTRA_VISIBILITY_LS) ?
                            VisibilityLs.valueOf(n.extras.getString(NOTIF_EXTRA_VISIBILITY_LS)) :
                                VisibilityLs.DEFAULT;
                    switch (vls) {
                        case CLEARABLE:
                            param.setResult(sbn.isClearable());
                            break;
                        case PERSISTENT:
                            param.setResult(!sbn.isClearable());
                            break;
                        case ALL:
                            param.setResult(true);
                            break;
                        case DEFAULT:
                        default: return;
                    }
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example 18
Source File: AliPayeePlugin.java    From Hook with Apache License 2.0 4 votes vote down vote up
@Override
    public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context context) {
        final ClassLoader clazzLoader = loadPackageParam.classLoader;


//
        XposedBridge.hookAllMethods(XposedHelpers.findClass("com.alipay.android.phone.messageboxstatic.biz.dao.ServiceDao", clazzLoader), "insertMessageInfo", new XC_MethodHook()
        {
            protected void beforeHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam)
                    throws Throwable
            {
                try
                {
                    XposedBridge.log("======商户服务start=========");

                    String str = StringUtils.getTextCenter((String)XposedHelpers.callMethod(paramAnonymousMethodHookParam.args[0], "toString", new Object[0]), "extraInfo='", "'").replace("\\", "");
                    Log.i("tag", "http: "+str);
                    if ((str.contains("收钱到账")) || (str.contains("收款到账")))
                    {
                        Log.i("tag","http1");
                        str = PayHelperUtils.getCookieStr(clazzLoader);
                        Log.i("tag","http2"+str);
                        PayHelperUtils.getTradeInfo(context, str);
                        Log.i("tag","http3");
                    }
                    XposedBridge.log("======商户服务end=========");
                }
                catch (Exception localException)
                {
                    Log.i("tag","ServiceDao:error");
                }
                super.beforeHookedMethod(paramAnonymousMethodHookParam);
            }
        });

        Object[] payeeArr = new Object[2];
        payeeArr[0] = Bundle.class;
        payeeArr[1] = new XC_MethodHook() {
            protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) {
                Log.i("tag","1");

                Activity ctx = (Activity) hookParam.thisObject;

                try {

                    Object tvMoney = XposedHelpers.findField(ctx.getClass(), "b").get(ctx);
                    Object tvMark = XposedHelpers.findField(ctx.getClass(), "c").get(ctx);
                    Intent intent = ctx.getIntent();
                    XposedHelpers.callMethod(tvMoney, "setText", intent.getStringExtra(Constans.MONEY));
                    XposedHelpers.callMethod(tvMark, "setText", intent.getStringExtra(Constans.MARK));
                    XposedHelpers.callMethod(tvMark, "setVisibility", View.VISIBLE);
                    Button btn = ((Button) XposedHelpers.findField(ctx.getClass(), "e").get(ctx));
                    btn.performClick();

                } catch (Exception e) {

                    e.printStackTrace();
                }
            }
        };
        XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "onCreate", payeeArr);


        Object[] payResArr = new Object[2];
        payResArr[0] = XposedHelpers.findClass(Constans.SETAMOUNTRES, clazzLoader);
        payResArr[1] = new XC_MethodHook() {
            protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) {
                Log.i("tag","2");
                Activity ctx = (Activity) hookParam.thisObject;
                try {
                    String money = (String) XposedHelpers.findField(ctx.getClass(), "g").get(ctx);
                    String mark = (String) XposedHelpers.callMethod(XposedHelpers.findField(ctx.getClass(), "c").get(ctx), "getUbbStr");
                    Object localObject = hookParam.args[0];
                    String qrCodeUrl = (String) XposedHelpers.findField(localObject.getClass(), "qrCodeUrl").get(localObject);


                    if (money != null) {

                        Intent intent = new Intent();
                        intent.putExtra(Constans.MONEY, money);
                        intent.putExtra(Constans.MARK, mark);
                        intent.putExtra(Constans.TYPE, Constans.ALIPAY);
                        intent.putExtra(Constans.PAY_URL, qrCodeUrl);
                        intent.setAction(Constans.QRCODE_RESULT);
                        PayHelperUtils.sendmsg(ctx,"生成付款码"+ Constans.ALIPAY+":"+qrCodeUrl);
                        ctx.sendBroadcast(intent);

                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "a", payResArr);
    }
 
Example 19
Source File: Util.java    From MinMinGuard with GNU General Public License v3.0 4 votes vote down vote up
public static void hookAllMethods(String className, ClassLoader classLoader, String method, XC_MethodHook callBack)
{
    Class<?> clazz = XposedHelpers.findClass(className, classLoader);

    XposedBridge.hookAllMethods(clazz, method, callBack);
}
 
Example 20
Source File: AlipayHook.java    From renrenpay-android with Apache License 2.0 4 votes vote down vote up
@Override
public void hookBill() throws Error, Exception {
    Class<?> insertTradeMessageInfo = XposedHelpers.findClass("com.alipay.android.phone.messageboxstatic.biz.dao.TradeDao", mAppClassLoader);
    XposedBridge.hookAllMethods(insertTradeMessageInfo, "insertMessageInfo", new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            try {
                Object object = param.args[0];
                String MessageInfo = (String) XposedHelpers.callMethod(object, "toString");
                String content = StrUtils.getMidText(MessageInfo, "content='", "'");
                Log.d(TAG, content);
                if (content.contains("收到一笔转账")) {
                    JSONObject jsonObject = JSON.parseObject(content);
                    String mark = jsonObject.getString("assistMsg2");
                    String money = jsonObject.getString("content");
                    money = money.replace("¥", "").replace(" ", "");
                    String tradeNo = StrUtils.getMidText(MessageInfo, "tradeNO=", "&");
                    QrBean qrBean = new QrBean();
                    qrBean.setOrder_id(tradeNo);
                    qrBean.setMoney(StrUtils.formatMoneyToCent(money));
                    qrBean.setMark_sell(mark);
                    qrBean.setChannel(QrBean.ALIPAY);
                    Intent broadCastIntent = new Intent(RECV_ACTION);
                    broadCastIntent.putExtra(RECV_ACTION_DATE, qrBean.toString());
                    broadCastIntent.putExtra(RECV_ACTION_TYPE, getLocalBillActionType());
                    broadCastIntent.putExtra(RECV_RESULT_TYPE, 1);
                    broadCastIntent.putExtra("type", 1);
                    mContext.sendBroadcast(broadCastIntent);
                }
            } catch (Exception e) {
                Log.e(TAG, "支付宝订单获取错误");
                Intent broadCastIntent1 = new Intent(RECV_ACTION);
                broadCastIntent1.putExtra(RECV_ACTION_DATE, "支付宝订单获取错误");
                broadCastIntent1.putExtra(RECV_ACTION_TYPE, getLocalBillActionType());
                broadCastIntent1.putExtra(RECV_RESULT_TYPE, 2);
                mContext.sendBroadcast(broadCastIntent1);
            }
        }
    });
}