@@ -136,18 +136,14 @@ def process_afl_test_cases(cargs):
136
136
afl_files .append (f )
137
137
new_files .append (f ) # needed below to check if sleep is necessary
138
138
139
- # set up directories
140
- if not cargs .afl_fuzzing_dir :
141
- print "[*] Must specify AFL fuzzing dir with --afl-fuzzing-dir or -d"
142
- return False
139
+ if new_files :
140
+ gen_paths (fuzz_dir , cov_paths , new_files [0 ], cargs )
141
+ else :
142
+ rv = False
143
+ break
143
144
144
145
def_dir = cargs .afl_fuzzing_dir + '/cov'
145
146
146
- for ext in ['diff' , 'lcov' , 'web' ]:
147
- checkdir = "%s/%s" % (def_dir , ext )
148
- if not is_dir (checkdir ):
149
- os .mkdir (checkdir )
150
-
151
147
# run initial command
152
148
lcov_opts = ''
153
149
if cargs .enable_branch_coverage :
@@ -165,8 +161,9 @@ def process_afl_test_cases(cargs):
165
161
for index , f in enumerate (afl_files ):
166
162
curr_cycle = get_cycle_num (index , cargs )
167
163
168
- logr ("[+] AFL test case: %s (%d / %d), cycle: %d" % (os .path .basename (f ), index + 1 , len (afl_files ),
169
- curr_cycle ), cov_paths ['log_file' ], cargs )
164
+ logr ("[+] AFL test case: %s (%d / %d), cycle: %d" % \
165
+ (os .path .basename (f ), index + 1 , len (afl_files ),
166
+ curr_cycle ), cov_paths ['log_file' ], cargs )
170
167
171
168
if cargs .coverage_cmd :
172
169
# execute the command to generate code coverage stats
@@ -333,6 +330,7 @@ def process_afl_test_cases(cargs):
333
330
logr ("[+] afl-fuzz appears to be stopped..." ,
334
331
cov_paths ['log_file' ], cargs )
335
332
break
333
+ ### only go once through the loop unless we are in --live mode
336
334
else :
337
335
break
338
336
0 commit comments