this is my native code
Java_com_test_MainActivity_stringFromJNI(JNIEnv *env, jobject, jstring prompt) {
std::string hello = "Hello ";
const char *str = env->GetStringUTFChars(prompt, false);
std::string hello1 = hello + str;
jstring rtStr = env->NewStringUTF(hello1.c_str());
env->ReleaseStringUTFChars(prompt, str);
return rtStr;
}
////
how to send prompt value in onEnter function
onEnter: function onEnter(args) {
//how to send prompt value in here .
},
use python frida.
thanks!
To read from memory you need to know the start address and how many bytes to read.
So maybe something like this will help you figure it out:
onEnter: function (args)
{
var ptr_prompt = args[2];
var length = args[3];
var data = Memory.readByteArray(ptr_promt, length);
send(data);
}
@jhscheer not work .... thanks
I looked up how to do this for jstring and one possibility is:
onEnter: function (args)
{
var ptr_prompt = args[2];
Java.perform( function () {
var String = Java.use("java.lang.String");
var promt = Java.cast(ptr(ptr_prompt), String);
send(prompt);
});
}
I looked up how to do this for jstring and one possibility is:
onEnter: function (args) { var ptr_prompt = args[2]; Java.perform( function () { var String = Java.use("java.lang.String"); var promt = Java.cast(ptr(ptr_prompt), String); send(prompt); }); }
Very nice!This solved my big problem!
Most helpful comment
I looked up how to do this for jstring and one possibility is: