xposed hook混淆后ssl证书加载的代码失败
初学xposed工具,在hook sxxx社交app的ssl证书加载的函数失败。有两个问题请求解答:1.如何判断ssl证书加载的函数在app运行的时候是被调用的,具体是在什么时候调用的?
2.因为代码经过了混淆,有多个a函数,如何判断自己hook成功了关键的a函数,或者说如何过滤掉其他a函数的干扰?
具体hook的代码如下:
```
package com.example.unlock;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
public class HookMain implements IXposedHookLoadPackage {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if(!lpparam.packageName.equals("cn.sxxxapp.android"))
{
return;
}
Log.i("Tiger_test","hook进入程序");
//Hook a方法
findAndHookMethod(
"cn.soulapp.android.SoulNetworkSDK",
lpparam.classLoader,
"a",
String.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Log.i("Tiger_test","hook开始");//方法的返回值只能放在afterHookedMethod中获取
}
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
Log.i("Tiger_test","a方法的返回值为:"+param.getResult());
}
}
);
}
}
```
打开应用之后,输入手机号码,运行结果如下:
将代码改成try catch语句,尝试排除错误,代码如下:
package com.example.unlock;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
public class HookMain implements IXposedHookLoadPackage {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if(!lpparam.packageName.equals("cn.soulapp.android")) //过滤包名
{
return;
}
XposedBridge.log("Loaded app: " + lpparam.packageName);
//Hook a方法
try {
Log.i("Tiger_test","hook进入程序");
XposedHelpers.findAndHookMethod("cn.soulapp.android.SoulNetworkSDK", lpparam.classLoader, "a", String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
Log.i("Tiger_test","hook开始");
}
//方法执行后执行,改方法的返回值一定要在方法执行完毕后更改
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param)
throws Throwable {
//Log.i("Tiger_test","a方法的第一个参数为:"+param.args.toString());//param.args为方法的第一个参数,同理param.args为第二个参数
Log.i("Tiger_test","a方法的返回值为:"+param.getResult());//方法的返回值只能放在afterHookedMethod中获取
}
});
} catch (Throwable e){
XposedBridge.log("hook failed");
XposedBridge.log(e);
}
}
}
找到的报错如下:
页:
[1]