diff --git a/bin/deepstate/frontend/__init__.py b/bin/deepstate/frontend/__init__.py new file mode 100644 index 0000000..67a977d --- /dev/null +++ b/bin/deepstate/frontend/__init__.py @@ -0,0 +1,21 @@ +import sys +import pkgutil +import importlib + +from .frontend import DeepStateFrontend + +def import_fuzzers(pkg_name): + """ + dynamically load fuzzer frontends using importlib + + TODO(alan): find way to alias modnames so we can check + them before importing (ie. fuzzer submods need to start with `front_*`) + """ + package = sys.modules[pkg_name] + return [ + importlib.import_module(pkg_name + '.' + submod) + for _, submod, _ in pkgutil.walk_packages(package.__path__) + #if submod != "frontend" + ] + +__all__ = import_fuzzers(__name__) diff --git a/bin/deepstate/angora.py b/bin/deepstate/frontend/angora.py similarity index 100% rename from bin/deepstate/angora.py rename to bin/deepstate/frontend/angora.py diff --git a/bin/deepstate/eclipser.py b/bin/deepstate/frontend/eclipser.py similarity index 100% rename from bin/deepstate/eclipser.py rename to bin/deepstate/frontend/eclipser.py diff --git a/bin/deepstate/frontend.py b/bin/deepstate/frontend/frontend.py similarity index 99% rename from bin/deepstate/frontend.py rename to bin/deepstate/frontend/frontend.py index c55323f..47ed950 100644 --- a/bin/deepstate/frontend.py +++ b/bin/deepstate/frontend/frontend.py @@ -119,7 +119,6 @@ class DeepStateFrontend(object): if cli_other is not None: self.cmd += cli_other - def execute_fuzzer(self): """ takes constructed cli command and executes fuzzer with subprocess.call diff --git a/bin/setup.py.in b/bin/setup.py.in index 265f4cf..7aa64b4 100644 --- a/bin/setup.py.in +++ b/bin/setup.py.in @@ -23,7 +23,7 @@ setuptools.setup( name="deepstate", version="0.1", package_dir={"": "${CMAKE_SOURCE_DIR}/bin"}, - packages=['deepstate'], + packages=['deepstate', 'deepstate.frontend'], description="DeepState augments C/C++ Test-Driven Development with Symbolic Execution", url="https://github.com/trailofbits/deepstate", author="Peter Goodman", @@ -37,7 +37,8 @@ setuptools.setup( 'deepstate-angr = deepstate.main_angr:main', 'deepstate-manticore = deepstate.main_manticore:main', 'deepstate-reduce = deepstate.reducer:main', - 'deepstate-eclipser = deepstate.eclipser:main', - 'deepstate-angora = deepstate.angora:main' + 'deepstate-afl = deepstate.frontend.afl:main', + 'deepstate-eclipser = deepstate.frontend.eclipser:main', + 'deepstate-angora = deepstate.frontend.angora:main' ] })