Backdoor couldn't find methods on target : application / activity if the code written in Kotlin
See original GitHub issueSo I have 2 android application written in Kotlin and Java …
I tried to call public method on my Java Android Application both inside activity and application. It worked!
ImmutableMap<String, Object> scriptArgs = ImmutableMap.of(
"target", "application",
"methods", Arrays.asList(ImmutableMap.of(
"name", "createToast",
"args", Arrays.asList(ImmutableMap.of(
"value", "Hello",
"type", "String"
))
))
);
androidDriver.executeScript("mobile: backdoor", scriptArgs);
But when i want to try it on Kotlin Android Application, somehow espresso couldn’t find any public methods inside activity nor application. So I tried to use companion object and moved the function inside and marked it with @JvmStatic annotation.
ImmutableMap<String, Object> scriptArgs = ImmutableMap.of(
"target", "application",
"methods", Arrays.asList(ImmutableMap.of(
"name", "com.xxx.xxxxAplication.Companion.createToast",
"args", Arrays.asList(ImmutableMap.of(
"value", "Hello",
"type", "String"
))
))
);
androidDriver.executeScript("mobile: backdoor", scriptArgs);
Is there anything that i can do to get the list of methods inside Java Code / Kotlin Code with backdoor ? Just for debugging purpose.
And is there any solution for this ?
Thank you !
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Could not find method kapt() for arguments - Stack Overflow
In my case,I was missing apply plugin: 'kotlin-kapt'. Hope it helps someone as blind as me.
Read more >Crashes - Android Developers
An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.
Read more >0xdf hacks stuff | CTF solutions, malware analysis, home lab ...
I'll take advantage of two mistakes in the coding to write a binary that escapes the jail and reads the database for the...
Read more >Black Hat USA 2022 | Trainings Schedule
Start your journey into information security with a hands-on course which will expose you to the technical fundamentals of penetration testing and security ......
Read more >Kotlin Android Extensions: Say goodbye to findViewById (KAD ...
Let's see the code it generates if we move it to a fragment. I'm creating this simple fragment, that uses the same XML...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! I took a glance at the code and found
setAccessible(true);
. ah… final modifier affected. Will add the kotlin case in doc.Hey guys @dpgraham @rajdeepv @KazuCocoa … I found out that we have to put
open
in front of the methods 😁open fun methodName()
will be decompiled intopublic void methodName()
Case closed! Thanks @KazuCocoa for pointing out kotlin bytecode … Maybe we have to add documentation about this on appium mobile native command especially for kotlin app 🥇