Skip to content

Commit

Permalink
Fix the setup of Grimoire
Browse files Browse the repository at this point in the history
The previous version of fuzzer.py was possibly copy-pasted from
Nautilus and applied unexpected CLI setup. The patch fixes these
issues.
  • Loading branch information
renatahodovan committed Sep 25, 2024
1 parent 915cd23 commit 7c53361
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions fuzzers/grimoire/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ def prepare_fuzz_environment(input_corpus):

def build(): # pylint: disable=too-many-branches,too-many-statements
"""Build benchmark."""
benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'javascript' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/js_nautilus.json'
else:
raise RuntimeError('Unsupported benchmark, unavailable grammar')
dest = os.path.join(os.environ['OUT'], 'grammar.json')
shutil.copy(copy_file, dest)

os.environ['CC'] = '/libafl_fuzzbench/target/release/grimoire_cc'
os.environ['CXX'] = '/libafl_fuzzbench/target/release/grimoire_cxx'

Expand All @@ -74,9 +62,8 @@ def fuzz(input_corpus, output_corpus, target_binary):
command = [target_binary]
if dictionary_path:
command += (['-x', dictionary_path])
grammar = os.path.join(os.environ['OUT'], 'grammar.json')
out = os.path.join(os.environ['OUT'], 'out')
os.mkdir(out)
command += (['-r', output_corpus, '-o', out, '-g', grammar])
command += (['-i', input_corpus, '-r', output_corpus, '-o', out])
print(command)
subprocess.check_call(command, cwd=os.environ['OUT'])

0 comments on commit 7c53361

Please sign in to comment.