All Projects → canyie → Pine

canyie / Pine

Dynamic java method hook framework on ART.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Pine

Epic
Dynamic java method AOP hook for Android(continution of Dexposed on ART), Supporting 5.0~11
Stars: ✭ 3,434 (+1908.19%)
Mutual labels:  hook, art, xposed, aop
Sandhook
Android ART Hook/Native Inline Hook/Single Instruction Hook - support 4.4 - 11.0 32/64 bit - Xposed API Compat
Stars: ✭ 1,172 (+585.38%)
Mutual labels:  hook, art, xposed, aop
Virtualxposed
A simple app to use Xposed without root, unlock the bootloader or modify system image, etc.
Stars: ✭ 12,648 (+7296.49%)
Mutual labels:  hook, xposed, aop
Androididchanger
Xposed Module for Changing Android Device Info
Stars: ✭ 394 (+130.41%)
Mutual labels:  hook, xposed
Easyrouter
A simple android framework used to route activity or action with url.
Stars: ✭ 164 (-4.09%)
Mutual labels:  hook, aop
Plthook
Hook function calls by replacing PLT(Procedure Linkage Table) entries.
Stars: ✭ 351 (+105.26%)
Mutual labels:  hook, hooking
hookey
Enables all the DLCs. Like Creamapi but just for linux and a subset of Paradox games.
Stars: ✭ 87 (-49.12%)
Mutual labels:  hook, hooking
Sandvxposed
Xposed environment without root (OS 5.0 - 10.0)
Stars: ✭ 604 (+253.22%)
Mutual labels:  hook, xposed
X Apm
应用管理 Xposed
Stars: ✭ 482 (+181.87%)
Mutual labels:  hook, xposed
Stinger
Stinger is a high-efficiency library with great compatibility, for aop in Objective-C, using libffi instead of Objective-C message forwarding. It is 20+ times faster than the Aspects, from message-sending to Aspect-oriented code ends.
Stars: ✭ 845 (+394.15%)
Mutual labels:  hook, aop
Xpatch
免Root实现app加载Xposed插件工具。This is a tool to repackage apk file, then the apk can load any xposed modules installed in the device. It is another way to hook an app without root device.
Stars: ✭ 1,054 (+516.37%)
Mutual labels:  hook, xposed
SandVXposed
Xposed environment without root (OS 5.0 - 12.0)
Stars: ✭ 241 (+40.94%)
Mutual labels:  hook, xposed
Beike AspectD
Flutter AOP framework.(Flutter面向切面库, 最新适配Flutter v2.5.3, null-safety)
Stars: ✭ 39 (-77.19%)
Mutual labels:  hook, aop
aspectgo
Aspect-Oriented Programming framework for Go
Stars: ✭ 62 (-63.74%)
Mutual labels:  hook, aop
Easyprotector
一行代码检测XP/调试/多开/模拟器/root
Stars: ✭ 1,732 (+912.87%)
Mutual labels:  hook, xposed
Dexcalibur
[Official] Android reverse engineering tool focused on dynamic instrumentation automation. Powered by Frida. It disassembles dex, analyzes it statically, generates hooks, discovers reflected methods, stores intercepted data and does new things from it. Its aim is to be an all-in-one Android reverse engineering platform.
Stars: ✭ 512 (+199.42%)
Mutual labels:  hook, hooking
RedditVanced
Reddit Android app mod inspired by Aliucord
Stars: ✭ 41 (-76.02%)
Mutual labels:  hook, hooking
SandVXposed
Xposed environment without root (OS 5.0 - 10.0)
Stars: ✭ 832 (+386.55%)
Mutual labels:  hook, xposed
Xposednavigationbar
Xposed导航栏功能拓展模块
Stars: ✭ 42 (-75.44%)
Mutual labels:  hook, xposed
Swifthook
A library to hook methods in Swift and Objective-C.
Stars: ✭ 93 (-45.61%)
Mutual labels:  hook, aop

Pine Download LICENSE

中文版本

Introduction

Pine is a dynamic java method hook framework on ART runtime, it can intercept almost all java method calls in this process.

Currently it supports Android 4.4(ART only) ~ 11.0 with thumb-2/arm64 architecture.

About its working principle, you can refer to this Chinese article.

Note: For Android 6.0 and 32-bit mode, the arguments may be wrong; and for Android 9.0+, pine will disable the hidden api restriction policy.

Usage

Basic Usage

Add dependencies in build.gradle (like this):

dependencies {
    implementation 'top.canyie.pine:core:<version>'
}

Basic configuration:

PineConfig.debug = true; // Do we need to print more detailed logs?
PineConfig.debuggable = BuildConfig.DEBUG; // Is this process debuggable?

Example 1: monitor the creation of activities

Pine.hook(Activity.class.getDeclaredMethod("onCreate", Bundle.class), new MethodHook() {
    @Override public void beforeCall(Pine.CallFrame callFrame) {
        Log.i(TAG, "Before " + callFrame.thisObject + " onCreate()");
    }

    @Override public void afterCall(Pine.CallFrame callFrame) {
        Log.i(TAG, "After " + callFrame.thisObject + " onCreate()");
    }
});

Example 2: monitor the creation and destroy of all java threads

final MethodHook runHook = new MethodHook() {
    @Override public void beforeCall(Pine.CallFrame callFrame) throws Throwable {
        Log.i(TAG, "Thread " + callFrame.thisObject + " started...");
    }

    @Override public void afterCall(Pine.CallFrame callFrame) throws Throwable {
        Log.i(TAG, "Thread " + callFrame.thisObject + " exit...");
    }
};

Pine.hook(Thread.class.getDeclaredMethod("start"), new MethodHook() {
    @Override public void beforeCall(Pine.CallFrame callFrame) {
        Pine.hook(ReflectionHelper.getMethod(callFrame.thisObject.getClass(), "run"), runHook);
    }
});

Example 3: force allow any threads to modify the ui:

Method checkThread = Class.forName("android.view.ViewRootImpl").getDeclaredMethod("checkThread");
Pine.hook(checkThread, MethodReplacement.DO_NOTHING);

Xposed Support

Download

Pine supports hooking methods in Xposed-style and loading Xposd modules. (Only supports java method hook now.)

implementation 'top.canyie.pine:xposed:<version>'

Direct hook methods in Xposed-style:

XposedHelpers.findAndHookMethod(TextView.class, "setText",
                CharSequence.class, TextView.BufferType.class, boolean.class, int.class,
                new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        Log.e(TAG, "Before TextView.setText");
                        param.args[0] = "hooked";
                    }

                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        Log.e(TAG, "After TextView.setText");
                    }
                });

or like this:

XposedBridge.hookMethod(target, callback);

and you can load xposed modules (resources hook is not supported now):

// 1. load modules
PineXposed.loadModule(new File(moudlePath));

// 2. call all 'IXposedHookLoadPackage' callback
PineXposed.onPackageLoad(packageName, processName, appInfo, isFirstApp, classLoader);

Known issues

  • May not be compatible with some devices/systems.

  • Due to #11, we recommend hooking methods with less concurrency as much as possible, for example:

public static void method() {
    synchronized (sLock) {
        methodLocked();
    }
}

private static void methodLocked() {
    // ...
}

In the example, we recommend that the hook method is methodLocked instead of method.

Discussion

QQ Group:949888394

Credits

License

Pine Copyright (c) canyie

AndroidELF Copyright (c) Swift Gan

Dobby Copyright (c) jmpews

Licensed under the Anti 996 License, Version 1.0 (the "License");

you may not use this "Pine" project except in compliance with the License.

You may obtain a copy of the License at

https://github.com/996icu/996.ICU/blob/master/LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].