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.
For full guides, API reference, and advanced examples, check out the Official Documentation.
- 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.
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")
}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()
}
}
}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]}"
}
}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.
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.