安卓逆向 -- Hook多个dex文件

Posted web安全工具库

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安卓逆向 -- Hook多个dex文件相关的知识,希望对你有一定的参考价值。

往期文章

Xposed模块 -- Hook函数参数

一、主要代码

package com.bucuo.a20210908;import android.app.Application;import android.content.Context;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(Application.class,"attach", Context.class,                new XC_MethodHook() {                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {                    }                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {                       ClassLoader cl= ((Context)param.args[0]).getClassLoader();                       Class<?> hookclass=null;                       try {                           hookclass=cl.loadClass("com.dodonew.online.http.RequestUtil");                       }catch (Exception e){                           Log.e("逆向有你","未找到类",e);                           return;                       }                       Log.d("逆向有你","已找到类");                       findAndHookMethod(hookclass, "encodeDesMap", String.class, String.class, String.class, new XC_MethodHook() {                           @Override                           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);                           }                       });                    }                });    }}

二、效果和上节课一样

禁止非法,后果自负

欢迎关注公众号:逆向有你

欢迎关注视频号:之乎者也吧

以上是关于安卓逆向 -- Hook多个dex文件的主要内容,如果未能解决你的问题,请参考以下文章

Android 逆向ART 函数抽取加壳 ③ ( 禁用 dex2oat 操作 HOOK 点介绍 | 集成 InLineHook )

怎么加固安卓软件????

Android 逆向ART 函数抽取加壳 ④ ( 对 libc.so#execve 函数进行内联 HOOK 操作 )

安卓源码逆向

Hook逆向离线加密的autojs打包的脚本

安卓 dex 通用脱壳技术研究