Xposed模块 -- Hook函数参数
Posted web安全工具库
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Xposed模块 -- Hook函数参数相关的知识,希望对你有一定的参考价值。
一、根据以前的课程,我们通过抓包分析,知道了如下的关键函数
package com.dodonew.online.http;
import android.text.TextUtils;
import android.util.Log;
import com.dodonew.online.util.DesSecurity;
。。。。。。。。。。。。。。。。。。//省略导包
public class RequestUtil {
public static String decodeDesJson(String json, String desKey, String desIV) {
if(!TextUtils.isEmpty(json)) {
try {
json = new String(new DesSecurity(desKey, desIV).decrypt64(json), "UTF-8");
}
catch(Exception e) {
e.printStackTrace();
}
}
return json;
}
public static String encodeDesMap(String data, String desKey, String desIV) {
String v2;
try {
v2 = new DesSecurity(desKey, desIV).encrypt64(data.getBytes("UTF-8"));
}
catch(Exception e) {
e.printStackTrace();
v2 = "";
}
return v2;
}
。。。。。。。。。。。。。。。。。。//省略部分函数
}
}
二、添加一个hook的框架结构
package com.bucuo.a20210908;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class hook implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam loadPackageParam) throws Throwable {
Log.d("逆向有你", "hook成功");
if(!loadPackageParam.packageName.equals("com.dodonew.online")) return;
Log.d("逆向有你","hooking.....");findAndHookMethod("com.dodonew.online.http.RequestUtil", loadPackageParam.classLoader,
"encodeDesMap",//添加要hook的类名及方法名
String.class,
String.class,
String.class,//hook的三个参数
new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String args0 = (String) param.args[0];
String args1 = (String) param.args[1];
String args2 = (String) param.args[2];
Log.d("逆向有你", args0);
Log.d("逆向有你", args1);
Log.d("逆向有你", args2);
}
});
}
}
三、安装到模拟器,重启,点击登录,成功获取我们想要
禁止非法,后果自负
欢迎关注公众号:逆向有你
欢迎关注视频号:之乎者也吧
以上是关于Xposed模块 -- Hook函数参数的主要内容,如果未能解决你的问题,请参考以下文章