GumScriptBackend * gum_script_backend_obtain (void) { GumScriptBackend * backend; backend = gum_script_backend_obtain_v8 (); if (backend == NULL) backend = gum_script_backend_obtain_jsc (); return backend; }
GumScriptBackend * gum_script_backend_obtain (void) { GumScriptBackend * backend = NULL; #ifdef HAVE_V8 backend = gum_script_backend_obtain_v8 (); #endif if (backend == NULL) backend = gum_script_backend_obtain_duk (); return backend; }
int main (int argc, char * argv[]) { GumScriptBackend * backend; GCancellable * cancellable = NULL; GError * error = NULL; GumScript * script; GMainContext * context; gum_init_embedded (); backend = gum_script_backend_obtain_v8 (); script = gum_script_backend_create_sync (backend, "example", "Interceptor.attach(Module.getExportByName(null, 'open'), {\n" " onEnter(args) {\n" " console.log('[*] open(\"' + args[0].readUtf8String() + '\")');\n" " }\n" "});\n" "Interceptor.attach(Module.getExportByName(null, \"close\"), {\n" " onEnter(args) {\n" " console.log('[*] close(' + args[0].toInt32() + ')');\n" " }\n" "});", cancellable, &error); g_assert (error == NULL); gum_script_set_message_handler (script, on_message, NULL, NULL); gum_script_load_sync (script, cancellable); close (open ("/etc/hosts", O_RDONLY)); close (open ("/etc/fstab", O_RDONLY)); context = g_main_context_get_thread_default (); while (g_main_context_pending (context)) g_main_context_iteration (context, FALSE); gum_script_unload_sync (script, cancellable); g_object_unref (script); gum_deinit_embedded (); return 0; }
static void gum_script_backend_deinit_v8 (void) { g_object_unref (gum_script_backend_obtain_v8 ()); }