Esempio n. 1
0
def get_config():
    """Get arguments for a given fuzz target."""
    device_serial = environment.get_value('ANDROID_SERIAL')
    build_dir = environment.get_value('BUILD_DIR')
    temp_dir = fuzzer_utils.get_temp_dir()

    binary_path = os.path.join(build_dir, 'syzkaller')
    json_config_path = os.path.join(temp_dir, 'config.json')
    default_vmlinux_path = os.path.join('/tmp', device_serial, 'vmlinux')
    vmlinux_path = environment.get_value('VMLINUX_PATH', default_vmlinux_path)

    syzhub_address = environment.get_value('SYZHUB_ADDRESS')
    syzhub_client = environment.get_value('SYZHUB_CLIENT')
    syzhub_key = environment.get_value('SYZHUB_KEY')
    on_cuttlefish = environment.is_android_cuttlefish()

    config.generate(serial=device_serial,
                    work_dir_path=get_work_dir(),
                    binary_path=binary_path,
                    vmlinux_path=vmlinux_path,
                    config_path=json_config_path,
                    kcov=True,
                    reproduce=False,
                    syzhub_address=syzhub_address,
                    syzhub_client=syzhub_client,
                    syzhub_key=syzhub_key,
                    on_cuttlefish=on_cuttlefish)
    return ['-config', json_config_path]
Esempio n. 2
0
 def _create_temp_corpus_dir(self, name):
     """Create temporary corpus directory."""
     new_corpus_directory = os.path.join(fuzzer_utils.get_temp_dir(), name)
     engine_common.recreate_directory(new_corpus_directory)
     return new_corpus_directory
Esempio n. 3
0
 def _create_empty_testcase_file(self):
     """Create an empty testcase file in temporary directory."""
     _, path = tempfile.mkstemp(dir=fuzzer_utils.get_temp_dir())
     return path