frida mode display command line on mac
#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
}
