Migrate fuzzer frontends to submodule

* Move frontends to deepstate.frontend
* Add dynamic loading in __init__.py for future frontends
* Refactor setup.py.in
This commit is contained in:
ex0dus-0x 2019-07-15 17:17:09 -04:00
parent a7ae8e8991
commit 9789a1dd29
No known key found for this signature in database
GPG Key ID: DABAD5DB9BDD540E
5 changed files with 25 additions and 4 deletions

View File

@ -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__)

View File

@ -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

View File

@ -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'
]
})