•recv([type, ]callback): request callback to be called on the next message received from your Frida-based application. Optionally type may be specified to only receive a message where the type field is set to type. This will only give you one message, so you need to call recv() again to receive the next one.•send(message[, data]): send the JavaScript object message to your Frida-based application (it must be serializable to JSON). If you also have some raw binary data that you’d like to send along with it, e.g. you dumped some memory using NativePointer#readByteArray, then you may pass this through the optional data argument. This requires it to either be an ArrayBuffer or an array of integers between 0 and 255.
// Example of a call to a native method //TextView tv = findViewById(R.id.sample_text); //tv.setText(stringFromJNI()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
/** * A native method that is implemented by the 'native-lib' native library, * which is packaged with this application. */ publicnative String stringFromJNI(); }
布局类介绍: A ConstraintLayout is a android.view.ViewGroup which allows you to position and size widgets in a flexible way. LinearLayout is a layout that arranges other views either horizontally in a single column or vertically in a single row.
这个定义还是很重要的: rpc.exports is empty object that you can either replace or insert into to expose an RPC-style API to your application. The key specifies the method name and the value is your exported function.
functionget_self_process_name() { var openPtr = Module.getExportByName('libc.so', 'open'); var open = new NativeFunction(openPtr, 'int', ['pointer', 'int']);
var readPtr = Module.getExportByName("libc.so", "read"); var read = new NativeFunction(readPtr, "int", ["int", "pointer", "int"]);
var closePtr = Module.getExportByName('libc.so', 'close'); var close = new NativeFunction(closePtr, 'int', ['int']);
var path = Memory.allocUtf8String("/proc/self/cmdline"); var fd = open(path, 0); if (fd != -1) { var buffer = Memory.alloc(0x1000);
var result = read(fd, buffer, 0x1000); close(fd); result = ptr(buffer).readCString(); console.log("进程的名字是:"+result); return result; }