diff --git a/README.md b/README.md index 71ce1d8fd..03c8712b3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Slither is a Solidity static analysis framework written in Python 3. It runs a s ## Usage ``` -$ slither tests/uninitialized.sol +$ slither tests/uninitialized.sol # argument can be file, folder or glob, be sure to quote the argument when using a glob [..] INFO:Detectors:Uninitialized state variables in tests/uninitialized.sol, Contract: Uninitialized, Vars: destination, Used in ['transfer'] [..] diff --git a/slither/__main__.py b/slither/__main__.py index 4b03483a1..9c59f0205 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -189,12 +189,16 @@ def main_impl(all_detector_classes, all_printer_classes): try: filename = args.filename + globbed_filenames = glob.glob(filename, recursive=True) + if os.path.isfile(filename): (results, number_contracts) = process(filename, args, detector_classes, printer_classes) - elif os.path.isdir(filename): + elif os.path.isdir(filename) or len(globbed_filenames) > 0: extension = "*.sol" if not args.solc_ast else "*.json" filenames = glob.glob(os.path.join(filename, extension)) + if len(filenames) == 0: + filenames = globbed_filenames number_contracts = 0 results = [] for filename in filenames: