Jtik is a runtime dynamic hook framework on the Android platform that operates at the granularity of Java methods.Its implementation is based on ART TI and it is capable of hooking both the application itself and system Java methods. Since it utilizes publicly available system interfaces and does not involve modifications to internal memory structures of the ART virtual machine, such as ArtMethod, it theoretically has strong compatibility.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.chancerly:jtik:0.0.1-Beta'
}
//if you want hook framework method,like Activity.onCreate
//JtikConfig.needHookSystemClass = true;
Jtik.init(context);
for example:as a class Test
public class Test {
public int run(int a, int b){
...
}
}
hook the method run
of class Test
:
Jtik.hook(classLoader.loadClass("Test").getDeclaredMethod("run", int.class, int.class),
new com.zxc.jtik.MethodHook.Builder().setMethodEnterListener((o, objects) -> {
//do something on method enter...
}).setMethodExitListener((o, o1) -> {
//do something on method exit...
return o1;
}).setParamModifier(0, (thisObject, inParam) -> {
//do something if you want to modify the parameter...
return 6;//the parameter value you chage to
}).build());
Theoretically, Android 8.0+ are fully supported