aboutsummaryrefslogtreecommitdiff
path: root/utils/afl_frida/android
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-07-23 13:29:53 +0200
committervanhauser-thc <vh@thc.org>2021-07-23 13:29:53 +0200
commit0f299a3bef12b2a8f27a5ba629a2ecb1201fcd60 (patch)
treec55dd391fd34499ab3f8167e2ab3c74df7268a8c /utils/afl_frida/android
parentdc0fed6e0c13702fa36fab66631fb5bbca6d64de (diff)
downloadafl++-0f299a3bef12b2a8f27a5ba629a2ecb1201fcd60.tar.gz
removed utils/afl_frida
Diffstat (limited to 'utils/afl_frida/android')
-rw-r--r--utils/afl_frida/android/README.md1
-rw-r--r--utils/afl_frida/android/frida-gum-example.c130
2 files changed, 0 insertions, 131 deletions
diff --git a/utils/afl_frida/android/README.md b/utils/afl_frida/android/README.md
deleted file mode 100644
index 044b48a1..00000000
--- a/utils/afl_frida/android/README.md
+++ /dev/null
@@ -1 +0,0 @@
-For android, frida-gum package (ex. https://github.com/frida/frida/releases/download/14.2.6/frida-gum-devkit-14.2.6-android-arm64.tar.xz) is needed to be extracted in the directory.
diff --git a/utils/afl_frida/android/frida-gum-example.c b/utils/afl_frida/android/frida-gum-example.c
deleted file mode 100644
index 14d98248..00000000
--- a/utils/afl_frida/android/frida-gum-example.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Compile with:
- *
- * clang -fPIC -DANDROID -ffunction-sections -fdata-sections -Os -pipe -g3 frida-gum-example.c -o frida-gum-example -L. -lfrida-gum -llog -ldl -lm -pthread -Wl,--gc-sections,-z,noexecstack,-z,relro,-z,now -fuse-ld=gold -fuse-ld=gold -Wl,--icf=all
- *
- * Visit https://frida.re to learn more about Frida.
- */
-
-#include "frida-gum.h"
-
-#include <fcntl.h>
-#include <unistd.h>
-
-typedef struct _ExampleListener ExampleListener;
-typedef enum _ExampleHookId ExampleHookId;
-
-struct _ExampleListener
-{
- GObject parent;
-
- guint num_calls;
-};
-
-enum _ExampleHookId
-{
- EXAMPLE_HOOK_OPEN,
- EXAMPLE_HOOK_CLOSE
-};
-
-static void example_listener_iface_init (gpointer g_iface, gpointer iface_data);
-
-#define EXAMPLE_TYPE_LISTENER (example_listener_get_type ())
-G_DECLARE_FINAL_TYPE (ExampleListener, example_listener, EXAMPLE, LISTENER, GObject)
-G_DEFINE_TYPE_EXTENDED (ExampleListener,
- example_listener,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE (GUM_TYPE_INVOCATION_LISTENER,
- example_listener_iface_init))
-
-int
-main (int argc,
- char * argv[])
-{
- GumInterceptor * interceptor;
- GumInvocationListener * listener;
-
- gum_init_embedded ();
-
- interceptor = gum_interceptor_obtain ();
- listener = g_object_new (EXAMPLE_TYPE_LISTENER, NULL);
-
- gum_interceptor_begin_transaction (interceptor);
- gum_interceptor_attach (interceptor,
- GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "open")),
- listener,
- GSIZE_TO_POINTER (EXAMPLE_HOOK_OPEN));
- gum_interceptor_attach (interceptor,
- GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "close")),
- listener,
- GSIZE_TO_POINTER (EXAMPLE_HOOK_CLOSE));
- gum_interceptor_end_transaction (interceptor);
-
- close (open ("/etc/hosts", O_RDONLY));
- close (open ("/etc/fstab", O_RDONLY));
-
- g_print ("[*] listener got %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
-
- gum_interceptor_detach (interceptor, listener);
-
- close (open ("/etc/hosts", O_RDONLY));
- close (open ("/etc/fstab", O_RDONLY));
-
- g_print ("[*] listener still has %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
-
- g_object_unref (listener);
- g_object_unref (interceptor);
-
- gum_deinit_embedded ();
-
- return 0;
-}
-
-static void
-example_listener_on_enter (GumInvocationListener * listener,
- GumInvocationContext * ic)
-{
- ExampleListener * self = EXAMPLE_LISTENER (listener);
- ExampleHookId hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId);
-
- switch (hook_id)
- {
- case EXAMPLE_HOOK_OPEN:
- g_print ("[*] open(\"%s\")\n", (const gchar *) gum_invocation_context_get_nth_argument (ic, 0));
- break;
- case EXAMPLE_HOOK_CLOSE:
- g_print ("[*] close(%d)\n", GPOINTER_TO_INT (gum_invocation_context_get_nth_argument (ic, 0)));
- break;
- }
-
- self->num_calls++;
-}
-
-static void
-example_listener_on_leave (GumInvocationListener * listener,
- GumInvocationContext * ic)
-{
-}
-
-static void
-example_listener_class_init (ExampleListenerClass * klass)
-{
- (void) EXAMPLE_IS_LISTENER;
- (void) glib_autoptr_cleanup_ExampleListener;
-}
-
-static void
-example_listener_iface_init (gpointer g_iface,
- gpointer iface_data)
-{
- GumInvocationListenerInterface * iface = g_iface;
-
- iface->on_enter = example_listener_on_enter;
- iface->on_leave = example_listener_on_leave;
-}
-
-static void
-example_listener_init (ExampleListener * self)
-{
-}