mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
code format
This commit is contained in:
@ -27,9 +27,9 @@
|
||||
#define __AFLCOMMON_H
|
||||
#include "types.h"
|
||||
|
||||
extern u8 *target_path; /* Path to target binary */
|
||||
extern u8* target_path; /* Path to target binary */
|
||||
|
||||
void detect_file_args(char **argv, u8 *prog_in);
|
||||
void detect_file_args(char** argv, u8* prog_in);
|
||||
|
||||
char** get_qemu_argv(u8* own_loc, char** argv, int argc);
|
||||
char** get_wine_argv(u8* own_loc, char** argv, int argc);
|
||||
|
@ -1 +1,2 @@
|
||||
|
||||
|
||||
|
@ -760,7 +760,8 @@ static void usage(u8* argv0) {
|
||||
" -m megs - memory limit for child process (%d MB)\n"
|
||||
" -Q - use binary-only instrumentation (QEMU mode)\n"
|
||||
" -U - use unicorn-based instrumentation (Unicorn mode)\n"
|
||||
" -W - use qemu-based instrumentation with Wine (Wine mode)\n\n"
|
||||
" -W - use qemu-based instrumentation with Wine (Wine "
|
||||
"mode)\n\n"
|
||||
|
||||
"Analysis settings:\n\n"
|
||||
|
||||
@ -834,7 +835,8 @@ static void find_binary(u8* fname) {
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
s32 opt;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
|
||||
use_wine = 0;
|
||||
char** use_argv;
|
||||
|
||||
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
|
||||
@ -930,7 +932,7 @@ int main(int argc, char** argv) {
|
||||
unicorn_mode = 1;
|
||||
break;
|
||||
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
|
||||
if (use_wine) FATAL("Multiple -W options not supported");
|
||||
qemu_mode = 1;
|
||||
@ -963,13 +965,14 @@ int main(int argc, char** argv) {
|
||||
detect_file_args(argv + optind, prog_in);
|
||||
|
||||
if (qemu_mode) {
|
||||
|
||||
|
||||
if (use_wine)
|
||||
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
|
||||
else
|
||||
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
|
||||
|
||||
|
||||
} else
|
||||
|
||||
use_argv = argv + optind;
|
||||
|
||||
SAYF("\n");
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
u8 *target_path; /* Path to target binary */
|
||||
u8* target_path; /* Path to target binary */
|
||||
|
||||
void detect_file_args(char** argv, u8* prog_in) {
|
||||
|
||||
@ -97,7 +97,6 @@ void detect_file_args(char** argv, u8* prog_in) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Rewrite argv for QEMU. */
|
||||
|
||||
char** get_qemu_argv(u8* own_loc, char** argv, int argc) {
|
||||
@ -193,9 +192,9 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
|
||||
cp = alloc_printf("%s/afl-qemu-trace", tmp);
|
||||
|
||||
if (access(cp, X_OK)) FATAL("Unable to find '%s'", tmp);
|
||||
|
||||
|
||||
ck_free(cp);
|
||||
|
||||
|
||||
cp = alloc_printf("%s/afl-wine-trace", tmp);
|
||||
|
||||
if (access(cp, X_OK)) FATAL("Unable to find '%s'", tmp);
|
||||
@ -218,14 +217,14 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
|
||||
if (!access(cp, X_OK)) {
|
||||
|
||||
ck_free(cp);
|
||||
|
||||
|
||||
cp = alloc_printf("%s/afl-wine-trace", own_copy);
|
||||
|
||||
|
||||
if (!access(cp, X_OK)) {
|
||||
|
||||
target_path = new_argv[0] = cp;
|
||||
return new_argv;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -234,17 +233,17 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
|
||||
|
||||
ck_free(own_copy);
|
||||
|
||||
u8 *ncp = BIN_PATH "/afl-qemu-trace";
|
||||
u8* ncp = BIN_PATH "/afl-qemu-trace";
|
||||
|
||||
if (!access(ncp, X_OK)) {
|
||||
|
||||
|
||||
ncp = BIN_PATH "/afl-wine-trace";
|
||||
|
||||
|
||||
if (!access(ncp, X_OK)) {
|
||||
|
||||
target_path = new_argv[0] = ck_strdup(ncp);
|
||||
return new_argv;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -263,10 +262,10 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc) {
|
||||
" instrumented at compile time with afl-gcc. It is also possible to "
|
||||
"use it as a\n"
|
||||
" traditional \"dumb\" fuzzer by specifying '-n' in the command "
|
||||
"line.\n", ncp);
|
||||
"line.\n",
|
||||
ncp);
|
||||
|
||||
FATAL("Failed to locate '%s'.", ncp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,8 +132,8 @@ int main(int argc, char** argv) {
|
||||
gettimeofday(&tv, &tz);
|
||||
init_seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
|
||||
|
||||
while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:QUWe:p:s:V:E:L:h")) >
|
||||
0)
|
||||
while ((opt = getopt(argc, argv,
|
||||
"+i:o:f:m:t:T:dnCB:S:M:x:QUWe:p:s:V:E:L:h")) > 0)
|
||||
|
||||
switch (opt) {
|
||||
|
||||
@ -370,8 +370,8 @@ int main(int argc, char** argv) {
|
||||
if (!mem_limit_given) mem_limit = MEM_LIMIT_UNICORN;
|
||||
|
||||
break;
|
||||
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
|
||||
if (use_wine) FATAL("Multiple -W options not supported");
|
||||
qemu_mode = 1;
|
||||
@ -721,13 +721,14 @@ int main(int argc, char** argv) {
|
||||
start_time = get_cur_time();
|
||||
|
||||
if (qemu_mode) {
|
||||
|
||||
|
||||
if (use_wine)
|
||||
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
|
||||
else
|
||||
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
|
||||
|
||||
|
||||
} else
|
||||
|
||||
use_argv = argv + optind;
|
||||
|
||||
perform_dry_run(use_argv);
|
||||
|
@ -498,8 +498,9 @@ static void find_binary(u8* fname) {
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
s32 opt;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
|
||||
u32 tcnt = 0;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
|
||||
use_wine = 0;
|
||||
u32 tcnt = 0;
|
||||
char** use_argv;
|
||||
|
||||
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
|
||||
@ -612,7 +613,7 @@ int main(int argc, char** argv) {
|
||||
unicorn_mode = 1;
|
||||
break;
|
||||
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
|
||||
if (use_wine) FATAL("Multiple -W options not supported");
|
||||
qemu_mode = 1;
|
||||
@ -671,13 +672,14 @@ int main(int argc, char** argv) {
|
||||
detect_file_args(argv + optind, at_file);
|
||||
|
||||
if (qemu_mode) {
|
||||
|
||||
|
||||
if (use_wine)
|
||||
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
|
||||
else
|
||||
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
|
||||
|
||||
|
||||
} else
|
||||
|
||||
use_argv = argv + optind;
|
||||
|
||||
run_target(use_argv);
|
||||
|
@ -934,7 +934,8 @@ static void usage(u8* argv0) {
|
||||
" -m megs - memory limit for child process (%d MB)\n"
|
||||
" -Q - use binary-only instrumentation (QEMU mode)\n"
|
||||
" -U - use unicorn-based instrumentation (Unicorn mode)\n"
|
||||
" -W - use qemu-based instrumentation with Wine (Wine mode)\n\n"
|
||||
" -W - use qemu-based instrumentation with Wine (Wine "
|
||||
"mode)\n\n"
|
||||
" (Not necessary, here for consistency with other afl-* "
|
||||
"tools)\n\n"
|
||||
|
||||
@ -1025,7 +1026,8 @@ static void read_bitmap(u8* fname) {
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
s32 opt;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0, use_wine = 0;
|
||||
u8 mem_limit_given = 0, timeout_given = 0, qemu_mode = 0, unicorn_mode = 0,
|
||||
use_wine = 0;
|
||||
char** use_argv;
|
||||
|
||||
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
|
||||
@ -1133,7 +1135,7 @@ int main(int argc, char** argv) {
|
||||
unicorn_mode = 1;
|
||||
break;
|
||||
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
case 'W': /* Wine+QEMU mode */
|
||||
|
||||
if (use_wine) FATAL("Multiple -W options not supported");
|
||||
qemu_mode = 1;
|
||||
@ -1184,13 +1186,14 @@ int main(int argc, char** argv) {
|
||||
detect_file_args(argv + optind, out_file);
|
||||
|
||||
if (qemu_mode) {
|
||||
|
||||
|
||||
if (use_wine)
|
||||
use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
|
||||
else
|
||||
use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
|
||||
|
||||
|
||||
} else
|
||||
|
||||
use_argv = argv + optind;
|
||||
|
||||
exact_mode = !!getenv("AFL_TMIN_EXACT");
|
||||
|
Reference in New Issue
Block a user