An Android application that automatically generates Frida hook scripts by using Kotlin reflection on Android API classes.
Instead of manually writing Frida hooks for every constructor and method of a class, this app inspects the target class at runtime via reflection and produces a ready-to-use JavaScript hook script.
- Kotlin Reflection — The app uses
kotlin-reflectto enumerate all constructors and public methods of the target class, including parameter types and return types. - Documentation Enrichment — It fetches the official Android documentation from
developer.android.comto retrieve human-readable parameter names (reflection alone only exposesarg0,arg1, etc.). - Type Mapping — Kotlin types are converted to their JVM equivalents so Frida's
overload()selectors work correctly (e.g.kotlin.ByteArray→[B,kotlin.Int→int). - Script Generation — A FreeMarker template engine produces the final JavaScript file with proper
Java.use(),overload(), andimplementationblocks.
- Install and launch the app on an Android device or emulator.
- Enter the fully qualified class name you want to hook (e.g.
javax.crypto.Cipher,java.security.MessageDigest,javax.crypto.KeyGenerator). - Select the output template:
- Console — Logs all calls and return values to the Frida console via
console.log(). - Events — Sends structured JSON events via
send(), useful for programmatic processing.
- Console — Logs all calls and return values to the Frida console via
- Tap Generate Frida Script.
- Review the generated script, then use Copy or Share to export it.
Save the generated script to a file (e.g. observer_cipher.js), then launch it against a target application:
frida -U -f com.example.targetapp -l observer_cipher.js --no-pauseWhere:
-Uconnects to a USB device-f com.example.targetappspawns the target application-l observer_cipher.jsloads the generated hook script--no-pauseresumes the app immediately after spawning
======
[#] Hook of javax.crypto.Cipher [#]
======
javax.crypto.Cipher.getInstance
transformation: AES/CBC/PKCS5Padding
javax.crypto.Cipher.init
opmode: 1
key: android.security.keystore.AndroidKeyStoreSecretKey@abcdef
javax.crypto.Cipher.doFinal
input: [0x48 0x65 0x6c 0x6c 0x6f] | Hello
javax.crypto.Cipher.doFinal return value: [0x3a 0x1b 0x...] | ...
{
"type": "cipher",
"timestamp": 1707500000000,
"sub_type": "javax.crypto.Cipher.doFinal called ( input: [0x48 0x65 0x6c 0x6c 0x6f] | Hello)",
"value": "[0x3a 0x1b ...]"
}Any class available on the Android runtime can be targeted. Common use cases include:
javax.crypto.Cipher— Encryption/decryption operationsjavax.crypto.KeyGenerator— Symmetric key generationjava.security.KeyPairGenerator— Asymmetric key generationjava.security.MessageDigest— Hashing (SHA, MD5, etc.)javax.crypto.SecretKeyFactory— Secret key derivationjavax.crypto.spec.SecretKeySpec— Key specificationandroid.telephony.TelephonyManager— Device/telephony info
├── model/Models.kt # Data classes (Parameter, Method, ClassModel, Stats)
├── TypeMapper.kt # Kotlin ↔ JVM/Frida type conversion
├── DocumentationFetcher.kt # Fetches & parses Android API docs
├── ReflectionAnalyzer.kt # Kotlin reflection analysis + doc matching
├── FridaScriptGenerator.kt # FreeMarker template processing
├── MainViewModel.kt # MVVM ViewModel with coroutines
├── MainActivity.kt # UI layer
├── AndroidSafeObjectWrapper.kt # FreeMarker Android compatibility
└── assets/templates/
├── frida_script.ftl # Console output template
└── frida_script_events.ftl # JSON events output template
./gradlew assembleDebugRequirements: Android SDK 35, JDK 17, Gradle 8.10+
MIT
