All Projects → PAGalaxyLab → Yahfa

PAGalaxyLab / Yahfa

Licence: gpl-3.0
Yet Another Hook Framework for ART

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Yahfa

Hyperdbg
The Source Code of HyperDbg Debugger 🐞
Stars: ✭ 658 (-33.87%)
Mutual labels:  hook
Robotgo
RobotGo, Go Native cross-platform GUI automation @vcaesar
Stars: ✭ 7,095 (+613.07%)
Mutual labels:  hook
Proxychains Ng
proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
Stars: ✭ 7,553 (+659.1%)
Mutual labels:  hook
Scripthookvdotnet
An ASI plugin for Grand Theft Auto V, which allows running scripts written in any .NET language in-game.
Stars: ✭ 679 (-31.76%)
Mutual labels:  hook
Webhook
webhook is a lightweight incoming webhook server to run shell commands
Stars: ✭ 7,201 (+623.72%)
Mutual labels:  hook
React Cool Inview
😎 🖥️ React hook to monitor an element enters or leaves the viewport (or another element).
Stars: ✭ 830 (-16.58%)
Mutual labels:  hook
Sandvxposed
Xposed environment without root (OS 5.0 - 10.0)
Stars: ✭ 604 (-39.3%)
Mutual labels:  hook
Gameoverlay
🎮 GameOverlay using CEF with support for common rendering backends
Stars: ✭ 32 (-96.78%)
Mutual labels:  hook
Use Web Animations
😎 🍿 React hook for highly-performant and manipulable animations using Web Animations API.
Stars: ✭ 802 (-19.4%)
Mutual labels:  hook
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 (-15.08%)
Mutual labels:  hook
Fakerandroid
A tool translate a apk file to stantard android project include so hook api and il2cpp c++ scaffolding when apk is a unity il2cpp game. Write code on a apk file elegantly.
Stars: ✭ 695 (-30.15%)
Mutual labels:  hook
Interposekit
A modern library to swizzle elegantly in Swift.
Stars: ✭ 777 (-21.91%)
Mutual labels:  hook
React Use Form State
📄 React hook for managing forms and inputs state
Stars: ✭ 898 (-9.75%)
Mutual labels:  hook
Virtuallocation
利用Hook技术对APP进行虚拟定位,可修改微信、QQ、以及一些打卡APP等软件,随意切换手机所处位置!
Stars: ✭ 666 (-33.07%)
Mutual labels:  hook
Winproject
Hook, DLLInject, PE_Tool
Stars: ✭ 27 (-97.29%)
Mutual labels:  hook
Useeffectreducer
useReducer + useEffect = useEffectReducer
Stars: ✭ 642 (-35.48%)
Mutual labels:  hook
Droidplugin
A plugin framework on android,Run any third-party apk without installation, modification or repackage
Stars: ✭ 6,683 (+571.66%)
Mutual labels:  hook
Kirby Autofocus
Content aware image cropping for Kirby. Kirby 2 and 3.
Stars: ✭ 35 (-96.48%)
Mutual labels:  hook
Silence
A simple, clean macro recorder written in C#. Windows 10 compatible.
Stars: ✭ 29 (-97.09%)
Mutual labels:  hook
Use Measure
It's just a React hook for resize-observer, uses resize-observer-polyfill.
Stars: ✭ 24 (-97.59%)
Mutual labels:  hook

YAHFA

Build Status Download Maven

Introduction

YAHFA is a hook framework for Android ART. It provides an efficient way for Java method hooking or replacement. Currently it supports:

  • Android 5.0(API 21)
  • Android 5.1(API 22)
  • Android 6.0(API 23)
  • Android 7.0(API 24)
  • Android 7.1(API 25)
  • Android 8.0(API 26)
  • Android 8.1(API 27)
  • Android 9(API 28)
  • Android 10(API 29)
  • Android 11(API 30)
  • Android 12(DP1)

(Support for version <= 6.0 is broken after commit 9824bdd.)

with ABI:

  • x86
  • x86_64
  • armeabi-v7a
  • arm64-v8a

YAHFA is utilized by VirtualHook so that applications can be hooked without root permission.

Please take a look at this article and this one for a detailed introduction.

更新说明

Setup

Add Maven central repo in build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

Then add YAHFA as a dependency:

dependencies {
    implementation 'io.github.pagalaxylab:yahfa:0.10.0'
}

YAHFA depends on dlfunc after commit 5b60df8 for calling MakeInitializedClassesVisiblyInitialized explicitly on Android R, and Android Gradle Plugin version 4.1+ is required for that native library dependency.

Usage

To hook a method:

HookMain.backupAndHook(Method target, Method hook, Method backup);

where backup would be a placeholder for invoking the target method. Set backup to null or just use HookMain.hook(Method target, Method hook) if the original code is not needed.

Both hook and backup are static methods, and their parameters should match the ones of target. Please take a look at demoPlugin on how these methods are defined.

Workaround for Method Inlining

Hooking would fail for methods that are compiled to be inlined. For example:

0x00004d5a: f24a7e81  movw    lr, #42881
0x00004d5e: f2c73e11  movt    lr, #29457
0x00004d62: f6495040  movw    r0, #40256
0x00004d66: f2c70033  movt    r0, #28723
0x00004d6a: 4641      mov     r1, r8
0x00004d6c: 1c32      mov     r2, r6
0x00004d6e: 47f0      blx     lr

Here the value of register lr is hardcoded instead of reading from entry point field of ArtMethod.

A simple workaround is to build the APP with debuggable option on, in which case the inlining optimization will not apply. However the option --debuggable of dex2oat is not available until API 23. So please take a look at machine instructions of the target when the hook doesn't work.

License

YAHFA is distributed under GNU GPL V3.

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].