add AFL autodict capability to Nyx mode
MODIFY
nyx_mode/PACKER_VERSION
nyx_mode/PACKER_VERSION
-8842549
+76100c5

MODIFY
nyx_mode/packer
nyx_mode/packer
-Subproject commit 8842549b5612a890258dcef812276cfdb62b76c7
+Subproject commit 76100c52db96429350693a6c7284c5c6cbcb6b08

MODIFY
src/afl-forkserver.c
src/afl-forkserver.c
@@ -425,6 +425,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
}
}
+ ck_free(x);
if (fsrv->nyx_runner == NULL) { FATAL("Something went wrong ..."); }
@@ -464,6 +465,61 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
}
+ /* autodict in Nyx mode */
+ if (!ignore_autodict) {
+ x = alloc_printf("%s/workdir/dump/afl_autodict.txt", fsrv->out_dir_path);
+ int nyx_autodict_fd = open(x, O_RDONLY);
+ ck_free(x);
+
+ if (nyx_autodict_fd >= 0) {
+ struct stat st;
+ if (fstat(nyx_autodict_fd, &st) >= 0) {
+ u32 f_len = st.st_size;
+ u8 *dict = ck_alloc(f_len);
+ if (dict == NULL) {
+ FATAL("Could not allocate %u bytes of autodictionary memory", f_len);
+ }
+
+ u32 offset = 0, count = 0;
+ u32 len = f_len;
+
+ while (len != 0) {
+
+ rlen = read(nyx_autodict_fd, dict + offset, len);
+ if (rlen > 0) {
+
+ len -= rlen;
+ offset += rlen;
+
+ } else {
+
+ FATAL(
+ "Reading autodictionary fail at position %u with %u bytes "
+ "left.",
+ offset, len);
+ }
+
+ }
+ close(nyx_autodict_fd);
+
+ offset = 0;
+ while (offset < (u32)f_len &&
+ (u8)dict[offset] + offset < (u32)f_len) {
+
+ fsrv->add_extra_func(fsrv->afl_ptr, dict + offset + 1,
+ (u8)dict[offset]);
+ offset += (1 + dict[offset]);
+ count++;
+
+ }
+
+ if (!be_quiet) { ACTF("Loaded %u autodictionary entries", count); }
+ ck_free(dict);
+
+ }
+ }
+ }
+
return;
}

add AFL autodict capability to Nyx mode