Add -m/--modules command line argument

pull/88/head
Bernhard Mueller 7 years ago
parent 6e8eb8c0d2
commit 765b450fa4
  1. 6
      myth
  2. 9
      mythril/analysis/security.py

@ -78,6 +78,7 @@ utilities.add_argument('--storage', help='read state variables from storage inde
utilities.add_argument('--solv', help='specify solidity compiler version. If not present, will try to install it (Experimental)', metavar='SOLV')
options = parser.add_argument_group('options')
options.add_argument('-m', '--modules', help='Comma-separated list of security analysis modules', metavar='MODULES')
options.add_argument('--sync-all', action='store_true', help='Also sync contracts with zero balance')
options.add_argument('--max-depth', type=int, default=12, help='Maximum recursion depth for symbolic execution')
options.add_argument('--solc-args', help='Extra arguments for solc')
@ -412,7 +413,10 @@ elif (args.graph) or (args.fire_lasers):
# except Exception as e:
# exitWithError(args.outform, "Symbolic exection error: " + str(e))
issues = fire_lasers(sym)
if args.modules:
issues = fire_lasers(sym, args.modules.split(","))
else:
issues = fire_lasers(sym)
if len(issues):

@ -4,18 +4,19 @@ import pkgutil
import logging
def fire_lasers(statespace):
def fire_lasers(statespace, module_names=None):
issues = []
_modules = []
for loader, name, is_pkg in pkgutil.walk_packages(modules.__path__):
_modules.append(loader.find_module(name).load_module(name))
logging.info("Starting analysis")
for module in _modules:
logging.info("Executing " + str(module))
issues += module.execute(statespace)
if not module_names or module.__name__ in module_names:
logging.info("Executing " + str(module))
issues += module.execute(statespace)
return issues

Loading…
Cancel
Save