Thanks to visit codestin.com
Credit goes to github.com

Skip to content

zlytxlb/Terminator

 
 

Repository files navigation

Terminator

License JitPack PRs Welcome

A powerful, modern hooking framework for Android that lets you intercept native (C/C++) and JVM (Java/Kotlin) calls with a type-safe Kotlin DSL, requiring no root and no NDK.

📖 Documentation

For full guides, API reference, and advanced examples, check out the Official Documentation.

✨ Features

  • Pure Java/Kotlin: No C++ or NDK toolchain required to write hooks.
  • Unified API: A single, consistent DSL for hooking both native functions and JVM methods.
  • Type Safety: Leverage Kotlin's type system to catch errors at compile time.
  • Expressive DSL: A clean, readable, and modern API using Kotlin's best features.
  • Powerful Memory API: Read, write, and map native pointers and C-style structs directly from Kotlin.
  • No Root Required: Operates entirely within your application's process.

🚀 Installation

Add the JitPack repository to your settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { setUrl("https://jitpack.io") }
    }
}

Add the dependencies to your module's build.gradle.kts:

dependencies {
    // Main library
    implementation("com.github.Matrix-Username.Terminator:Terminator:1.0.2") 
    // Kotlin wrapper & DSL
    implementation("com.github.Matrix-Username.Terminator:TerminatorHookKotlin:1.0.2") 
}

🔧 Quick Start

Hooking a Native Function (libc.so)

Intercept calls to open to log every file the application accesses.

import android.util.Log
import com.skiy.terminatorkt.*

fun hookFileOpens() {
    TerminatorNative.hook {
        target("libc.so", "open")
        returns<Int>()
        params(CString::class, Int::class)

        onCalled {
            val path = arg<CString>(0)
            Log.d("FileMonitor", "Opening file: $path")
            callOriginal()
        }
    }
}

Hooking a JVM Method (android.util.Log)

Intercept calls to Log.d and prepend a prefix to the message.

import android.util.Log
import com.skiy.terminatorkt.beforeCall
import kotlin.reflect.full.functions

fun hookLogging() {
    val target = Log::class.functions.first { it.name == "d" }

    target beforeCall { methodCall ->
        val args = methodCall.arguments
        args[1] = "[HOOKED] ${args[1]}"
    }
}

🙏 Acknowledgements

Terminator is based on the PanamaPort library by vova7878.

PanamaPort provides a low-level implementation of the FFM (Foreign Function & Memory) API for Android, which serves as the engine behind all of Terminator’s hooking and memory manipulation capabilities.

🤝 Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

📄 License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

About

A powerful hooking framework for JVM and native functions on Android, written in pure Java/Kotlin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 64.8%
  • Kotlin 33.2%
  • C++ 1.2%
  • CMake 0.8%