From aa3e115575adad48da2d3aaac11c6bc5be8d2683 Mon Sep 17 00:00:00 2001 From: Scott Piper Date: Mon, 24 Dec 2018 14:52:23 -0700 Subject: [PATCH] Bumped version and added private_commands ability --- .gitignore | 3 ++- README.md | 1 + cloudmapper.py | 13 +++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 33a9ad65e..9583e08a0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ htmlcov/ account-data/ tmp/ trusted_ips.png -data/ \ No newline at end of file +data/ +private_commands/ \ No newline at end of file diff --git a/README.md b/README.md index 432879c8c..dc3b94658 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ python cloudmapper.py collect --account my_account - `stats`: Show counts of resources for accounts. More details [here](https://summitroute.com/blog/2018/06/06/cloudmapper_stats/). - `wot`: Show Web Of Trust. More details [here](https://summitroute.com/blog/2018/06/13/cloudmapper_wot/). +If you want to add your own private commands, you can create a `private_commands` directory and add them there. Licenses -------- diff --git a/cloudmapper.py b/cloudmapper.py index 5f3fdaf2e..c1ea6cdec 100755 --- a/cloudmapper.py +++ b/cloudmapper.py @@ -31,7 +31,7 @@ import importlib import commands -__version__ = "2.2.0" +__version__ = "2.2.1" def show_help(commands): print("CloudMapper {}".format(__version__)) @@ -47,11 +47,12 @@ def main(): # Load commands # TODO: This adds half a second to the start time. Is there a smarter way to do this? commands = {} - commands_path = 'commands' - for importer, command_name, _ in pkgutil.iter_modules([commands_path]): - full_package_name = '%s.%s' % (commands_path, command_name) - module = importlib.import_module(full_package_name) - commands[command_name] = module + commands_paths = ['commands', 'private_commands'] + for commands_path in commands_paths: + for importer, command_name, _ in pkgutil.iter_modules([commands_path]): + full_package_name = '%s.%s' % (commands_path, command_name) + module = importlib.import_module(full_package_name) + commands[command_name] = module # Parse command if len(sys.argv) <= 1: