mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-09 00:31:33 +00:00
persistent record for frida and qmeu
This commit is contained in:
parent
b88f132975
commit
146e535f7b
@ -536,12 +536,15 @@ static void report_error_and_exit(int error) {
|
|||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
void nyx_load_target_hash(afl_forkserver_t *fsrv) {
|
void nyx_load_target_hash(afl_forkserver_t *fsrv) {
|
||||||
void *nyx_config = fsrv->nyx_handlers->nyx_config_load(fsrv->target_path);
|
|
||||||
fsrv->nyx_target_hash64 = fsrv->nyx_handlers->nyx_get_target_hash64(nyx_config);
|
|
||||||
fsrv->nyx_handlers->nyx_config_free(nyx_config);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
void *nyx_config = fsrv->nyx_handlers->nyx_config_load(fsrv->target_path);
|
||||||
|
fsrv->nyx_target_hash64 =
|
||||||
|
fsrv->nyx_handlers->nyx_get_target_hash64(nyx_config);
|
||||||
|
fsrv->nyx_handlers->nyx_config_free(nyx_config);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Spins up fork server. The idea is explained here:
|
/* Spins up fork server. The idea is explained here:
|
||||||
|
|
||||||
|
@ -1237,17 +1237,24 @@ void perform_dry_run(afl_state_t *afl) {
|
|||||||
u8 crash_log_fn[PATH_MAX];
|
u8 crash_log_fn[PATH_MAX];
|
||||||
|
|
||||||
snprintf(crash_log_fn, PATH_MAX, "%s.log", crash_fn);
|
snprintf(crash_log_fn, PATH_MAX, "%s.log", crash_fn);
|
||||||
fd = open(crash_log_fn, O_WRONLY | O_CREAT | O_EXCL, DEFAULT_PERMISSION);
|
fd = open(crash_log_fn, O_WRONLY | O_CREAT | O_EXCL,
|
||||||
if (unlikely(fd < 0)) { PFATAL("Unable to create '%s'", crash_log_fn); }
|
DEFAULT_PERMISSION);
|
||||||
|
if (unlikely(fd < 0)) {
|
||||||
|
|
||||||
|
PFATAL("Unable to create '%s'", crash_log_fn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(
|
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(
|
||||||
afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string,
|
afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string,
|
||||||
afl->fsrv.nyx_aux_string_len);
|
afl->fsrv.nyx_aux_string_len);
|
||||||
|
|
||||||
ck_write(fd, afl->fsrv.nyx_aux_string, nyx_aux_string_len, crash_log_fn);
|
ck_write(fd, afl->fsrv.nyx_aux_string, nyx_aux_string_len,
|
||||||
|
crash_log_fn);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
afl->last_crash_time = get_cur_time();
|
afl->last_crash_time = get_cur_time();
|
||||||
@ -2905,6 +2912,7 @@ void check_binary(afl_state_t *afl, u8 *fname) {
|
|||||||
afl->fsrv.target_path);
|
afl->fsrv.target_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (stat(afl->fsrv.target_path, &st) || !S_ISREG(st.st_mode) ||
|
if (stat(afl->fsrv.target_path, &st) || !S_ISREG(st.st_mode) ||
|
||||||
|
@ -83,12 +83,16 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
|
|||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (afl->fsrv.nyx_mode) {
|
if (afl->fsrv.nyx_mode) {
|
||||||
|
|
||||||
nyx_load_target_hash(&afl->fsrv);
|
nyx_load_target_hash(&afl->fsrv);
|
||||||
fprintf(f2, "%llx\n", afl->fsrv.nyx_target_hash64);
|
fprintf(f2, "%llx\n", afl->fsrv.nyx_target_hash64);
|
||||||
}
|
|
||||||
else {
|
} else {
|
||||||
|
|
||||||
fprintf(f2, "%p\n", (void *)get_binary_hash(afl->fsrv.target_path));
|
fprintf(f2, "%p\n", (void *)get_binary_hash(afl->fsrv.target_path));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
fprintf(f2, "%p\n", (void *)get_binary_hash(afl->fsrv.target_path));
|
fprintf(f2, "%p\n", (void *)get_binary_hash(afl->fsrv.target_path));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1505,7 +1505,8 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (afl->fsrv.nyx_mode) {
|
if (afl->fsrv.nyx_mode) {
|
||||||
|
|
||||||
OKF("AFL++ Nyx mode is enabled (developed and maintained by Sergej Schumilo)");
|
OKF("AFL++ Nyx mode is enabled (developed and maintained by Sergej "
|
||||||
|
"Schumilo)");
|
||||||
OKF("Nyx is open source, get it at https://github.com/Nyx-Fuzz");
|
OKF("Nyx is open source, get it at https://github.com/Nyx-Fuzz");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2228,12 +2229,16 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
u64 target_hash = 0;
|
u64 target_hash = 0;
|
||||||
if (afl->fsrv.nyx_mode) {
|
if (afl->fsrv.nyx_mode) {
|
||||||
|
|
||||||
nyx_load_target_hash(&afl->fsrv);
|
nyx_load_target_hash(&afl->fsrv);
|
||||||
target_hash = afl->fsrv.nyx_target_hash64;
|
target_hash = afl->fsrv.nyx_target_hash64;
|
||||||
}
|
|
||||||
else {
|
} else {
|
||||||
|
|
||||||
target_hash = get_binary_hash(afl->fsrv.target_path);
|
target_hash = get_binary_hash(afl->fsrv.target_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
u64 target_hash = get_binary_hash(afl->fsrv.target_path);
|
u64 target_hash = get_binary_hash(afl->fsrv.target_path);
|
||||||
#endif
|
#endif
|
||||||
@ -2386,10 +2391,11 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
#ifdef AFL_PERSISTENT_RECORD
|
#ifdef AFL_PERSISTENT_RECORD
|
||||||
if (unlikely(afl->fsrv.persistent_record)) {
|
if (unlikely(afl->fsrv.persistent_record)) {
|
||||||
|
|
||||||
if (!getenv(PERSIST_ENV_VAR)) {
|
if (!getenv(PERSIST_ENV_VAR) && !getenv("AFL_FRIDA_PERSISTENT_ADDR") &&
|
||||||
|
!getenv("AFL_QEMU_PERSISTENT_ADDR")) {
|
||||||
|
|
||||||
FATAL(
|
FATAL(
|
||||||
"Target binary is not compiled in persistent mode, "
|
"Target binary is not compiled/run in persistent mode, "
|
||||||
"AFL_PERSISTENT_RECORD makes no sense.");
|
"AFL_PERSISTENT_RECORD makes no sense.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user