Skip to content

Commit

Permalink
修改获得cookieStr的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
liunian committed Apr 10, 2018
1 parent a5042ea commit 03a6749
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 97 deletions.
7 changes: 2 additions & 5 deletions app/src/main/java/com/hhly/pay/alipay/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ public void onCreate() {
}

public static void dealAlipayInfo(Context context, Intent intent) {
String qr_money = intent.getStringExtra("qr_money");
String beiZhu = intent.getStringExtra("beiZhu");
String qrCodeUrl = intent.getStringExtra("qrCodeUrl");
String qrCodeUrlOffline = intent.getStringExtra("qrCodeUrlOffline");
String consultSetAmountResString = intent.getStringExtra("consultSetAmountResString");
String cookieStr = intent.getStringExtra("cookieStr");
String toastString = qr_money + " " + beiZhu + " " + qrCodeUrl + " " + qrCodeUrlOffline + " " + cookieStr;
String toastString = consultSetAmountResString + " " + cookieStr;
Log.i("liunianprint:", toastString);
Toast.makeText(context, toastString, Toast.LENGTH_SHORT).show();
Intent startIntent = new Intent(context, MainActivity.class);
Expand Down
118 changes: 27 additions & 91 deletions app/src/main/java/com/hhly/pay/alipay/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Thr
}
});

// hook 支付宝主界面的onCreate方法,获得主界面对象
// hook 支付宝主界面的onCreate方法,获得主界面对象并注册广播
findAndHookMethod("com.alipay.mobile.quinox.LauncherActivity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -66,7 +66,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

// hook 微信主界面的onCreate方法,获得主界面对象
// hook 支付宝的主界面的onDestory方法,销毁广播
findAndHookMethod("com.alipay.mobile.quinox.LauncherActivity", lpparam.classLoader, "onDestroy", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -78,7 +78,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

// hook 微信主界面的onCreate方法,获得主界面对象
// hook设置金额和备注的onCreate方法,自动填写数据并点击
findAndHookMethod("com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -101,99 +101,35 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

// hook 微信主界面的onCreate方法,获得主界面对象
findAndHookMethod("com.alipay.mobile.payee.ui.PayeeQRActivity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
// hook获得二维码url的回调方法
findAndHookMethod("com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity", lpparam.classLoader, "a",
findClass("com.alipay.transferprod.rpc.result.ConsultSetAmountRes", lpparam.classLoader), new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
log("com.alipay.mobile.payee.ui.PayeeQRActivity onCreated" + "\n");
Intent intent = ((Activity) param.thisObject).getIntent();
if (intent != null) {
String qr_money = intent.getStringExtra("qr_money");
String beiZhu = intent.getStringExtra("beiZhu");
if (qr_money != null) {
log("JinEr:" + qr_money + "\n");
log("BeiZu:" + beiZhu + "\n");
Intent launcherIntent = new Intent((Activity) param.thisObject, XposedHelpers.findClass("com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity", lpparam.classLoader));
launcherIntent.putExtra("qr_money", qr_money);
launcherIntent.putExtra("beiZhu", beiZhu);
((Activity) param.thisObject).startActivityForResult(launcherIntent, 10);
}
}
}
});

// hook 个人收取的onActivityResult方法
findAndHookMethod("com.alipay.mobile.payee.ui.PayeeQRActivity", lpparam.classLoader, "onActivityResult", int.class, int.class, Intent.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
log("com.alipay.mobile.payee.ui.PayeeQRActivity onActivityResult" + "\n");
Intent intent = (Intent) param.args[2];
if (intent != null) {
String qr_money = intent.getStringExtra("qr_money");
String beiZhu = intent.getStringExtra("beiZhu");
String qrCodeUrl = intent.getStringExtra("qrCodeUrl");
String qrCodeUrlOffline = intent.getStringExtra("qrCodeUrlOffline");
String cookieStr = "";
// 获得cookieStr
Context context = (Context)callStaticMethod(findClass("com.alipay.mobile.common.transportext.biz.shared.ExtTransportEnv", lpparam.classLoader), "getAppContext");
if (context != null) {
Object readSettingServerUrl = callStaticMethod(findClass("com.alipay.mobile.common.helper.ReadSettingServerUrl", lpparam.classLoader), "getInstance");
if (readSettingServerUrl != null) {
String gWFURL = (String)callMethod(readSettingServerUrl, "getGWFURL", context);
cookieStr = (String)callStaticMethod(findClass("com.alipay.mobile.common.transport.http.GwCookieCacheHelper", lpparam.classLoader), "getCookie", gWFURL);
log("cookieStr " + cookieStr);
}
log("com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity a" + "\n");
String cookieStr = "";
// 获得cookieStr
Context context = (Context) callStaticMethod(findClass("com.alipay.mobile.common.transportext.biz.shared.ExtTransportEnv", lpparam.classLoader), "getAppContext");
if (context != null) {
Object readSettingServerUrl = callStaticMethod(findClass("com.alipay.mobile.common.helper.ReadSettingServerUrl", lpparam.classLoader), "getInstance");
if (readSettingServerUrl != null) {
String gWFURL = (String) callMethod(readSettingServerUrl, "getGWFURL", context);
cookieStr = (String) callStaticMethod(findClass("com.alipay.mobile.common.transport.http.GwCookieCacheHelper", lpparam.classLoader), "getCookie", gWFURL);
}
Intent broadCastIntent = new Intent();
broadCastIntent.putExtra("qr_money", qr_money);
broadCastIntent.putExtra("beiZhu", beiZhu);
broadCastIntent.putExtra("qrCodeUrl", qrCodeUrl);
broadCastIntent.putExtra("qrCodeUrlOffline", qrCodeUrlOffline);
broadCastIntent.putExtra("cookieStr", cookieStr);
broadCastIntent.setAction(PluginBroadcast.INTENT_FILTER_ACTION);
Activity activity = (Activity) param.thisObject;
activity.sendBroadcast(broadCastIntent);
log("qr_money:" + qr_money + "\n");
log("beiZhu:" + beiZhu + "\n");
log("qrCodeUrl:" + qrCodeUrl + "\n");
log("qrCodeUrlOffline:" + qrCodeUrlOffline + "\n");

// Object appInfo = callStaticMethod(findClass("com.ali.user.mobile.info.AppInfo", lpparam.classLoader), "getInstance");
// if (appInfo != null) {
// log("com.ali.user.mobile.info.AppInfo != null");
// String apdidToken = (String)callMethod(appInfo, "getApdidToken");
// log("apdidToken " + apdidToken);
// String apdid = (String)callMethod(appInfo, "getApdid");
// log("apdid " + apdid);
// String appKey = (String)callMethod(appInfo, "getAppKey", launcherActivity);
// log("appKey " + appKey);
// String channel = (String)callMethod(appInfo, "getChannel");
// log("getChannel " + channel);
// String productId = (String)callMethod(appInfo, "getProductId");
// log("productId " + productId);
// String umid = (String)callMethod(appInfo, "getUmid");
// log("umid " + umid);
// String deviceKeySet = (String)callMethod(appInfo, "getDeviceKeySet");
// log("deviceKeySet " + deviceKeySet);
// String deviceId = (String)callMethod(appInfo, "getDeviceId");
// log("deviceId " + deviceId);
// }
((Activity) param.thisObject).finish();
}
}
});

// hook 微信主界面的onCreate方法,获得主界面对象
findAndHookMethod("com.alipay.mobile.nebulacore.ui.H5Activity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
log("com.alipay.mobile.nebulacore.ui.H5Activity onCreated" + "\n");
Intent intent = ((Activity) param.thisObject).getIntent();
if (intent != null) {
if (intent.getStringExtra("url") != null) {
log("url" + intent.getStringExtra("url"));
}
Object consultSetAmountRes = param.args[0];
String consultSetAmountResString = "";
if (consultSetAmountRes != null) {
consultSetAmountResString = (String) callMethod(consultSetAmountRes, "toString");
}
Intent broadCastIntent = new Intent();
broadCastIntent.putExtra("consultSetAmountResString", consultSetAmountResString);
broadCastIntent.putExtra("cookieStr", cookieStr);
broadCastIntent.setAction(PluginBroadcast.INTENT_FILTER_ACTION);
Activity activity = (Activity) param.thisObject;
activity.sendBroadcast(broadCastIntent);
log("consultSetAmountResString:" + consultSetAmountResString + "\n");
log("cookieStr:" + cookieStr + "\n");
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onReceive(Context context, Intent intent) {
String beiZhu = intent.getStringExtra("beiZhu");
log("AlipayBroadcast onReceive " + qr_money + " " + beiZhu + "\n");
if (!qr_money.contentEquals("")) {
Intent launcherIntent = new Intent(context, XposedHelpers.findClass("com.alipay.mobile.payee.ui.PayeeQRActivity", Main.launcherActivity.getApplicationContext().getClassLoader()));
Intent launcherIntent = new Intent(context, XposedHelpers.findClass("com.alipay.mobile.payee.ui.PayeeQRSetMoneyActivity", Main.launcherActivity.getApplicationContext().getClassLoader()));
launcherIntent.putExtra("qr_money", qr_money);
launcherIntent.putExtra("beiZhu", beiZhu);
Main.launcherActivity.startActivity(launcherIntent);
Expand Down

0 comments on commit 03a6749

Please sign in to comment.