コード例 #1
0
 def test_run(self):
   """Test running libFuzzer fuzzer."""
   libfuzzer = fuzzer.LibFuzzer()
   libfuzzer.run("/input", "/output", 1)
   with open("/output/flags-0") as f:
     self.assertEqual("%TESTCASE% target -timeout=25 -rss_limit_mb=2560",
                      f.read())
コード例 #2
0
 def test_run(self):
     """Test running libFuzzer fuzzer."""
     libfuzzer = fuzzer.LibFuzzer()
     libfuzzer.run('/input', '/output', 1)
     with open('/output/flags-0') as f:
         self.assertEqual(
             '%TESTCASE% target -timeout=25 -rss_limit_mb=2048', f.read())
コード例 #3
0
  def test_generate_arguments_default(self):
    """Test generateArgumentsForFuzzer."""
    fuzzer_path = os.path.join(self.build_dir, "fake0_fuzzer")
    libfuzzer = fuzzer.LibFuzzer()
    arguments = libfuzzer.generate_arguments(fuzzer_path)
    expected_arguments = "-timeout=25 -rss_limit_mb=2560"

    self.assertEqual(arguments, expected_arguments)
コード例 #4
0
  def test_generate_arguments_with_options_file(self):
    """Test generateArgumentsForFuzzer."""
    fuzzer_path = os.path.join(self.build_dir, "fake1_fuzzer")
    libfuzzer = fuzzer.LibFuzzer()
    arguments = libfuzzer.generate_arguments(fuzzer_path)

    expected_arguments = (
        "-max_len=31337 -runs=9999999 -timeout=11 -rss_limit_mb=2560")
    self.assertEqual(arguments, expected_arguments)
コード例 #5
0
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Builtin fuzzers."""

from bot.fuzzers.afl import fuzzer as afl
from bot.fuzzers.libFuzzer import fuzzer as libFuzzer

BUILTIN_FUZZERS = {
    'afl': afl.Afl(),
    'libFuzzer': libFuzzer.LibFuzzer(),
}


def get(fuzzer_name):
    """Get the builtin fuzzer with the given name, or None."""
    if fuzzer_name not in BUILTIN_FUZZERS:
        return None

    return BUILTIN_FUZZERS[fuzzer_name]
コード例 #6
0
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Builtin fuzzers."""
from bot.fuzzers.afl import fuzzer as afl
from bot.fuzzers.libFuzzer import fuzzer as libFuzzer

BUILTIN_FUZZERS = {"afl": afl.Afl(), "libFuzzer": libFuzzer.LibFuzzer()}


def get(fuzzer_name):
    """Get the builtin fuzzer with the given name, or None."""
    if fuzzer_name not in BUILTIN_FUZZERS:
        return None

    return BUILTIN_FUZZERS[fuzzer_name]