about summary refs log tree commit diff
path: root/frida_mode/src/main.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-11-03 21:55:21 +0100
committerGitHub <noreply@github.com>2021-11-03 21:55:21 +0100
commitf5535e348d37460daa4c6ea43063b451aa83d9cc (patch)
tree2339a99aa53f604cbe77b0dc88882f29ec9a6bf6 /frida_mode/src/main.c
parent25c947cd5ae93cb865081f9259255b4fdb3ca3ba (diff)
parent9278f27d749bcf0852ba2629caa319375c9a60e4 (diff)
downloadafl++-f5535e348d37460daa4c6ea43063b451aa83d9cc.tar.gz
Merge pull request #1142 from AFLplusplus/dev
Dev
Diffstat (limited to 'frida_mode/src/main.c')
-rw-r--r--frida_mode/src/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/frida_mode/src/main.c b/frida_mode/src/main.c
index c0de9c6b..c8183d8f 100644
--- a/frida_mode/src/main.c
+++ b/frida_mode/src/main.c
@@ -6,6 +6,7 @@
 #ifdef __APPLE__
   #include <mach/mach.h>
   #include <mach-o/dyld_images.h>
+  #include <crt_externs.h>
 #else
   #include <sys/wait.h>
   #include <sys/personality.h>
@@ -90,6 +91,7 @@ static void embedded_init(void) {
 
 static void afl_print_cmdline(void) {
 
+#if defined(__linux__)
   char * buffer = g_malloc0(PROC_MAX);
   gchar *fname = g_strdup_printf("/proc/%d/cmdline", getppid());
   int    fd = open(fname, O_RDONLY);
@@ -123,6 +125,17 @@ static void afl_print_cmdline(void) {
   close(fd);
   g_free(fname);
   g_free(buffer);
+#elif defined(__APPLE__)
+  int idx;
+  char **argv = *_NSGetArgv();
+  int nargv = *_NSGetArgc();
+
+  for (idx = 0; idx < nargv; idx ++) {
+
+    OKF("AFL - COMMANDLINE: argv[%d] = %s", idx, argv[idx]);
+
+  }
+#endif
 
 }