Skip to content

Commit

Permalink
display power schedule in status screen
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhauser-thc committed Jun 23, 2019
1 parent 2db576f commit 1cc69df
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions afl-fuzz.c
Expand Up @@ -86,6 +86,7 @@ EXP_ST u8 *in_dir, /* Input directory with test cases */
*tmp_dir , /* Temporary directory for input */
*sync_dir, /* Synchronization directory */
*sync_id, /* Fuzzer ID */
*power_name, /* Power schedule name */
*use_banner, /* Display banner */
*in_bitmap, /* Input bitmap */
*doc_path, /* Path to documentation dir */
Expand Down Expand Up @@ -114,6 +115,15 @@ enum {
/* 05 */ EXPLOIT /* AFL's exploitation-based const. */
};

char *power_names[] = {
"explore",
"fast",
"coe",
"lin",
"quad",
"exploit"
};

static u8 schedule = EXPLORE; /* Power schedule (default: EXPLORE)*/

EXP_ST u8 skip_deterministic, /* Skip deterministic stages? */
Expand Down Expand Up @@ -4271,13 +4281,13 @@ static void show_stats(void) {

/* Let's start by drawing a centered banner. */

banner_len = (crash_mode ? 24 : 22) + strlen(VERSION) + strlen(use_banner);
banner_len = (crash_mode ? 24 : 22) + strlen(VERSION) + strlen(use_banner) + strlen(power_name) + 3;
banner_pad = (79 - banner_len) / 2;
memset(tmp, ' ', banner_pad);

sprintf(tmp + banner_pad, "%s " cLCY VERSION cLGN
" (%s)", crash_mode ? cPIN "peruvian were-rabbit" :
cYEL "american fuzzy lop", use_banner);
" (%s) " cPIN "[%s]", crash_mode ? cPIN "peruvian were-rabbit" :
cYEL "american fuzzy lop", use_banner, power_name);

SAYF("\n%s\n", tmp);

Expand Down Expand Up @@ -7546,10 +7556,10 @@ static void fix_up_banner(u8* name) {

}

if (strlen(use_banner) > 40) {
if (strlen(use_banner) > 32) {

u8* tmp = ck_alloc(44);
sprintf(tmp, "%.40s...", use_banner);
u8* tmp = ck_alloc(36);
sprintf(tmp, "%.32s...", use_banner);
use_banner = tmp;

}
Expand Down Expand Up @@ -8354,10 +8364,8 @@ int main(int argc, char** argv) {
} else {
FATAL("Unknown -p power schedule");
}

break;


case 'e':

if (file_extension) FATAL("Multiple -e options not supported");
Expand Down Expand Up @@ -8544,6 +8552,8 @@ int main(int argc, char** argv) {
setup_signal_handlers();
check_asan_opts();

power_name = power_names[schedule];

if (sync_id) fix_up_sync();

if (!strcmp(in_dir, out_dir))
Expand Down

0 comments on commit 1cc69df

Please sign in to comment.