Added flag -u to allow custom interval to update fuzzer_stats file

This commit is contained in:
Amit Elkabetz
2023-03-05 18:16:21 +02:00
parent 2ff0ff7a90
commit 07cf27cddc
4 changed files with 17 additions and 4 deletions

View File

@ -210,7 +210,10 @@ static void usage(u8 *argv0, int more_help) {
" -b cpu_id - bind the fuzzing process to the specified CPU core "
"(0-...)\n"
" -e ext - file extension for the fuzz test input file (if "
"needed)\n\n",
"needed)\n"
" -u - interval to update fuzzer_stats file in seconds, "
"defaults to 60 sec\n"
"\n",
argv0, EXEC_TIMEOUT, MEM_LIMIT, MAX_FILE, FOREIGN_SYNCS_MAX);
if (more_help > 1) {
@ -501,7 +504,7 @@ fail:
int main(int argc, char **argv_orig, char **envp) {
s32 opt, auto_sync = 0 /*, user_set_cache = 0*/;
u64 prev_queued = 0;
u64 prev_queued = 0, stats_update_freq_sec = 0;
u32 sync_interval_cnt = 0, seek_to = 0, show_help = 0, default_output = 1,
map_size = get_map_size();
u8 *extras_dir[4];
@ -553,7 +556,7 @@ int main(int argc, char **argv_orig, char **envp) {
while (
(opt = getopt(
argc, argv,
"+Ab:B:c:CdDe:E:hi:I:f:F:g:G:l:L:m:M:nNOo:p:RQs:S:t:T:UV:WXx:YZ")) >
"+Ab:B:c:CdDe:E:hi:I:f:F:g:G:l:L:m:M:nNOo:p:RQs:S:t:T:u:UV:WXx:YZ")) >
0) {
switch (opt) {
@ -665,6 +668,14 @@ int main(int argc, char **argv_orig, char **envp) {
break;
case 'u':
if (sscanf(optarg, "%llu", &stats_update_freq_sec) < 1) {
FATAL("Bad syntax used for -u");
}
afl->stats_file_update_freq_msecs = stats_update_freq_sec * 1000;
break;
case 'i': /* input dir */
if (afl->in_dir) { FATAL("Multiple -i options not supported"); }