Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/atheris/__init__.py: 90%

21 statements  

« prev     ^ index     » next       coverage.py v7.0.1, created at 2022-12-25 06:11 +0000

1# Copyright 2021 Google Inc. 

2# Copyright 2021 Fraunhofer FKIE 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15"""Atheris is a coverage-guided Python fuzzing engine.""" 

16 

17from typing import List 

18from .function_hooks import enabled_hooks 

19from .function_hooks import gen_match 

20from .import_hook import instrument_imports 

21from .instrument_bytecode import instrument_all 

22from .instrument_bytecode import instrument_func 

23from .instrument_bytecode import patch_code 

24from .utils import path 

25# MyPy cannot find native code. 

26from .native import _reserve_counter # type: ignore[import] 

27from .native import _trace_branch # type: ignore[import] 

28from .native import _trace_cmp # type: ignore[import] 

29from .native import _trace_regex_match # type: ignore[import] 

30from .native import ALL_REMAINING # type: ignore[import] 

31from .native import Fuzz # type: ignore[import] 

32from .native import FuzzedDataProvider # type: ignore[import] 

33from .native import Mutate # type: ignore[import] 

34from .native import Setup # type: ignore[import] 

35 

36# PyInstaller Support 

37# PyInstaller doesn't automatically support lazy imports, which happens because 

38# we dynamically decide whether to import the with/without_libfuzzer versions of 

39# the core module. This function tells it where to look for a hook-atheris.py 

40# file. 

41 

42 

43def get_hook_dirs() -> List[str]: 

44 import os # pylint: disable=g-import-not-at-top 

45 return [os.path.dirname(__file__)]