[Android逆向]Exposed 破解 jwxdxnx02.apk
使用exposed 遇到了一些坑,这里记录一下
源码:
package com.example.exposedlesson01;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class Main implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
String t_packageName = lpparam.packageName;
if ("hfdcxy.com.myapplication".equals(t_packageName)) {
XposedBridge.log("hooked!!!");
Class<?> aClass = lpparam.classLoader.loadClass("hfdcxy.com.myapplication.MainActivity");
XposedHelpers.findAndHookMethod(aClass, "check", String.class, String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
// origin args
String name = (String)param.args[0];
String password = (String)param.args[1];
XposedBridge.log("hooked!!! name: " + name);
XposedBridge.log("hooked!!! password: " + password);
// modify
param.args[0] = "hfdcxy";
param.args[1] = "1234";
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
}
});
}
}
}
坑1(自己没注意): XposedHelpers.findAndHookMethod,第二个参数是方法名,如果方法有参数,后面要接方法参数类型类
坑2: app 的 build.gradle
不要引入source,只引入api即可,否则不报错,但是永远找不到IXposedHookLoadPackage
dependencies {
......
//以下一句引用
compileOnly 'de.robv.android.xposed:api:82'
}
坑3:jcenter已经过期不提供服务了,一些网上的文档较旧了,改为在setting,gradle
中添加
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
//以下一句引用
maven { url "https://api.xposed.info/"}
}
}
坑4:插件写的有问题,一定要先卸载删除插件,然后重新修改后安装,然后exposed中打开模块并重启手机,;在这里卡了很久,就是因为有时候没这么做,导致一直不成功
最后完美hook
日志:
02-15 18:21:50.066 4987 4987 I EdXposed-Bridge: hooked!!!
02-15 18:22:00.305 4987 4987 I EdXposed-Bridge: hooked!!! name: ddd
02-15 18:22:00.305 4987 4987 I EdXposed-Bridge: hooked!!! password: fdd
02-15 18:22:06.627 4987 4987 I EdXposed-Bridge: hooked!!! name: ddd
02-15 18:22:06.627 4987 4987 I EdXposed-Bridge: hooked!!! password: fdd